Skip to content
Myr

Require user and system time units to match report time unit

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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 #408

authored by Garrett Thornburg · committed by David Peter · parent e601c00 · Browse files · 1 file+6 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−6 removed

  • other:+6 added−6 removed

1 file+6 added−6 removed

modified:src/hyperfine/benchmark.rs+6 added-6 removed
383 unmodified lines
384 let user_mean = mean(&times_user);385 let system_mean = mean(&times_system);386387 // Formatting and console output388 let (mean_str, unit_mean) = format_duration_unit(t_mean, options.time_unit);389 let stddev_str = format_duration(t_stddev, Some(unit_mean));390 let min_str = format_duration(t_min, Some(unit_mean));391 let max_str = format_duration(t_max, Some(unit_mean));388 let (mean_str, time_unit) = format_duration_unit(t_mean, options.time_unit);389 let stddev_str = format_duration(t_stddev, Some(time_unit));390 let min_str = format_duration(t_min, Some(time_unit));391 let max_str = format_duration(t_max, Some(time_unit));392 let num_str = format!("{} runs", t_num);393394 let (user_str, user_unit) = format_duration_unit(user_mean, None);395 let system_str = format_duration(system_mean, Some(user_unit));394 let user_str = format_duration(user_mean, Some(time_unit));395 let system_str = format_duration(system_mean, Some(time_unit));396397 if options.output_style != OutputStyleOption::Disabled {398 println!(399 " Time ({} ± {}): {:>8} ± {:>8} [User: {}, System: {}]",
74 unmodified lines