perfdata

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package perfdata defines the JSON schema shared by the perf tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anchor

type Anchor struct {
	Name       string            `json:"name"`
	Package    string            `json:"package"`
	NSPerOp    float64           `json:"ns_per_op"`
	Iterations int64             `json:"iterations,omitempty"`
	Samples    []BenchmarkSample `json:"samples,omitempty"`
}

Anchor captures the absolute speed of the calibration benchmark.

type Baseline

type Baseline struct {
	Version       int                       `json:"version"`
	CapturedAt    string                    `json:"captured_at"`
	CapturedAtSHA string                    `json:"captured_at_sha"`
	Machine       Machine                   `json:"machine"`
	Anchor        Anchor                    `json:"anchor"`
	Benchmarks    map[string]BenchmarkEntry `json:"benchmarks"`
}

Baseline is the on-disk format. Keep field tags stable.

type BenchmarkEntry

type BenchmarkEntry struct {
	NSPerOp       float64           `json:"ns_per_op"`
	AllocsPerOp   int64             `json:"allocs_per_op"`
	BytesPerOp    int64             `json:"bytes_per_op"`
	RatioToAnchor float64           `json:"ratio_to_anchor"`
	BestSinceSHA  string            `json:"best_since_sha,omitempty"`
	BestSinceAt   string            `json:"best_since_at,omitempty"`
	Samples       []BenchmarkSample `json:"samples,omitempty"`
}

BenchmarkEntry is one benchmark's current summary plus optional raw samples.

type BenchmarkSample

type BenchmarkSample struct {
	Iterations    int64   `json:"iterations"`
	NSPerOp       float64 `json:"ns_per_op"`
	BytesPerOp    int64   `json:"bytes_per_op"`
	AllocsPerOp   int64   `json:"allocs_per_op"`
	RatioToAnchor float64 `json:"ratio_to_anchor,omitempty"`
	CapturedAt    string  `json:"captured_at,omitempty"`
}

BenchmarkSample is one raw benchmark measurement retained for statistics.

type Machine

type Machine struct {
	OS        string `json:"os"`
	Arch      string `json:"arch"`
	NumCPU    int    `json:"num_cpu"`
	CPUModel  string `json:"cpu_model"`
	GoVersion string `json:"go_version"`
}

Machine fingerprints the host that captured a baseline.

type StreamRecord

type StreamRecord struct {
	Package     string  `json:"package"`
	Name        string  `json:"name"`
	Iterations  int64   `json:"iterations"`
	NSPerOp     float64 `json:"ns_per_op"`
	BytesPerOp  int64   `json:"bytes_per_op"`
	AllocsPerOp int64   `json:"allocs_per_op"`
	CapturedAt  string  `json:"captured_at"`
}

StreamRecord is one .jsonl line emitted by bench-ratchet capture.

func (StreamRecord) Sample

func (r StreamRecord) Sample() BenchmarkSample

Sample returns the record's benchmark measurement without identity fields.

Jump to

Keyboard shortcuts

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