v3.5.13 Latest Latest

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 7



Package report generates human-readable benchmark reports.



This section is empty.


This section is empty.


func Percentiles

func Percentiles(nums []float64) (pcs []float64, data []float64)

Percentiles returns percentile distribution of float64 slice.


type DataPoint

type DataPoint struct {
	Timestamp  int64
	MinLatency time.Duration
	AvgLatency time.Duration
	MaxLatency time.Duration
	ThroughPut int64

type Report

type Report interface {
	Results() chan<- Result

	// Run returns results in print-friendly format.
	Run() <-chan string

	// Stats returns results in raw data.
	Stats() <-chan Stats

Report processes a result stream until it is closed, then produces a string with information about the consumed result data.

func NewReport

func NewReport(precision string) Report

func NewReportRate

func NewReportRate(precision string) Report

func NewReportSample

func NewReportSample(precision string) Report

func NewWeightedReport

func NewWeightedReport(r Report, precision string) Report

NewWeightedReport returns a report that includes both weighted and unweighted statistics.

type Result

type Result struct {
	Start  time.Time
	End    time.Time
	Err    error
	Weight float64

Result describes the timings for an operation.

func (*Result) Duration

func (res *Result) Duration() time.Duration

type Stats

type Stats struct {
	AvgTotal   float64
	Fastest    float64
	Slowest    float64
	Average    float64
	Stddev     float64
	RPS        float64
	Total      time.Duration
	ErrorDist  map[string]int
	Lats       []float64
	TimeSeries TimeSeries

Stats exposes results raw data.

type TimeSeries

type TimeSeries []DataPoint

func (TimeSeries) Len

func (t TimeSeries) Len() int

func (TimeSeries) Less

func (t TimeSeries) Less(i, j int) bool

func (TimeSeries) String

func (t TimeSeries) String() string

func (TimeSeries) Swap

func (t TimeSeries) Swap(i, j int)

Jump to

Keyboard shortcuts

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