driver

package
v0.0.0-...-66e2823 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatPeakRSS = "peak-RSS-bytes"
	StatPeakVM  = "peak-VM-bytes"
	StatAvgRSS  = "average-RSS-bytes"
	StatTime    = "ns/op"
)

Variables

Functions

func DiagnosticEnabled

func DiagnosticEnabled(typ diagnostics.Type) bool

func PerfFlags

func PerfFlags() []string

func ProcessPeakRSS

func ProcessPeakRSS(s *os.ProcessState) uint64

func ReadPeakRSS

func ReadPeakRSS(pid int) (uint64, error)

func ReadPeakVM

func ReadPeakVM(pid int) (uint64, error)

func ReadRSS

func ReadRSS(pid int) (uint64, error)

func RunBenchmark

func RunBenchmark(name string, f func(*B) error, opts ...RunOption) error

func SetFlags

func SetFlags(f *flag.FlagSet)

Types

type B

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

func (*B) Context

func (b *B) Context() context.Context

func (*B) Elapsed

func (b *B) Elapsed() time.Duration

func (*B) Name

func (b *B) Name() string

func (*B) Ops

func (b *B) Ops(ops int)

func (*B) Report

func (b *B) Report(name string, value uint64)

func (*B) ResetTimer

func (b *B) ResetTimer()

func (*B) StartTimer

func (b *B) StartTimer()

func (*B) StopTimer

func (b *B) StopTimer()

func (*B) TimerRunning

func (b *B) TimerRunning() bool

type DiagnosticFile

type DiagnosticFile struct {
	*os.File
}

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 BenchmarkPID(pid int) RunOption

func DoAvgRSS

func DoAvgRSS(f func() (uint64, error)) RunOption

func DoCPUProfile

func DoCPUProfile(v bool) RunOption

func DoCoreDump

func DoCoreDump(v bool) RunOption

func DoDefaultAvgRSS

func DoDefaultAvgRSS() RunOption

func DoMemProfile

func DoMemProfile(v bool) RunOption

func DoPeakRSS

func DoPeakRSS(v bool) RunOption

func DoPeakVM

func DoPeakVM(v bool) RunOption

func DoPerf

func DoPerf(v bool) RunOption

func DoTime

func DoTime(v bool) RunOption

func DoTrace

func DoTrace(v bool) RunOption

func WithContext

func WithContext(ctx context.Context) RunOption

func WithGOMAXPROCS

func WithGOMAXPROCS(procs int) RunOption

func WriteResultsTo

func WriteResultsTo(wr io.Writer) RunOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳