Skip to content

Commit

Permalink
Require user and system time units to match report time unit
Browse files Browse the repository at this point in the history
The stddev/mean/max/min time unit gives precedence to the `--time-unit`
command line flag, and falls back to parsing. This changes the user and
system time to follow the same time unit as the rest of the report.

Closes sharkdp#408
  • Loading branch information
film42 committed Jul 12, 2021
1 parent e601c00 commit f6acd5a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/hyperfine/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,14 @@ pub fn run_benchmark(
let system_mean = mean(&times_system);

// Formatting and console output
let (mean_str, unit_mean) = format_duration_unit(t_mean, options.time_unit);
let stddev_str = format_duration(t_stddev, Some(unit_mean));
let min_str = format_duration(t_min, Some(unit_mean));
let max_str = format_duration(t_max, Some(unit_mean));
let (mean_str, time_unit) = format_duration_unit(t_mean, options.time_unit);
let stddev_str = format_duration(t_stddev, Some(time_unit));
let min_str = format_duration(t_min, Some(time_unit));
let max_str = format_duration(t_max, Some(time_unit));
let num_str = format!("{} runs", t_num);

let (user_str, user_unit) = format_duration_unit(user_mean, None);
let system_str = format_duration(system_mean, Some(user_unit));
let user_str = format_duration(user_mean, Some(time_unit));
let system_str = format_duration(system_mean, Some(time_unit));

if options.output_style != OutputStyleOption::Disabled {
println!(
Expand Down

0 comments on commit f6acd5a

Please sign in to comment.