inspect

package
v0.0.0-...-11fc026 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile struct {
	Name        string    `json:"name"` // name identifies the measured quantity ("fetchSingle() or api.GetAllMetrics()")
	Description string    `json:"description,omitempty"`
	Start       time.Time `json:"start"`  // the start time of the task
	Finish      time.Time `json:"finish"` // the end time of the task
}

A Profile is a single data point collected by the profiler.

func (Profile) Duration

func (p Profile) Duration() time.Duration

Duration is the duration of the profile (Finish - Start).

type Profiler

type Profiler struct {
	// contains filtered or unexported fields
}

Profiler contains a sequence of profiles which are collected over the course of a query execution.

func New

func New() *Profiler

func (*Profiler) AddProfile

func (p *Profiler) AddProfile(profile Profile)

func (*Profiler) All

func (p *Profiler) All() []Profile

All retrieves all the profiling information collected by the profiler.

func (*Profiler) Do

func (p *Profiler) Do(name string, action func())

Do will perform and time the action given. It behaves in a threadsafe manner. If the profiler is nil, the action will be performed, but no profile will be recorded.

func (*Profiler) Flush

func (p *Profiler) Flush() []Profile

Flush provides a safe way to clear the profiles from its list. It's guaranteed that no profiles will be lost by calling this method.

func (*Profiler) Record

func (p *Profiler) Record(name string) func()

Record will create a profile of the given name from `start` until the current time. Record acts in a threadsafe manner.

func (*Profiler) RecordWithDescription

func (p *Profiler) RecordWithDescription(name string, description string) func()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL