package tools
import "gvisor.dev/gvisor/test/benchmarks/tools"
Package tools holds tooling to couple command formatting and output parsers together.
Index ¶
- Constants
- func ExtractRubyLoadTime(output string) (time.Duration, error)
- func ExtractRubyTestTime(output string) (time.Duration, error)
- func ParametersToName(params ...Parameter) (string, error)
- func ReportCustomMetric(b *testing.B, value float64, name, unit string)
- type ApacheBench
- func (a *ApacheBench) MakeCmd(host string, port int) []string
- func (a *ApacheBench) Report(b *testing.B, output string)
- type Fio
- func (f *Fio) MakeCmd(filename string) []string
- func (f *Fio) Parameters(b *testing.B, additional ...Parameter) ([]Parameter, string)
- func (f *Fio) Report(b *testing.B, output string)
- type Hackbench
- func (s *Hackbench) MakeCmd(b *testing.B) []string
- func (s *Hackbench) Report(b *testing.B, output string)
- type Hey
- func (h *Hey) MakeCmd(host string, port int) []string
- func (h *Hey) Report(b *testing.B, output string)
- type IOEngine
- type Iperf
- func (i *Iperf) MakeCmd(host string, port int) []string
- func (i *Iperf) Report(b *testing.B, output string)
- type Meminfo
- func (*Meminfo) MakeCmd() (string, []string)
- func (*Meminfo) Report(b *testing.B, before, after string)
- type Metric
- type Parameter
- type Redis
- func (r *Redis) MakeCmd(host string, port, requests int) []string
- func (r *Redis) Report(b *testing.B, output string)
- type Sysbench
- type SysbenchBase
- type SysbenchCPU
- func (s *SysbenchCPU) MakeCmd(b *testing.B) []string
- func (s *SysbenchCPU) Report(b *testing.B, output string)
- type SysbenchMemory
- func (s *SysbenchMemory) MakeCmd(b *testing.B) []string
- func (s *SysbenchMemory) Report(b *testing.B, output string)
- type SysbenchMutex
Constants ¶
Names of FIO I/O engines.
Functions ¶
func ExtractRubyLoadTime ¶
ExtractRubyLoadTime extracts the load time from fastlane ruby test output.
func ExtractRubyTestTime ¶
ExtractRubyTestTime extracts the test time from fastlane ruby test output.
func ParametersToName ¶
ParametersToName joins parameters into a string format for parsing. It is meant to be used for t.Run() calls in benchmark tools.
func ReportCustomMetric ¶
ReportCustomMetric reports a metric in a set format for parsing.
Types ¶
type ApacheBench ¶
ApacheBench is for the client application ApacheBench.
func (*ApacheBench) MakeCmd ¶
func (a *ApacheBench) MakeCmd(host string, port int) []string
MakeCmd makes an ApacheBench command.
func (*ApacheBench) Report ¶
func (a *ApacheBench) Report(b *testing.B, output string)
Report parses and reports metrics from ApacheBench output.
type Fio ¶
type Fio struct { Test string // test to run: read, write, randread, randwrite. IOEngine IOEngine // ioengine to use: sync or libaio. SizeMB int // total size to be read/written in megabytes. BlockSizeKB int // block size to be read/written in kilobytes. IODepth int // I/O depth for reads/writes when using libaio. Jobs int // Number of jobs running in concurrent threads. Direct bool // Whether to use direct I/O (O_DIRECT) or not. }
Fio makes 'fio' commands and parses their output.
func (*Fio) MakeCmd ¶
MakeCmd makes a 'fio' command.
func (*Fio) Parameters ¶
Parameters returns the test parameters and the overall test name derived from them.
func (*Fio) Report ¶
Report reports metrics based on output from an 'fio' command.
type Hackbench ¶
type Hackbench struct { IpcMode string // ipc mode: pipe, socket(default) ProcessMode string // process mode: thread, process(default) }
Hackbench makes 'hackbench' commands and parses their output.
func (*Hackbench) MakeCmd ¶
MakeCmd makes commands for Hackbench.
func (*Hackbench) Report ¶
Report reports the relevant metrics for Hackbench.
type Hey ¶
type Hey struct { Requests int // Note: requests cannot be less than concurrency. Concurrency int Doc string }
Hey is for the client application 'hey'.
func (*Hey) MakeCmd ¶
MakeCmd returns a 'hey' command.
func (*Hey) Report ¶
Report parses output from 'hey' and reports metrics.
type IOEngine ¶
type IOEngine string
IOEngine is a I/O engine name passed to `fio`.
type Iperf ¶
type Iperf struct { Num int // Number of bytes to send in KB. Parallel int // Number of parallel threads. }
Iperf is for the client side of `iperf`.
func (*Iperf) MakeCmd ¶
MakeCmd returns a iperf client command.
func (*Iperf) Report ¶
Report parses output from iperf client and reports metrics.
type Meminfo ¶
type Meminfo struct { }
Meminfo wraps measurements of MemAvailable using /proc/meminfo.
func (*Meminfo) MakeCmd ¶
MakeCmd returns a command for checking meminfo.
func (*Meminfo) Report ¶
Report takes two reads of meminfo, parses them, and reports the difference divided by b.N.
type Metric ¶
Metric holds metric data parsed from a string based on the format ReportMetric.
func ParseCustomMetric ¶
ParseCustomMetric parses a metric reported with ReportCustomMetric.
type Parameter ¶
Parameter is a test parameter.
func NameToParameters ¶
NameToParameters parses the string created by ParametersToName and returns the name components and parameters contained within. The separator between the name and value may either be '.' or '='.
Example: "BenchmarkRuby/SubTest/LevelTwo/server_threads.1/doc_size.16KB-6" The parameter part of this benchmark is "server_threads.1/doc_size.16KB", whereas "BenchmarkRuby/SubTest/LevelTwo" is the name, and the "-6" suffix is GOMAXPROCS (optional, may be omitted). This function will return a slice of the name components of the benchmark:
[ "BenchmarkRuby", "SubTest", "LevelTwo", ]
and a slice of the parameters:
[ {Name: "server_threads", Value: "1"}, {Name: "doc_size", Value: "16KB"}, {Name: "GOMAXPROCS", Value: "6"}, ]
(and a nil error).
type Redis ¶
type Redis struct { Operation string }
Redis is for the client 'redis-benchmark'.
func (*Redis) MakeCmd ¶
MakeCmd returns a redis-benchmark client command.
func (*Redis) Report ¶
Report parses output from redis-benchmark client and reports metrics.
type Sysbench ¶
type Sysbench interface { // MakeCmd constructs the relevant command line. MakeCmd(*testing.B) []string // Report reports relevant custom metrics. Report(*testing.B, string) }
Sysbench represents a 'sysbench' command.
type SysbenchBase ¶
type SysbenchBase struct { // Threads is the number of threads for the test. Threads int }
SysbenchBase is the top level struct for sysbench and holds top-level arguments for sysbench. See: 'sysbench --help'
type SysbenchCPU ¶
type SysbenchCPU struct { SysbenchBase }
SysbenchCPU is for 'sysbench [flags] cpu run' and holds CPU specific arguments.
func (*SysbenchCPU) MakeCmd ¶
func (s *SysbenchCPU) MakeCmd(b *testing.B) []string
MakeCmd makes commands for SysbenchCPU.
func (*SysbenchCPU) Report ¶
func (s *SysbenchCPU) Report(b *testing.B, output string)
Report reports the relevant metrics for SysbenchCPU.
type SysbenchMemory ¶
type SysbenchMemory struct { SysbenchBase BlockSize int // size of test memory block in megabytes [1]. Scope string // memory access scope {global, local} [global]. HugeTLB bool // allocate memory from HugeTLB [off]. OperationType string // type of memory ops {read, write, none} [write]. AccessMode string // access mode {seq, rnd} [seq]. }
SysbenchMemory is for 'sysbench [FLAGS] memory run' and holds Memory specific arguments.
func (*SysbenchMemory) MakeCmd ¶
func (s *SysbenchMemory) MakeCmd(b *testing.B) []string
MakeCmd makes commands for SysbenchMemory.
func (*SysbenchMemory) Report ¶
func (s *SysbenchMemory) Report(b *testing.B, output string)
Report reports the relevant metrics for SysbenchMemory.
type SysbenchMutex ¶
type SysbenchMutex struct { SysbenchBase Num int // total size of mutex array [4096]. Loops int // number of loops to do outside mutex lock [10000]. }
SysbenchMutex is for 'sysbench [FLAGS] mutex run' and holds Mutex specific arguments.
func (*SysbenchMutex) MakeCmd ¶
func (s *SysbenchMutex) MakeCmd(b *testing.B) []string
MakeCmd makes commands for SysbenchMutex.
func (*SysbenchMutex) Report ¶
func (s *SysbenchMutex) Report(b *testing.B, output string)
Report parses and reports relevant sysbench mutex metrics.
Source Files ¶
ab.go fio.go hackbench.go hey.go iperf.go meminfo.go parser_util.go redis.go rubydev.go sysbench.go tools.go
- Version
- v0.0.0-20250605235530-a6711d1e1dc6 (latest)
- Published
- Jun 5, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 4 hours ago –
Tools for package owners.