mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Rename peak memory metric to memory_peak_resident
This commit is contained in:
1 parent
0d86e78ede
commit
95118147af
10 files changed
+57
-54
No files matched your search
@@ -277,7 +277,7 @@ impl Executor for ShellExecutor<'_> {
|
||||
time_wall_clock: measurements.time_wall_clock_mean(),
|
||||
time_user: measurements.time_user_mean(),
|
||||
time_system: measurements.time_system_mean(),
|
||||
peak_memory_usage: None,
|
||||
memory_peak_resident: None,
|
||||
exit_status: ExitStatus::default(),
|
||||
});
|
||||
|
||||
@@ -335,7 +335,7 @@ impl Executor for MockExecutor {
|
||||
time_wall_clock: Self::extract_time(command.get_command_line()),
|
||||
time_user: Time::zero(),
|
||||
time_system: Time::zero(),
|
||||
peak_memory_usage: Some(Information::zero()),
|
||||
memory_peak_resident: Some(Information::zero()),
|
||||
exit_status,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ pub struct Measurement {
|
||||
skip_serializing_if = "Option::is_none",
|
||||
serialize_with = "serialize_optional_information"
|
||||
)]
|
||||
pub peak_memory_usage: Option<Information>,
|
||||
pub memory_peak_resident: Option<Information>,
|
||||
|
||||
// The exit status of the process
|
||||
#[serde(rename = "exit_code", serialize_with = "serialize_exit_status")]
|
||||
|
||||
@@ -215,7 +215,7 @@ fn scheduler_basic() -> Result<()> {
|
||||
time_system:
|
||||
value: 0
|
||||
unit: second
|
||||
peak_memory_usage:
|
||||
memory_peak_resident:
|
||||
value: 0
|
||||
unit: byte
|
||||
exit_code: 0
|
||||
@@ -228,7 +228,7 @@ fn scheduler_basic() -> Result<()> {
|
||||
time_system:
|
||||
value: 0
|
||||
unit: second
|
||||
peak_memory_usage:
|
||||
memory_peak_resident:
|
||||
value: 0
|
||||
unit: byte
|
||||
exit_code: 0
|
||||
@@ -243,7 +243,7 @@ fn scheduler_basic() -> Result<()> {
|
||||
time_system:
|
||||
value: 0
|
||||
unit: second
|
||||
peak_memory_usage:
|
||||
memory_peak_resident:
|
||||
value: 0
|
||||
unit: byte
|
||||
exit_code: 0
|
||||
@@ -256,7 +256,7 @@ fn scheduler_basic() -> Result<()> {
|
||||
time_system:
|
||||
value: 0
|
||||
unit: second
|
||||
peak_memory_usage:
|
||||
memory_peak_resident:
|
||||
value: 0
|
||||
unit: byte
|
||||
exit_code: 0
|
||||
|
||||
+6
-6
@@ -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
@@ -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
@@ -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(),
|
||||
},
|
||||
]),
|
||||
|
||||
+4
-4
@@ -222,11 +222,11 @@ fn test_format() {
|
||||
assert_eq!(time.format_auto(), "123.4 ms");
|
||||
assert_eq!(time.format(TimeUnit::MicroSecond), "123400.0 µs");
|
||||
|
||||
let peak_memory_usage = Information::new::<kibibyte>(8.);
|
||||
assert_eq!(peak_memory_usage.format_auto(), "8.0 KiB");
|
||||
assert_eq!(peak_memory_usage.format(InformationUnit::Byte), "8192 B");
|
||||
let memory_peak_resident = Information::new::<kibibyte>(8.);
|
||||
assert_eq!(memory_peak_resident.format_auto(), "8.0 KiB");
|
||||
assert_eq!(memory_peak_resident.format(InformationUnit::Byte), "8192 B");
|
||||
assert_eq!(
|
||||
peak_memory_usage.format(InformationUnit::KibiByte),
|
||||
memory_peak_resident.format(InformationUnit::KibiByte),
|
||||
"8.0 KiB"
|
||||
);
|
||||
}
|
||||
|
||||
+2
-2
@@ -82,14 +82,14 @@ pub fn execute_and_measure(mut command: Command) -> Result<Measurement> {
|
||||
discard(output);
|
||||
}
|
||||
|
||||
let (time_user, time_system, peak_memory_usage, exit_status) = cpu_timer.stop(child)?;
|
||||
let (time_user, time_system, memory_peak_resident, exit_status) = cpu_timer.stop(child)?;
|
||||
let time_wall_clock = wallclock_timer.stop();
|
||||
|
||||
Ok(Measurement {
|
||||
time_wall_clock,
|
||||
time_user,
|
||||
time_system,
|
||||
peak_memory_usage,
|
||||
memory_peak_resident,
|
||||
exit_status,
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user