result

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package result defines the machine-readable benchmark result schema (issue #141 §9) that every benchmark run writes, and the JSON/CSV encoders the summarizer and report generator read back. Markdown is never the canonical data source — it is generated from this.

Index

Constants

View Source
const SchemaVersion = 1

SchemaVersion is bumped when the Result shape changes incompatibly, so a stored results.json can be recognized (or rejected) by a later summarizer.

Variables

This section is empty.

Functions

func ProvenanceUnit added in v0.2.1

func ProvenanceUnit(framework, benchmark string) string

ProvenanceUnit is the key a CRUD row's provenance is filed under in metadata.json: the same (framework, benchmark) pair scripts/run-crud merges rows on, in a form readable in JSON.

It must stay the merge key. Keying provenance on the framework alone would let a run of one workload relabel another workload's rows it never touched — the row-merge-vs-table-provenance mismatch issue #266 exists to eliminate (#361). Both the writer (scripts/run-crud) and the reader (internal/report) derive the unit here so they cannot drift apart. It takes the pair rather than a Result because the reader holds summary groups, not rows.

func WriteCSV

func WriteCSV(w io.Writer, results []Result) error

WriteCSV writes results as CSV with a fixed header, sorted deterministically (framework, benchmark, concurrency, trial) so a regenerated file diffs cleanly regardless of the order rows were collected in.

func WriteJSON

func WriteJSON(w io.Writer, results []Result) error

WriteJSON encodes results as a pretty-printed JSON array. This is the canonical machine-readable output; results.csv and the Markdown report are derived from it. Rows are sorted the same way WriteCSV sorts them, so the committed results.json is stable across runs that collected rows in a different order.

Types

type Latency

type Latency struct {
	P50 float64 `json:"p50"`
	P95 float64 `json:"p95"`
	P99 float64 `json:"p99"`
}

Latency holds the tail-latency percentiles for a single trial, in milliseconds.

type Result

type Result struct {
	SchemaVersion     int     `json:"schema_version"`
	Framework         string  `json:"framework"`
	FrameworkVersion  string  `json:"framework_version"`
	Runtime           string  `json:"runtime"`
	RuntimeVersion    string  `json:"runtime_version"`
	Benchmark         string  `json:"benchmark"`
	Database          string  `json:"database"`
	Concurrency       int     `json:"concurrency"`
	Trial             int     `json:"trial"`
	DurationSeconds   float64 `json:"duration_seconds"`
	Requests          int64   `json:"requests"`
	RequestsPerSecond float64 `json:"requests_per_second"`
	LatencyMs         Latency `json:"latency_ms"`
	Errors            int64   `json:"errors"`
	CPUPercent        float64 `json:"cpu_percent"`
	RSSBytes          int64   `json:"rss_bytes"`
}

Result is one row: one implementation, one workload, one concurrency level, one trial. Issue #141 §9's recommended schema, plus schema_version. One trial per Result — variance across trials is computed by the summarizer from the set of rows sharing a (Framework, Benchmark, Concurrency) key, not stored here.

func ReadJSON

func ReadJSON(r io.Reader) ([]Result, error)

ReadJSON decodes a results.json produced by WriteJSON.

func (Result) ProvenanceUnit added in v0.2.1

func (r Result) ProvenanceUnit() string

ProvenanceUnit is this row's provenance unit; see the package-level ProvenanceUnit.

Jump to

Keyboard shortcuts

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