executor.rs
This file
Path
src/benchmark/executor.rs
369 lines · 11.6 KiB · Rust
Last changed by
Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
History of this fileTake it
The walk stopped after 200 commits: lines older than 926b8d0 point at it.
fmt: apply cargo fmt suggestionsPedro Witzelbefore adoptionc2f99e5
line 1why, one step back1#[cfg(windows)] bug: quoting failure on windows-platform (#296)Pedro Witzelbefore adoptionbece2ea
line 2why, one step back2use std::os::windows::process::CommandExt;Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 3–4why, one step back3use std::process::ExitStatus;4Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 5–6why, one step back5use crate::benchmark::measurement::Measurement;6use crate::benchmark::measurement::Measurements;Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 7–11why, one step back7use crate::command::Command;8use crate::options::{9 CmdFailureAction, CommandInputPolicy, CommandOutputPolicy, Options, OutputStyleOption, Shell,10};11use crate::output::progress_bar::get_progress_bar;Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 12why, one step back12use crate::quantity::{second, Information, Time, Zero};Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 13why, one step back13use crate::timer::execute_and_measure;Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 14–17why, one step back14use crate::util::randomized_environment_offset;1516use anyhow::{bail, Context, Result};17Merge pull request #807 from willcl-ark/expose-run-varDavid Peterbefore adoption30a2b61
line 18why, one step back18#[derive(Clone, Copy)]Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
lines 19–34why, one step back19pub enum BenchmarkIteration {20 NonBenchmarkRun,21 Warmup(u64),22 Benchmark(u64),23}2425impl BenchmarkIteration {26 pub fn to_env_var_value(&self) -> Option<String> {27 match self {28 BenchmarkIteration::NonBenchmarkRun => None,29 BenchmarkIteration::Warmup(i) => Some(format!("warmup-{}", i)),30 BenchmarkIteration::Benchmark(i) => Some(format!("{}", i)),31 }32 }33}34Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 35–39why, one step back35pub trait Executor {36 /// Run the given command and measure the execution time37 fn run_command_and_measure(38 &self,39 command: &Command<'_>,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 40why, one step back40 iteration: BenchmarkIteration,Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 41why, one step back41 command_failure_action: Option<CmdFailureAction>,Multiple output policiesDavid Peterbefore adoption99d24b7
line 42why, one step back42 output_policy: &CommandOutputPolicy,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 43why, one step back43 ) -> Result<Measurement>;Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 44–54why, one step back4445 /// Perform a calibration of this executor. For example,46 /// when running commands through a shell, we need to47 /// measure the shell spawning time separately in order48 /// to subtract it from the full runtime later.49 fn calibrate(&mut self) -> Result<()>;5051 /// Return the time overhead for this executor when52 /// performing a measurement. This should return the time53 /// that is being used in addition to the actual runtime54 /// of the command.Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 55why, one step back55 fn time_overhead(&self) -> Time;Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 56–59why, one step back56}5758fn run_command_and_measure_common(59 mut command: std::process::Command,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 60why, one step back60 iteration: BenchmarkIteration,Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 61–64why, one step back61 command_failure_action: CmdFailureAction,62 command_input_policy: &CommandInputPolicy,63 command_output_policy: &CommandOutputPolicy,64 command_name: &str,Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 65why, one step back65 collect_hardware_counters: bool,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 66why, one step back66) -> Result<Measurement> {Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 67–75why, one step back67 let stdin = command_input_policy.get_stdin()?;68 let (stdout, stderr) = command_output_policy.get_stdout_stderr()?;69 command.stdin(stdin).stdout(stdout).stderr(stderr);7071 command.env(72 "HYPERFINE_RANDOMIZED_ENVIRONMENT_OFFSET",73 randomized_environment_offset::value(),74 );75Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
lines 76–79why, one step back76 if let Some(value) = iteration.to_env_var_value() {77 command.env("HYPERFINE_ITERATION", value);78 }79Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 80why, one step back80 let measurement = execute_and_measure(command, collect_hardware_counters)style: simplify string interpolationHamir Mahalbefore adoptionef12632
line 81why, one step back81 .with_context(|| format!("Failed to run command '{command_name}'"))?;Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 82why, one step back82Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 83why, one step back83 if !measurement.exit_status.success() {Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
lines 84–90why, one step back84 use crate::util::exit_code::extract_exit_code;8586 let should_fail = match command_failure_action {87 CmdFailureAction::RaiseError => true,88 CmdFailureAction::IgnoreAllFailures => false,89 CmdFailureAction::IgnoreSpecificFailures(ref codes) => {90 // Only fail if the exit code is not in the list of codes to ignoreMerge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 91why, one step back91 if let Some(exit_code) = extract_exit_code(measurement.exit_status) {Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
lines 92–97why, one step back92 !codes.contains(&exit_code)93 } else {94 // If we can't extract an exit code, treat it as a failure95 true96 }97 }Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
lines 98–99why, one step back98 };99Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
lines 100–110why, one step back100 if should_fail {101 let when = match iteration {102 BenchmarkIteration::NonBenchmarkRun => "a non-benchmark run".to_string(),103 BenchmarkIteration::Warmup(0) => "the first warmup run".to_string(),104 BenchmarkIteration::Warmup(i) => format!("warmup iteration {i}"),105 BenchmarkIteration::Benchmark(0) => "the first benchmark run".to_string(),106 BenchmarkIteration::Benchmark(i) => format!("benchmark iteration {i}"),107 };108 bail!(109 "{cause} in {when}. Use the '-i'/'--ignore-failure' option if you want to ignore this. \110 Alternatively, use the '--show-output' option to debug what went wrong.",Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 111why, one step back111 cause=measurement.exit_status.code().map_or(Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
lines 112–117why, one step back112 "The process has been terminated by a signal".into(),113 |c| format!("Command terminated with non-zero exit code {c}")114115 ),116 );117 }Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 118–119why, one step back118 }119Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 120why, one step back120 Ok(measurement)Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 121–132why, one step back121}122123pub struct RawExecutor<'a> {124 options: &'a Options,125}126127impl<'a> RawExecutor<'a> {128 pub fn new(options: &'a Options) -> Self {129 RawExecutor { options }130 }131}132apply clippy advices on executor/commands lifetimes.David Carlierbefore adoption2899deb
line 133why, one step back133impl Executor for RawExecutor<'_> {Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 134–136why, one step back134 fn run_command_and_measure(135 &self,136 command: &Command<'_>,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 137why, one step back137 iteration: BenchmarkIteration,Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 138why, one step back138 command_failure_action: Option<CmdFailureAction>,Multiple output policiesDavid Peterbefore adoption99d24b7
line 139why, one step back139 output_policy: &CommandOutputPolicy,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
lines 140–141why, one step back140 ) -> Result<Measurement> {141 run_command_and_measure_common(Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 142why, one step back142 command.get_command()?,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 143why, one step back143 iteration,Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
line 144why, one step back144 command_failure_action.unwrap_or_else(|| self.options.command_failure_action.clone()),Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 145why, one step back145 &self.options.command_input_policy,Multiple output policiesDavid Peterbefore adoption99d24b7
line 146why, one step back146 output_policy,Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 147why, one step back147 &command.get_command_line(),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 148why, one step back148 matches!(iteration, BenchmarkIteration::Benchmark(_)),Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 149why, one step back149 )Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 150–155why, one step back150 }151152 fn calibrate(&mut self) -> Result<()> {153 Ok(())154 }155Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
lines 156–157why, one step back156 fn time_overhead(&self) -> Time {157 Time::zero()Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 158–163why, one step back158 }159}160161pub struct ShellExecutor<'a> {162 options: &'a Options,163 shell: &'a Shell,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 164why, one step back164 shell_spawning_time: Option<Measurement>,Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 165–176why, one step back165}166167impl<'a> ShellExecutor<'a> {168 pub fn new(shell: &'a Shell, options: &'a Options) -> Self {169 ShellExecutor {170 shell,171 options,172 shell_spawning_time: None,173 }174 }175}176apply clippy advices on executor/commands lifetimes.David Carlierbefore adoption2899deb
line 177why, one step back177impl Executor for ShellExecutor<'_> {Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 178–180why, one step back178 fn run_command_and_measure(179 &self,180 command: &Command<'_>,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 181why, one step back181 iteration: BenchmarkIteration,Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 182why, one step back182 command_failure_action: Option<CmdFailureAction>,Multiple output policiesDavid Peterbefore adoption99d24b7
line 183why, one step back183 output_policy: &CommandOutputPolicy,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 184why, one step back184 ) -> Result<Measurement> { bug: quoting failure on windows-platform (#296)Pedro Witzelbefore adoptionbece2ea
line 185why, one step back185 let on_windows_cmd = cfg!(windows) && *self.shell == Shell::Default("cmd.exe");Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 186why, one step back186 let mut command_builder = self.shell.command();fmt: apply cargo fmt suggestionsPedro Witzelbefore adoptionc2f99e5
line 187why, one step back187 command_builder.arg(if on_windows_cmd { "/C" } else { "-c" }); bug: quoting failure on windows-platform (#296)Pedro Witzelbefore adoptionbece2ea
line 188why, one step back188fmt: apply cargo fmt suggestionsPedro Witzelbefore adoptionc2f99e5
lines 189–190why, one step back189 // Windows needs special treatment for its behavior on parsing cmd arguments190 if on_windows_cmd {cfg: adding more pre-processing for windows-only parserPedro Witzelbefore adoptionae9b0bb
line 191why, one step back191 #[cfg(windows)]fmt: apply cargo fmt suggestionsPedro Witzelbefore adoptionc2f99e5
lines 192–195why, one step back192 command_builder.raw_arg(command.get_command_line());193 } else {194 command_builder.arg(command.get_command_line());195 }Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 196why, one step back196Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 197why, one step back197 let mut measurement = run_command_and_measure_common(Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 198why, one step back198 command_builder,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 199why, one step back199 iteration,Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
line 200why, one step back200 command_failure_action.unwrap_or_else(|| self.options.command_failure_action.clone()),Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 201why, one step back201 &self.options.command_input_policy,Multiple output policiesDavid Peterbefore adoption99d24b7
line 202why, one step back202 output_policy,Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 203why, one step back203 &command.get_command_line(),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 204why, one step back204 false,Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 205–207why, one step back205 )?;206207 // Subtract shell spawning timeMerge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 208–213why, one step back208 fn ensure_non_negative(time: Time) -> Time {209 if time < Time::zero() {210 Time::zero()211 } else {212 time213 }Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 214–215why, one step back214 }215Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 216–222why, one step back216 if let Some(ref spawning_time) = self.shell_spawning_time {217 measurement.time_wall_clock =218 ensure_non_negative(measurement.time_wall_clock - spawning_time.time_wall_clock);219 measurement.time_user =220 ensure_non_negative(measurement.time_user - spawning_time.time_user);221 measurement.time_system =222 ensure_non_negative(measurement.time_system - spawning_time.time_system);Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 223why, one step back223 measurement.time_cpu = measurement.time_user + measurement.time_system;Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 224–226why, one step back224 }225226 Ok(measurement)Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 227–241why, one step back227 }228229 /// Measure the average shell spawning time230 fn calibrate(&mut self) -> Result<()> {231 const COUNT: u64 = 50;232 let progress_bar = if self.options.output_style != OutputStyleOption::Disabled {233 Some(get_progress_bar(234 COUNT,235 "Measuring shell spawning time",236 self.options.output_style,237 ))238 } else {239 None240 };241Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 242why, one step back242 let mut measurements = Measurements::default();Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 243–245why, one step back243244 for _ in 0..COUNT {245 // Just run the shell without any commandMerge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 246why, one step back246 let measurement = self.run_command_and_measure(Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
lines 247–249why, one step back247 &Command::new(None, ""),248 BenchmarkIteration::NonBenchmarkRun,249 None,Multiple output policiesDavid Peterbefore adoption99d24b7
line 250why, one step back250 &CommandOutputPolicy::Null,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 251why, one step back251 );Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 252why, one step back252Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 253why, one step back253 match measurement {Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 254–265why, one step back254 Err(_) => {255 let shell_cmd = if cfg!(windows) {256 format!("{} /C \"\"", self.shell)257 } else {258 format!("{} -c \"\"", self.shell)259 };260261 bail!(262 "Could not measure shell execution time. Make sure you can run '{}'.",263 shell_cmd264 );265 }Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 266–267why, one step back266 Ok(result) => {267 measurements.push(result);Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 268–279why, one step back268 }269 }270271 if let Some(bar) = progress_bar.as_ref() {272 bar.inc(1)273 }274 }275276 if let Some(bar) = progress_bar.as_ref() {277 bar.finish_and_clear()278 }279Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 280why, one step back280 self.shell_spawning_time = Some(Measurement {Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 281why, one step back281 time_wall_clock: measurements.time_wall_clock_mean(),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 282why, one step back282 time_cpu: measurements.time_user_mean() + measurements.time_system_mean(),Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
lines 283–284why, one step back283 time_user: measurements.time_user_mean(),284 time_system: measurements.time_system_mean(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 285why, one step back285 memory_peak_resident: None,Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 286why, one step back286 hardware_counters: Default::default(),Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 287why, one step back287 exit_status: ExitStatus::default(),Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 288–292why, one step back288 });289290 Ok(())291 }292Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 293why, one step back293 fn time_overhead(&self) -> Time {Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 294why, one step back294 self.shell_spawning_time.as_ref().unwrap().time_wall_clockImprove error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 295–307why, one step back295 }296}297298#[derive(Clone)]299pub struct MockExecutor {300 shell: Option<String>,301}302303impl MockExecutor {304 pub fn new(shell: Option<String>) -> Self {305 MockExecutor { shell }306 }307Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 308why, one step back308 fn extract_time<S: AsRef<str>>(sleep_command: S) -> Time {Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 309why, one step back309 assert!(sleep_command.as_ref().starts_with("sleep "));Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
lines 310–316why, one step back310 Time::new::<second>(311 sleep_command312 .as_ref()313 .trim_start_matches("sleep ")314 .parse::<f64>()315 .unwrap(),316 )Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 317–323why, one step back317 }318}319320impl Executor for MockExecutor {321 fn run_command_and_measure(322 &self,323 command: &Command<'_>,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 324why, one step back324 _iteration: BenchmarkIteration,Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 325why, one step back325 _command_failure_action: Option<CmdFailureAction>,Multiple output policiesDavid Peterbefore adoption99d24b7
line 326why, one step back326 _output_policy: &CommandOutputPolicy,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 327why, one step back327 ) -> Result<Measurement> {Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 328why, one step back328 #[cfg(unix)]Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 329why, one step back329 let exit_status = {Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 330–334why, one step back330 use std::os::unix::process::ExitStatusExt;331 ExitStatus::from_raw(0)332 };333334 #[cfg(windows)]Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 335why, one step back335 let exit_status = {Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 336–339why, one step back336 use std::os::windows::process::ExitStatusExt;337 ExitStatus::from_raw(0)338 };339Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 340why, one step back340 Ok(Measurement {Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 341why, one step back341 time_wall_clock: Self::extract_time(command.get_command_line()),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 342why, one step back342 time_cpu: Time::zero(),Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
lines 343–344why, one step back343 time_user: Time::zero(),344 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 345why, one step back345 memory_peak_resident: Some(Information::zero()),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 346why, one step back346 hardware_counters: Default::default(),Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 347why, one step back347 exit_status,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 348why, one step back348 })Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 349–354why, one step back349 }350351 fn calibrate(&mut self) -> Result<()> {352 Ok(())353 }354Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 355why, one step back355 fn time_overhead(&self) -> Time {Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 356why, one step back356 match &self.shell {Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 357why, one step back357 None => Time::zero(),Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
lines 358–364why, one step back358 Some(shell) => Self::extract_time(shell),359 }360 }361}362363#[test]364fn test_mock_executor_extract_time() {Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
lines 365–368why, one step back365 assert_eq!(366 MockExecutor::extract_time("sleep 0.1"),367 Time::new::<second>(0.1)368 );Improve error message, mention --shell=noneDavid Peterbefore adoption926b8d0
line 369why, one step back369}