Skip to content

Commit d80ae63

Browse files
committed
more compile duration stats
1 parent cdef20c commit d80ae63

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

src/bin/collect.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ impl Commands {
4646
vec![Box::new(binary_size::BinarySize::on(example))]
4747
}
4848
Commands::CompileTime { example } => {
49-
vec![Box::new(compile_time::CompileTime::on(example))]
49+
vec![
50+
Box::new(compile_time::CompileTime::on(example.clone(), 8)),
51+
Box::new(compile_time::CompileTime::on(example, 16)),
52+
]
5053
}
5154
Commands::All => {
5255
if recur {

src/compile_time.rs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@ use crate::Metrics;
1010

1111
pub struct CompileTime {
1212
pub example_name: String,
13+
pub nb_jobs: u32,
1314
}
1415

1516
impl CompileTime {
16-
pub fn on(example_name: String) -> Self {
17+
pub fn on(example_name: String, nb_jobs: u32) -> Self {
1718
Self {
1819
example_name: if example_name == "" {
1920
"breakout".to_string()
2021
} else {
2122
example_name
2223
},
24+
nb_jobs: if nb_jobs == 0 { 8 } else { nb_jobs },
2325
}
2426
}
2527
}
@@ -44,29 +46,43 @@ impl Metrics for CompileTime {
4446
}
4547

4648
fn collect(&self) -> HashMap<String, u64> {
49+
let key = format!(
50+
"compile-time-{}-{}-{}",
51+
std::env::consts::FAMILY,
52+
std::env::consts::ARCH,
53+
self.nb_jobs
54+
);
4755
let results: Hyperfine =
4856
serde_json::from_reader(std::fs::File::open("build.json").unwrap()).unwrap();
4957
HashMap::from([
5058
(
51-
"compile-time.mean".to_string(),
59+
format!("{key}.mean"),
5260
(results.results[0].mean * 1000.0) as u64,
5361
),
5462
(
55-
"compile-time.stddev".to_string(),
63+
format!("{key}.stddev"),
5664
(results.results[0].stddev.unwrap_or_default() * 1000.0) as u64,
5765
),
5866
(
59-
"compile-time.median".to_string(),
67+
format!("{key}.median"),
6068
(results.results[0].median * 1000.0) as u64,
6169
),
6270
(
63-
"compile-time.user".to_string(),
71+
format!("{key}.user"),
6472
(results.results[0].user * 1000.0) as u64,
6573
),
6674
(
67-
"compile-time.system".to_string(),
75+
format!("{key}.system"),
6876
(results.results[0].system * 1000.0) as u64,
6977
),
78+
(
79+
format!("{key}.min"),
80+
(results.results[0].min * 1000.0) as u64,
81+
),
82+
(
83+
format!("{key}.max"),
84+
(results.results[0].max * 1000.0) as u64,
85+
),
7086
])
7187
}
7288
}
@@ -78,6 +94,8 @@ struct Hyperfine {
7894
#[derive(Deserialize)]
7995
struct HyperfineResults {
8096
mean: f32,
97+
max: f32,
98+
min: f32,
8199
stddev: Option<f32>,
82100
median: f32,
83101
user: f32,

0 commit comments

Comments
 (0)