prism: github.com/geckoboard/prism/profiler Index | Files | Directories

package profiler

import "github.com/geckoboard/prism/profiler"

Index

Package Files

goid.go profile.go profiler.go sink.go

func BeginProfile Uses

func BeginProfile(rootFnName string)

BeginProfile creates a new profile.

func EndProfile Uses

func EndProfile()

EndProfile finalizes and ships a currently active profile.

func Enter Uses

func Enter(fnName string)

Enter adds a new nested function call to the profile linked to the current go-routine ID.

func Init Uses

func Init(sink Sink, capturedProfileLabel string)

Init handles the initialization of the prism profiler. This method must be called before invoking any other method from this package.

func Leave Uses

func Leave()

Leave exits the current function in the profile linked to the current go-routine ID.

func Shutdown Uses

func Shutdown()

Shutdown waits for shippers to fully dequeue any buffered profiles and shuts them down. This method should be called by main() before the program exits to ensure that no profile data is lost if the program executes too fast.

type CallMetrics Uses

type CallMetrics struct {
    FnName string `json:"fn"`

    // Total time spent in this call.
    TotalTime time.Duration `json:"total_time"`

    // Min and max time.
    MinTime time.Duration `json:"min_time"`
    MaxTime time.Duration `json:"max_time"`

    // Mean and median time.
    MeanTime   time.Duration `json:"mean_time"`
    MedianTime time.Duration `json:"median_time"`

    // Percentiles.
    P50Time time.Duration `json:"p50_time"`
    P75Time time.Duration `json:"p75_time"`
    P90Time time.Duration `json:"p90_time"`
    P99Time time.Duration `json:"p99_time"`

    // Std of time valus.
    StdDev float64 `json:"std_dev"`

    // The number of times a scope was entered by the same parent function call.
    Invocations int `json:"invocations"`

    NestedCalls []*CallMetrics `json:"calls"`
}

CallMetrics encapsulates all collected metrics about a function call that is reachable by a profile target.

type Profile Uses

type Profile struct {
    ID        uint64    `json:"-"`
    CreatedAt time.Time `json:"-"`

    Label  string       `json:"label"`
    Target *CallMetrics `json:"target"`
}

Profile wraps the processed metrics for a particular execution of a prism-hooked target.

type Sink Uses

type Sink interface {
    // Initialize the sink input channel with the specified buffer capacity.
    Open(inputBufferSize int) error

    // Shutdown the sink.
    Close() error

    // Get a channel for piping profile entries to the sink.
    Input() chan<- *Profile
}

Sink defines an interface for processing profile entries emitted by the profiler.

Directories

PathSynopsis
sink

Package profiler imports 8 packages (graph) and is imported by 2 packages. Updated 2017-01-09. Refresh now. Tools for package owners.