selfbench

package
v0.100.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package selfbench measures file-discovered Flow workloads in process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cfg runner.Config, scenarios []Scenario, opts Options) int

Run returns 0 on success, 1 on compilation/execution/output failure, and 2 on invalid options. Config must belong to the caller's live runner Host.

Types

type ActionProfile added in v0.99.0

type ActionProfile struct {
	Action  string  `json:"action"`
	Calls   int     `json:"calls"`
	Errors  int     `json:"errors,omitempty"`
	TotalMs float64 `json:"total_ms"`
	MeanMs  float64 `json:"mean_ms"`
	MaxMs   float64 `json:"max_ms"`
}

ActionProfile aggregates lifecycle time across measured warm runs. Durations are inclusive, so nested actions may overlap and must not be summed as a total.

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

type AllocationStats struct {
	Allocations uint64 `json:"allocations"`
	Bytes       uint64 `json:"bytes"`
}

AllocationStats counts Go heap allocations made during a phase. Bytes are cumulative allocated bytes, not live heap size or resident memory.

type Options

type Options struct {
	Out        io.Writer
	Iterations int
	Warmup     int
	JSON       bool
	List       bool
	Profile    bool
}

Options controls measurement; zero warmup is meaningful.

type Report

type Report struct {
	Version    int      `json:"version"`
	GoVersion  string   `json:"go_version"`
	OS         string   `json:"os"`
	Arch       string   `json:"arch"`
	CPUs       int      `json:"cpus"`
	GOMAXPROCS int      `json:"gomaxprocs"`
	Profiled   bool     `json:"profiled"`
	Results    []Result `json:"results"`
}

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"`
	Error              string                  `json:"error,omitempty"`
}

Result separates compilation, first execution, and warm samples.

type Scenario

type Scenario struct {
	Name   string `json:"name"`
	Source string `json:"-"`
	File   string `json:"-"`
}

Scenario is one source file; Name is its portable, suite-relative filter key.

func Discover

func Discover(path string, filters []string) ([]Scenario, error)

Discover recursively reads .nflow files in lexical order. An empty path uses the embedded suite. Explicit paths select a new filesystem root; symlinks within it are rejected, rather than following files outside that suite.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL