Documentation
¶
Overview ¶
Package profile provides lightweight wall-time stage profiling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Profiler ¶
type Profiler interface {
Stage(name string) func()
Observe(name string, files, bytes int64)
Summary(w io.Writer, totalLabel string)
}
Profiler records wall-time stage durations and optional file-transfer metrics. Call Stage to start a named stage and call the returned closure to end it. Use as: defer p.Stage("foo")() Call Observe after a stage to attach file/byte counts to its summary row.
func Disabled ¶
func Disabled() Profiler
Disabled returns a no-op Profiler that records and emits nothing.
func OrDisabled ¶
OrDisabled returns p if non-nil, otherwise Disabled(). Use at package boundaries where p may come from an unset Deps field.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder is a Profiler that accumulates wall-time durations per named stage. Repeated calls to Stage or Observe with the same name add to the existing total.
func NewRecorder ¶
func NewRecorder() *Recorder
NewRecorder returns a production Recorder using the real clock.
func (*Recorder) Observe ¶
Observe records file and byte counts for name, adding to any existing totals.