stats

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package stats holds the load generator's latency recorder and its CSV output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendRow

func AppendRow(path string, r Row) error

AppendRow adds r to the CSV at path, writing the header first if the file is new or empty, so every run of the suite appends to one file.

func Header() []string

Types

type Recorder

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

Recorder collects durations from many goroutines.

func NewRecorder

func NewRecorder() *Recorder

func (*Recorder) Record

func (r *Recorder) Record(d time.Duration)

Record adds one duration. Values outside the range are clamped rather than dropped, so a clock oddity or a stuck job still counts as a sample.

func (*Recorder) Summary

func (r *Recorder) Summary() Summary

type Row

type Row struct {
	Scenario   string // s1 … s6
	Label      string // unique per run, for example s2-open80-w50
	Mode       string // closed, open, fill, redrive
	Batch      int
	Workers    int // worker slots
	Payload    int // payload size in bytes
	TargetRate float64
	Window     time.Duration

	Enqueued   int64 // jobs enqueued inside the window
	Acked      int64 // jobs acked inside the window
	Throughput float64

	E2S     Summary // enqueue-to-start latency
	Enqueue Summary // enqueue RPC latency (from the scheduled time)

	ServerCPUPerJob  float64 // ms of CPU per job
	PGCPUPerJob      float64
	LoadgenCPUPerJob float64
	ServerCPUPct     float64 // % of one CPU over the window (for idle runs)
	PGCPUPct         float64
	WALBytesPerJob   float64
	LeaseRPCsPerJob  float64
	PGQueriesPerSec  float64

	Errors  int64
	Dropped int64
	Valid   bool
	Reason  string
}

Row is one run's result. Durations are written in milliseconds and CPU in milliseconds per job, so the CSV is easy to plot and to read by eye.

func (Row) Values

func (r Row) Values() []string

type Summary

type Summary struct {
	Count               int64
	P50, P99, P999, Max time.Duration
}

Summary is a recorder's percentiles.

Jump to

Keyboard shortcuts

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