Rename peak memory metric to memory_peak_resident

This commit is contained in:
David Peter committed 2026-10-05 20:23:55 +02:00
1 parent 0d86e78ede
commit 95118147af
10 files changed
+57 -54

No files matched your search

+6 -6
View File
@@ -87,21 +87,21 @@ fn test_csv() {
time_wall_clock: Time::new::<second>(7.0),
time_user: Time::new::<second>(7.0),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(8.0),
time_user: Time::new::<second>(8.0),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(12.0),
time_user: Time::new::<second>(12.0),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
]),
@@ -132,21 +132,21 @@ fn test_csv() {
time_wall_clock: Time::new::<second>(17.0),
time_user: Time::new::<second>(17.0),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(18.0),
time_user: Time::new::<second>(18.0),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(19.0),
time_user: Time::new::<second>(19.0),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
]),
+11 -8
View File
@@ -37,13 +37,16 @@ struct BenchmarkSummary {
time_user: StatisticalSummary,
time_system: StatisticalSummary,
#[serde(skip_serializing_if = "Option::is_none")]
peak_memory_usage: Option<StatisticalSummary>,
memory_peak_resident: Option<StatisticalSummary>,
}
impl BenchmarkSummary {
fn from_measurements(measurements: &Measurements) -> Self {
let values = &measurements.measurements;
let mut memory_values = values.iter().filter_map(|m| m.peak_memory_usage).peekable();
let mut memory_values = values
.iter()
.filter_map(|m| m.memory_peak_resident)
.peekable();
Self {
time_wall_clock: StatisticalSummary::from_values(
values.iter().map(|m| m.time_wall_clock),
@@ -54,7 +57,7 @@ impl BenchmarkSummary {
values.iter().map(|m| m.time_system),
second,
),
peak_memory_usage: memory_values
memory_peak_resident: memory_values
.peek()
.is_some()
.then(|| StatisticalSummary::from_values(memory_values, byte)),
@@ -188,7 +191,7 @@ fn test_json_optional_memory() {
command: "example".into(),
name: None,
measurements: Measurements::new(vec![Measurement {
peak_memory_usage: memory,
memory_peak_resident: memory,
..Measurement::default()
}]),
..BenchmarkResult::default()
@@ -233,11 +236,11 @@ fn test_json_optional_memory() {
}
if let Some(memory) = expected_memory {
let value = memory["value"].clone();
expected["results"][0]["summary"]["peak_memory_usage"] = json!({
expected["results"][0]["summary"]["memory_peak_resident"] = json!({
"unit": "byte", "count": 1, "mean": value,
"stddev": null, "median": value, "min": value, "max": value
});
expected["results"][0]["measurements"][0]["peak_memory_usage"] = memory;
expected["results"][0]["measurements"][0]["memory_peak_resident"] = memory;
}
assert_eq!(actual, expected);
}
@@ -313,7 +316,7 @@ fn test_json_summary_metrics_and_missing_samples() {
time_wall_clock: Time::new::<second>(time),
time_user: Time::new::<second>(time * 2.0),
time_system: Time::new::<second>(time * 3.0),
peak_memory_usage: memory.map(Information::new::<byte>),
memory_peak_resident: memory.map(Information::new::<byte>),
..Measurement::default()
})
.collect(),
@@ -334,7 +337,7 @@ fn test_json_summary_metrics_and_missing_samples() {
"unit": "second", "count": 3, "mean": 6.0, "stddev": 3.0,
"median": 6.0, "min": 3.0, "max": 9.0
},
"peak_memory_usage": {
"memory_peak_resident": {
"unit": "byte", "count": 2, "mean": 2048.0,
"stddev": 1024.0 * 2.0_f64.sqrt(),
"median": 2048.0, "min": 1024.0, "max": 3072.0
+24 -24
View File
@@ -34,21 +34,21 @@ fn test_markup_export_auto_ms() {
time_wall_clock: Time::new::<second>(0.09),
time_user: Time::new::<second>(0.09),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.10),
time_user: Time::new::<second>(0.10),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.14),
time_user: Time::new::<second>(0.14),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
]),
@@ -62,21 +62,21 @@ fn test_markup_export_auto_ms() {
time_wall_clock: Time::new::<second>(2.0),
time_user: Time::new::<second>(2.0),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(3.0),
time_user: Time::new::<second>(3.0),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(4.0),
time_user: Time::new::<second>(4.0),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
]),
@@ -135,21 +135,21 @@ fn test_markup_export_auto_s() {
time_wall_clock: Time::new::<second>(2.1),
time_user: Time::new::<second>(2.1),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.2),
time_user: Time::new::<second>(2.2),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.3),
time_user: Time::new::<second>(2.3),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
]),
@@ -163,21 +163,21 @@ fn test_markup_export_auto_s() {
time_wall_clock: Time::new::<second>(0.1),
time_user: Time::new::<second>(0.1),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.2),
time_user: Time::new::<second>(0.2),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.3),
time_user: Time::new::<second>(0.3),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
]),
@@ -236,21 +236,21 @@ fn test_markup_export_manual_ms() {
time_wall_clock: Time::new::<second>(2.1),
time_user: Time::new::<second>(2.1),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.2),
time_user: Time::new::<second>(2.2),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.3),
time_user: Time::new::<second>(2.3),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
]),
@@ -264,21 +264,21 @@ fn test_markup_export_manual_ms() {
time_wall_clock: Time::new::<second>(0.1),
time_user: Time::new::<second>(0.1),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.2),
time_user: Time::new::<second>(0.2),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.3),
time_user: Time::new::<second>(0.3),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
]),
@@ -336,21 +336,21 @@ fn test_markup_export_manual_s() {
time_wall_clock: Time::new::<second>(2.01),
time_user: Time::new::<second>(2.01),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.02),
time_user: Time::new::<second>(2.02),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(2.03),
time_user: Time::new::<second>(2.03),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
]),
@@ -364,21 +364,21 @@ fn test_markup_export_manual_s() {
time_wall_clock: Time::new::<second>(0.11),
time_user: Time::new::<second>(0.11),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.12),
time_user: Time::new::<second>(0.12),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
Measurement {
time_wall_clock: Time::new::<second>(0.13),
time_user: Time::new::<second>(0.13),
time_system: Time::zero(),
peak_memory_usage: Some(Information::new::<byte>(1024.)),
memory_peak_resident: Some(Information::new::<byte>(1024.)),
exit_status: ExitStatus::default(),
},
]),