Documentation
¶
Overview ¶
Package selfbench measures file-discovered Flow workloads in process.
Index ¶
- func RenderActionTree(w io.Writer, actions []ActionProfile) error
- func RenderCPUProfileSummary(w io.Writer, summary CPUProfileSummary) error
- func Run(ctx context.Context, cfg runner.Config, scenarios []Scenario, opts Options) int
- type ActionProfile
- type ActionProfiler
- type AllocationPerRun
- type AllocationStats
- type CPUProfile
- type CPUProfileSummary
- type Options
- type Report
- type Result
- type Scenario
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderActionTree ¶ added in v0.100.1
func RenderActionTree(w io.Writer, actions []ActionProfile) error
RenderActionTree writes action spans in parent-child order. Inclusive wall time includes descendants; self wall time subtracts the union of direct child intervals and is not CPU time.
func RenderCPUProfileSummary ¶ added in v0.100.1
func RenderCPUProfileSummary(w io.Writer, summary CPUProfileSummary) error
RenderCPUProfileSummary writes the saved pprof path and readable top functions. It is suitable for stderr so command output and JSON remain clean.
Types ¶
type ActionProfile ¶ added in v0.99.0
type ActionProfile struct {
Action string `json:"action"`
Path string `json:"path"`
Parent string `json:"parent,omitempty"`
Depth int `json:"depth"`
Calls int `json:"calls"`
Errors int `json:"errors,omitempty"`
Retries int `json:"retries,omitempty"`
TotalMs float64 `json:"total_ms"`
SelfMs float64 `json:"self_ms"`
MeanMs float64 `json:"mean_ms"`
MeanSelfMs float64 `json:"mean_self_ms"`
MaxMs float64 `json:"max_ms"`
MaxSelfMs float64 `json:"max_self_ms"`
}
ActionProfile aggregates one node in an action call tree across measured runs. TotalMs is inclusive wall time; SelfMs subtracts the union of direct child spans and is therefore exclusive wall time, not CPU time.
type ActionProfiler ¶ added in v0.100.1
type ActionProfiler struct {
// contains filtered or unexported fields
}
ActionProfiler records action invocations while enabled. Hooks are attached to resolved actions and streams by runner.Config.Hooks, so nested executions inherit parent spans through their context.
func NewActionProfiler ¶ added in v0.100.1
func NewActionProfiler() *ActionProfiler
NewActionProfiler constructs a profiler ready to be attached to a runner.
func (*ActionProfiler) Hook ¶ added in v0.100.1
func (p *ActionProfiler) Hook() action.AnyHook
Hook returns the Kernel hook that records action start, completion, errors, and retries. Install it in runner.Config.Hooks before compiling the workflow.
func (*ActionProfiler) Snapshot ¶ added in v0.100.1
func (p *ActionProfiler) Snapshot() []ActionProfile
Snapshot returns action call-tree aggregates sorted by path. Child intervals are merged before subtraction, so concurrent overlapping siblings are never subtracted twice from their parent's exclusive wall time.
func (*ActionProfiler) Start ¶ added in v0.100.1
func (p *ActionProfiler) Start()
Start clears prior measurements and begins recording. It is safe to reuse a profiler for separate measured windows after the previous window has stopped.
func (*ActionProfiler) Stop ¶ added in v0.100.1
func (p *ActionProfiler) Stop()
Stop ends the current measurement window. Already-started spans still finish normally and remain in the snapshot.
type AllocationPerRun ¶ added in v0.99.0
type AllocationPerRun struct {
Runs int `json:"runs"`
AllocationsPerRun float64 `json:"allocations_per_run"`
BytesPerRun float64 `json:"bytes_per_run"`
}
AllocationPerRun summarizes allocations over repeated runs.
type AllocationStats ¶ added in v0.99.0
AllocationStats counts Go heap allocations made during a phase. Bytes are cumulative allocated bytes, not live heap size or resident memory.
type CPUProfile ¶ added in v0.100.1
type CPUProfile struct {
// contains filtered or unexported fields
}
CPUProfile controls one process-wide CPU profile. Go permits only one active CPU profile per process; call Stop before starting another profile.
func StartCPUProfile ¶ added in v0.100.1
func StartCPUProfile(path string) (*CPUProfile, error)
StartCPUProfile starts recording CPU samples from the current process to path. The resulting file is a standard Go pprof profile.
func (*CPUProfile) Stop ¶ added in v0.100.1
func (p *CPUProfile) Stop() (CPUProfileSummary, error)
Stop flushes and closes the profile, then attempts to render its top functions. It is idempotent and safe to call from cleanup paths.
type CPUProfileSummary ¶ added in v0.100.1
type CPUProfileSummary struct {
Path string `json:"path"`
TopFunctions string `json:"top_functions,omitempty"`
AnalysisError string `json:"analysis_error,omitempty"`
}
CPUProfileSummary identifies the saved profile and includes the readable output of `go tool pprof -top`. AnalysisError is non-fatal: the pprof file is still useful even when the Go tool or symbols are unavailable on this host.
type Options ¶
type Options struct {
Out io.Writer
Iterations int
Warmup int
JSON bool
List bool
Profile bool
CPUProfilePath string
}
Options controls measurement; zero warmup is meaningful.
type Result ¶
type Result struct {
Name string `json:"name"`
CompileMs float64 `json:"compile_ms"`
CompileAllocation AllocationStats `json:"compile_allocation"`
FirstRunMs float64 `json:"first_run_ms"`
FirstRunAllocation AllocationStats `json:"first_run_allocation"`
Warmup int `json:"warmup"`
WarmupAllocation AllocationPerRun `json:"warmup_allocation"`
Warm nodes_bench.BenchRunRes `json:"warm"`
WarmAllocation AllocationPerRun `json:"warm_allocation"`
Actions []ActionProfile `json:"actions,omitempty"`
CPUProfile *CPUProfileSummary `json:"cpu_profile,omitempty"`
Error string `json:"error,omitempty"`
}
Result separates compilation, first execution, and warm samples.
type Scenario ¶
Scenario is one source file; Name is its portable, suite-relative filter key.