Documentation
¶
Index ¶
- Constants
- Variables
- func DiagnosticEnabled(typ diagnostics.Type) bool
- func PerfFlags() []string
- func ProcessPeakRSS(s *os.ProcessState) uint64
- func ReadPeakRSS(pid int) (uint64, error)
- func ReadPeakVM(pid int) (uint64, error)
- func ReadRSS(pid int) (uint64, error)
- func RunBenchmark(name string, f func(*B) error, opts ...RunOption) error
- func SetFlags(f *flag.FlagSet)
- type B
- type DiagnosticFile
- type Diagnostics
- func (d *Diagnostics) Commit(b *B) error
- func (d *Diagnostics) Create(typ diagnostics.Type) (*DiagnosticFile, error)
- func (d *Diagnostics) CreateNamed(typ diagnostics.Type, name string) (*DiagnosticFile, error)
- func (d *Diagnostics) MarshalText() (text []byte, err error)
- func (d *Diagnostics) UnmarshalText(text []byte) error
- type RunOption
- func BenchmarkPID(pid int) RunOption
- func DoAvgRSS(f func() (uint64, error)) RunOption
- func DoCPUProfile(v bool) RunOption
- func DoCoreDump(v bool) RunOption
- func DoDefaultAvgRSS() RunOption
- func DoMemProfile(v bool) RunOption
- func DoPeakRSS(v bool) RunOption
- func DoPeakVM(v bool) RunOption
- func DoPerf(v bool) RunOption
- func DoTime(v bool) RunOption
- func DoTrace(v bool) RunOption
- func WithContext(ctx context.Context) RunOption
- func WithGOMAXPROCS(procs int) RunOption
- func WriteResultsTo(wr io.Writer) RunOption
Constants ¶
const ( StatPeakRSS = "peak-RSS-bytes" StatPeakVM = "peak-VM-bytes" StatAvgRSS = "average-RSS-bytes" StatTime = "ns/op" )
Variables ¶
var InProcessMeasurementOptions = []RunOption{ DoTime(true), DoPeakRSS(true), DoDefaultAvgRSS(), DoPeakVM(true), DoCoreDump(true), DoCPUProfile(true), DoMemProfile(true), DoPerf(true), DoTrace(true), }
Functions ¶
func DiagnosticEnabled ¶
func DiagnosticEnabled(typ diagnostics.Type) bool
func ProcessPeakRSS ¶
func ProcessPeakRSS(s *os.ProcessState) uint64
func ReadPeakRSS ¶
func ReadPeakVM ¶
Types ¶
type B ¶
type B struct {
// contains filtered or unexported fields
}
func (*B) ResetTimer ¶
func (b *B) ResetTimer()
func (*B) StartTimer ¶
func (b *B) StartTimer()
func (*B) TimerRunning ¶
type DiagnosticFile ¶
func (*DiagnosticFile) Commit ¶
func (f *DiagnosticFile) Commit()
Commit indicates that diagnostic file f is ready to be merged into the final output. For a diagnostic that cannot be truncated, this should only be called when the file has been fully written.
type Diagnostics ¶
type Diagnostics struct {
// contains filtered or unexported fields
}
func NewDiagnostics ¶
func NewDiagnostics(name string) *Diagnostics
func (*Diagnostics) Commit ¶
func (d *Diagnostics) Commit(b *B) error
Commit combines all individually committed diagnostic files into the final output files. If there are multiple diagnostic files with the same type and name, it merges them into a single file. If b != nil, it adds metrics for diagnostic file sizes to b.
func (*Diagnostics) Create ¶
func (d *Diagnostics) Create(typ diagnostics.Type) (*DiagnosticFile, error)
Create is shorthand for CreateNamed(typ, "").
func (*Diagnostics) CreateNamed ¶
func (d *Diagnostics) CreateNamed(typ diagnostics.Type, name string) (*DiagnosticFile, error)
CreateNamed returns a new file that a diagnostic can be written to. If this type of diagnostic can be merged, this can be called multiple times with the same type and name and Commit will merge all of the files. The caller must close this file. Diagnostic files are temporary until the caller calls DiagnosticFile.Commit to indicate they are ready for merging into the final output.
func (*Diagnostics) MarshalText ¶
func (d *Diagnostics) MarshalText() (text []byte, err error)
MarshalText marshals this Diagnostics configuration into text that can be passed to another process (e.g., via a flag) and unmarshaled into a new Diagnostics with UnmarshalText. That other process may call Create* on the result and use the resulting [DiagnosticsFile]s as usual, but it must not call Diagnostics.Commit.
func (*Diagnostics) UnmarshalText ¶
func (d *Diagnostics) UnmarshalText(text []byte) error
type RunOption ¶
type RunOption func(*B)
func BenchmarkPID ¶
func DoCPUProfile ¶
func DoCoreDump ¶
func DoDefaultAvgRSS ¶
func DoDefaultAvgRSS() RunOption