benchmark

package
v0.0.0-...-794f3e4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncToBenchmark

type FuncToBenchmark func() error

FuncToBenchmark for Benchmark function

type Metric

type Metric struct {
	Started time.Time
	Latency time.Duration
	Error   error
	Usage   SystemUsage
}

Metric tracks start/end time with latency, error and usage.

func (*Metric) String

func (m *Metric) String() string

String helper.

type Request

type Request struct {
	TPS         int
	Duration    time.Duration
	Percentiles []float64
}

Request for Benchmark function

type Response

type Response struct {
	StartedAt            time.Time
	BeforeBenchmarkUsage SystemUsage
	AfterBenchmarkUsage  SystemUsage
	ErrorMetrics         map[float64]*Metric
	OKMetrics            map[float64]*Metric
	ErrorsByType         map[string]int
	TPS                  int
	ActualTPS            int
}

Response for Benchmark function

func Benchmark

func Benchmark(fn FuncToBenchmark, req Request) (res Response)

Benchmark function

func (*Response) String

func (r *Response) String() string

type SystemUsage

type SystemUsage struct {
	CPUUtilization float64
	MemoryTotalMB  uint64
	MemoryUsedMB   uint64
	MemoryPercent  float64
	DiskTotalGB    uint64
	DiskUsedGB     uint64
	DiskPercent    float64
}

SystemUsage tracks cpu/memory/disk usage.

func (*SystemUsage) Populate

func (u *SystemUsage) Populate()

Populate initializes cpu/memory/disk usage.

func (*SystemUsage) String

func (u *SystemUsage) String() string

String helper.

Jump to

Keyboard shortcuts

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