Skip to content
Myr

benchmark_result.rs

This file

Path

src/benchmark/benchmark_result.rs

51 lines · 1.8 KiB · Rust

Last changed by

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

History of this file

Take it

The walk stopped after 200 commits: lines older than 0f91d0c point at it.

Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c

lines 1–2why, one step back
1use std::collections::BTreeMap;
2

Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015

line 3why, one step back
3use serde::Serialize;

Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c

line 4why, one step back
4

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 5–6why, one step back
5use crate::benchmark::measurement::Measurements;
6

Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015

line 7why, one step back
7/// Parameter value

Merge pull request #968 from sharkdp/codex/parameter-metadataDavid Peterbefore adoption05de077

lines 8–12why, one step back
8#[derive(Debug, Default, Clone, Serialize, PartialEq)]
9pub struct Parameter {10 pub value: String,11}12

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

line 13why, one step back
13/// Meta data and performance metrics for a single benchmark

Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015

line 14why, one step back
14#[derive(Debug, Default, Clone, Serialize, PartialEq)]

Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c

line 15why, one step back
15pub struct BenchmarkResult {

Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015

lines 16–18why, one step back
16 /// The command line being benchmarked, after parameter substitution.
17 /// For example, `sleep {duration}` with `duration=1` becomes `sleep 1`,18 /// regardless of any custom name.

Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c

lines 19–20why, one step back
19 pub command: String,
20

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

lines 21–22why, one step back
21 /// The custom or automatically generated name after parameter substitution,
22 /// if it differs from `command`. Automatic names include environment overrides.

Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015

lines 23–24why, one step back
23 #[serde(skip_serializing_if = "Option::is_none")]
24 pub name: Option<String>,

Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c

line 25why, one step back
25

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

lines 26–27why, one step back
26 /// The name, followed by parameters not used in the command or environment
27 /// templates, in command-line order. For example, `sleep {duration}`

Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015

lines 28–35why, one step back
28 /// with `duration=1`, `branch=main`, and the custom name `wait {duration}s`
29 /// produces `wait 1s (branch = main)`. Without the custom name, this is30 /// `sleep 1 (branch = main)`. Used in summaries and table exports.31 #[serde(skip_serializing)]32 pub display_name: String,3334 /// Performance metric measurements and exit codes for each run35 #[serde(flatten)]

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

line 36why, one step back
36 pub measurements: Measurements,

Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c

lines 37–38why, one step back
37
38 /// Parameter values for this benchmark

Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015

line 39why, one step back
39 #[serde(skip_serializing_if = "BTreeMap::is_empty")]

Merge pull request #968 from sharkdp/codex/parameter-metadataDavid Peterbefore adoption05de077

line 40why, one step back
40 pub parameters: BTreeMap<String, Parameter>,

Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02

lines 41–44why, one step back
41
42 /// Explicit environment overrides after parameter substitution.43 #[serde(skip_serializing_if = "BTreeMap::is_empty")]44 pub environment: BTreeMap<String, String>,

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

lines 45–47why, one step back
45}
4647impl BenchmarkResult {

Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015

lines 48–49why, one step back
48 pub fn get_name(&self) -> &str {
49 self.name.as_deref().unwrap_or(&self.command)

Merge pull request #969 from sharkdp/codex/result-measurementsDavid Peterbefore adoptione689520

line 50why, one step back
50 }

Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c

line 51why, one step back
51}