Documentation
¶
Overview ¶
Package goprof is a trace kind that reads the pprof profiles of the Go processes of a tree at each checkpoint its host marks: over a process's net/http/pprof server or gops agent, or from a -cpuprofile/-memprofile file a test binary wrote. It stores each profile as its samples aggregated by stack, one record per sample type and stack, and exports them as pprof.
Index ¶
Constants ¶
const ( SourcePProf = "pprof" SourceGops = "gops" SourceFile = "file" )
The sources a profile is read from.
const Kind = "goprof"
Kind is the name a host registers the kind as.
Variables ¶
var PProf = tracing.ExportFormat{Name: "pprof", Ext: "pb.gz", MIME: "application/octet-stream"}
PProf is the format a window downloads in as one pprof profile, which go tool pprof reads.
var Profiles = []string{"cpu", "heap", "allocs", "mutex", "block", "goroutine"}
Profiles are the profiles a checkpoint reads.
Functions ¶
Types ¶
type CheckpointParams ¶
type CheckpointParams struct {
Key string `json:"key,omitempty"`
PID int `json:"pid,omitempty"`
Source string `json:"source"`
Profile string `json:"profile"`
Seconds int `json:"seconds,omitempty"`
Path string `json:"path,omitempty"`
Reason string `json:"reason,omitempty"`
}
CheckpointParams are what a checkpoint reads: Profile of the process Key or PID names, the root when neither does, from Source. A cpu profile over pprof runs for Seconds; a gops agent runs it for 30s. A file source reads Path, a profile a process that may have exited wrote, recorded under the key or pid given. Reason is recorded with the samples.
func (CheckpointParams) Validate ¶
func (p CheckpointParams) Validate() error
type Params ¶
type Params struct {
// RootPID is the process whose tree is profiled; zero is the host's own.
RootPID int `json:"rootPid,omitempty" clicky:"title=Root PID"`
}
Params choose the tree whose processes a capture profiles.
type Sample ¶
type Sample struct {
CheckpointID string `json:"checkpointId" pretty:"hide" filter:"exact"`
TakenAt time.Time `json:"takenAt" pretty:"label=Taken" sort:"takenAt"`
Reason string `json:"reason,omitempty" filter:"terms"`
Source string `json:"source" filter:"terms"`
Key string `json:"key" pretty:"hide" filter:"exact"`
PID int `json:"pid" pretty:"label=PID" filter:"terms"`
Profile string `json:"profile" filter:"terms"`
SampleType string `json:"sampleType" filter:"terms"`
Unit string `json:"unit"`
Value int64 `json:"value" sort:"value"`
Frames []stacks.Frame `json:"frames" pretty:"hide"`
StackHash string `json:"stackHash" pretty:"hide" filter:"exact"`
}
Sample is the record the kind stores: the value one stack holds of one sample type of a profile, its frames innermost first.