mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Initial work on tracking memory usage
This commit is contained in:
1 parent
f78f482d8f
commit
e8ca561a24
13 files changed
+68
-7
No files matched your search
@@ -42,6 +42,10 @@ pub struct BenchmarkResult {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub times: Option<Vec<Second>>,
|
||||
|
||||
/// Maximum memory usage of the process, in bytes
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub memory_usage_byte: Option<Vec<u64>>,
|
||||
|
||||
/// Exit codes of all command invocations
|
||||
pub exit_codes: Vec<Option<i32>>,
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ impl Executor for RawExecutor<'_> {
|
||||
time_real: result.time_real,
|
||||
time_user: result.time_user,
|
||||
time_system: result.time_system,
|
||||
memory_usage_byte: result.memory_usage_byte,
|
||||
},
|
||||
result.status,
|
||||
))
|
||||
@@ -204,6 +205,7 @@ impl Executor for ShellExecutor<'_> {
|
||||
time_real: result.time_real,
|
||||
time_user: result.time_user,
|
||||
time_system: result.time_system,
|
||||
memory_usage_byte: result.memory_usage_byte,
|
||||
},
|
||||
result.status,
|
||||
))
|
||||
@@ -268,6 +270,7 @@ impl Executor for ShellExecutor<'_> {
|
||||
time_real: mean(×_real),
|
||||
time_user: mean(×_user),
|
||||
time_system: mean(×_system),
|
||||
memory_usage_byte: 0,
|
||||
});
|
||||
|
||||
Ok(())
|
||||
@@ -323,6 +326,7 @@ impl Executor for MockExecutor {
|
||||
time_real: Self::extract_time(command.get_command_line()),
|
||||
time_user: 0.0,
|
||||
time_system: 0.0,
|
||||
memory_usage_byte: 0,
|
||||
},
|
||||
status,
|
||||
))
|
||||
|
||||
@@ -151,6 +151,7 @@ impl<'a> Benchmark<'a> {
|
||||
let mut times_real: Vec<Second> = vec![];
|
||||
let mut times_user: Vec<Second> = vec![];
|
||||
let mut times_system: Vec<Second> = vec![];
|
||||
let mut memory_usage_byte: Vec<u64> = vec![];
|
||||
let mut exit_codes: Vec<Option<i32>> = vec![];
|
||||
let mut all_succeeded = true;
|
||||
|
||||
@@ -279,6 +280,7 @@ impl<'a> Benchmark<'a> {
|
||||
times_real.push(res.time_real);
|
||||
times_user.push(res.time_user);
|
||||
times_system.push(res.time_system);
|
||||
memory_usage_byte.push(res.memory_usage_byte);
|
||||
exit_codes.push(extract_exit_code(status));
|
||||
|
||||
all_succeeded = all_succeeded && success;
|
||||
@@ -315,6 +317,7 @@ impl<'a> Benchmark<'a> {
|
||||
times_real.push(res.time_real);
|
||||
times_user.push(res.time_user);
|
||||
times_system.push(res.time_system);
|
||||
memory_usage_byte.push(res.memory_usage_byte);
|
||||
exit_codes.push(extract_exit_code(status));
|
||||
|
||||
all_succeeded = all_succeeded && success;
|
||||
@@ -451,6 +454,7 @@ impl<'a> Benchmark<'a> {
|
||||
min: t_min,
|
||||
max: t_max,
|
||||
times: Some(times_real),
|
||||
memory_usage_byte: Some(memory_usage_byte),
|
||||
exit_codes,
|
||||
parameters: self
|
||||
.command
|
||||
|
||||
@@ -133,6 +133,7 @@ fn create_result(name: &str, mean: Scalar) -> BenchmarkResult {
|
||||
min: mean,
|
||||
max: mean,
|
||||
times: None,
|
||||
memory_usage_byte: None,
|
||||
exit_codes: Vec::new(),
|
||||
parameters: BTreeMap::new(),
|
||||
}
|
||||
|
||||
@@ -11,4 +11,7 @@ pub struct TimingResult {
|
||||
|
||||
/// Time spent in kernel mode
|
||||
pub time_system: Second,
|
||||
|
||||
/// Maximum amount of memory used, in bytes
|
||||
pub memory_usage_byte: u64,
|
||||
}
|
||||
Reference in new issue
Block a user