xtask/summarize_bench/
data.rs

1// copied from https://github.com/BurntSushi/critcmp/blob/master/src/data.rs
2
3use std::collections::BTreeMap;
4
5use serde::{Deserialize, Serialize};
6
7#[derive(Clone, Debug, Deserialize, Serialize)]
8pub struct BaseBenchmarks {
9    pub name: String,
10    pub benchmarks: BTreeMap<String, Benchmark>,
11}
12
13#[derive(Clone, Debug, Deserialize, Serialize)]
14pub struct Benchmark {
15    pub baseline: String,
16    pub fullname: String,
17    #[serde(rename = "criterion_benchmark_v1")]
18    pub info: CBenchmark,
19    #[serde(rename = "criterion_estimates_v1")]
20    pub estimates: CEstimates,
21}
22
23#[derive(Clone, Debug, Deserialize, Serialize)]
24pub struct CBenchmark {
25    pub group_id: String,
26    pub function_id: Option<String>,
27    pub value_str: Option<String>,
28    pub throughput: Option<CThroughput>,
29    pub full_id: String,
30    pub directory_name: String,
31}
32
33#[derive(Clone, Debug, Deserialize, Serialize)]
34#[serde(rename_all = "PascalCase")]
35pub struct CThroughput {
36    pub bytes: Option<u64>,
37    pub elements: Option<u64>,
38}
39
40#[derive(Clone, Debug, Deserialize, Serialize)]
41pub struct CEstimates {
42    pub mean: CStats,
43    pub median: CStats,
44    pub median_abs_dev: CStats,
45    pub slope: Option<CStats>,
46    pub std_dev: CStats,
47}
48
49#[derive(Clone, Debug, Deserialize, Serialize)]
50pub struct CStats {
51    pub confidence_interval: CConfidenceInterval,
52    pub point_estimate: f64,
53    pub standard_error: f64,
54}
55
56#[derive(Clone, Debug, Deserialize, Serialize)]
57pub struct CConfidenceInterval {
58    pub confidence_level: f64,
59    pub lower_bound: f64,
60    pub upper_bound: f64,
61}