Documentation
¶
Overview ¶
Package benchreport turns benchmark runs into a results file that records the host, build and method next to the numbers.
Index ¶
- Constants
- func Caveats(h Host, b Build, repeat int, noisyLoadRatio float64) []string
- func Group(scenario string) string
- func Load1(ctx context.Context, p Probe) float64
- func Markdown(r Report) string
- func Methodology() []string
- func ParseCPUInfoModel(s string) string
- func ParseMemTotal(s string) uint64
- func ParseOSRelease(s string) string
- func WriteJSON(path string, r Report) error
- func WriteMarkdown(path string, r Report) error
- type Build
- type Comparison
- type Delta
- type Docker
- type Host
- type Limit
- type Options
- type Probe
- type Report
- type Side
- type StatusChange
Constants ¶
const ( GroupFailover = "failover" GroupDeploy = "deploy" GroupRollout = "rollout" GroupThroughput = "throughput" )
Scenario groups the dashboard and the compare view use.
const ( DirectionBetter = "better" DirectionWorse = "worse" DirectionSame = "same" )
Directions of a delta, judged by what a larger number means for the metric.
const SchemaVersion = 1
SchemaVersion changes when a field of the results file changes meaning.
Variables ¶
This section is empty.
Functions ¶
func Markdown ¶
Markdown renders the report as a document that carries its own host, build and limits.
func Methodology ¶
func Methodology() []string
Methodology lists how the numbers are taken, in the words published with them.
func ParseCPUInfoModel ¶
ParseCPUInfoModel returns the first "model name" line of /proc/cpuinfo.
func ParseMemTotal ¶
ParseMemTotal returns MemTotal from /proc/meminfo in bytes.
func ParseOSRelease ¶
ParseOSRelease returns PRETTY_NAME from /etc/os-release.
func WriteMarkdown ¶
WriteMarkdown writes Markdown(r) to path.
Types ¶
type Build ¶
type Build struct {
Version string `json:"version"`
Commit string `json:"commit"`
Dirty bool `json:"dirty"`
}
Build identifies the binary that produced the numbers.
type Comparison ¶
type Comparison struct {
Base Side `json:"base"`
Head Side `json:"head"`
Deltas []Delta `json:"deltas"`
Status []StatusChange `json:"status_changes"`
Warnings []string `json:"warnings"`
NoisePct float64 `json:"noise_pct"`
Statistic string `json:"statistic"`
}
Comparison is the head report measured against the base report.
type Delta ¶
type Delta struct {
Scenario string `json:"scenario"`
Group string `json:"group"`
Metric string `json:"metric"`
Base *float64 `json:"base"`
Head *float64 `json:"head"`
Delta *float64 `json:"delta"`
DeltaPct *float64 `json:"delta_pct"`
Direction string `json:"direction,omitempty"`
}
Delta is one metric on both sides. Each side is the median over that side's runs of the scenario.
type Docker ¶
type Docker struct {
Version string `json:"version,omitempty"`
OS string `json:"os,omitempty"`
MemBytes int64 `json:"mem_bytes,omitempty"`
}
Docker is what the Docker daemon reports about itself.
type Host ¶
type Host struct {
OS string `json:"os"`
Arch string `json:"arch"`
OSVersion string `json:"os_version,omitempty"`
Kernel string `json:"kernel,omitempty"`
CPUModel string `json:"cpu_model,omitempty"`
CPUs int `json:"cpus"`
MemBytes uint64 `json:"mem_bytes,omitempty"`
Docker Docker `json:"docker"`
LoadStart float64 `json:"load1_start"`
LoadEnd float64 `json:"load1_end"`
Note string `json:"note,omitempty"`
}
Host describes the machine a run came from.
func DetectHost ¶
DetectHost fills a Host from p; fields a platform cannot report stay empty rather than guessed.
type Probe ¶
type Probe struct {
GOOS string
GOARCH string
NumCPU int
ReadFile func(path string) ([]byte, error)
Run func(ctx context.Context, name string, args ...string) (string, error)
}
Probe is the set of system reads DetectHost uses, replaceable in tests.
type Report ¶
type Report struct {
SchemaVersion int `json:"schema_version"`
GeneratedAt time.Time `json:"generated_at"`
Build Build `json:"build"`
Host Host `json:"host"`
Repeat int `json:"repeat"`
Methodology []string `json:"methodology"`
Caveats []string `json:"caveats"`
Results []chaos.Result `json:"results"`
Limits []Limit `json:"limits"`
}
Report is the results file: numbers plus everything needed to judge and repeat them.
func New ¶
New assembles a report, deriving the caveats and the limits table from what was actually run.
func Parse ¶
Parse decodes and validates an uploaded results file. Unknown fields are rejected so a mistyped file is not stored half understood.
type Side ¶
type Side struct {
ID string `json:"id"`
GeneratedAt string `json:"generated_at"`
Version string `json:"version"`
Commit string `json:"commit"`
Dirty bool `json:"dirty"`
Host string `json:"host"`
Runs int `json:"runs"`
}
Side identifies one report in a comparison.
type StatusChange ¶
type StatusChange struct {
Scenario string `json:"scenario"`
Base string `json:"base"`
Head string `json:"head"`
}
StatusChange lists a scenario whose outcome differs between the sides.