executor.rs
This file
Path
src/benchmark/executor.rs
401 lines · 12.8 KiB · Rust
Last changed by
Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
History of this fileTake it
The walk stopped after 200 commits: lines older than 0f91d0c 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;Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
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;Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 7why, one step back7use crate::command::Command;Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
line 8why, one step back8use crate::options::{CmdFailureAction, CommandOutputPolicy, Options, OutputStyleOption, Shell};Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 9why, one step back9use crate::output::progress_bar::get_progress_bar;Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 10why, one step back10use crate::quantity::{second, Information, Time, Zero};Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 11why, one step back11use crate::timer::execute_and_measure;Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 12–15why, one step back12use crate::util::randomized_environment_offset;1314use anyhow::{bail, Context, Result};15Merge pull request #807 from willcl-ark/expose-run-varDavid Peterbefore adoption30a2b61
line 16why, one step back16#[derive(Clone, Copy)]Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
lines 17–32why, one step back17pub enum BenchmarkIteration {18 NonBenchmarkRun,19 Warmup(u64),20 Benchmark(u64),21}2223impl BenchmarkIteration {24 pub fn to_env_var_value(&self) -> Option<String> {25 match self {26 BenchmarkIteration::NonBenchmarkRun => None,27 BenchmarkIteration::Warmup(i) => Some(format!("warmup-{}", i)),28 BenchmarkIteration::Benchmark(i) => Some(format!("{}", i)),29 }30 }31}32Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 33–37why, one step back33pub trait Executor {34 /// Run the given command and measure the execution time35 fn run_command_and_measure(36 &self,37 command: &Command<'_>,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 38why, one step back38 iteration: BenchmarkIteration,Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 39why, one step back39 command_failure_action: Option<CmdFailureAction>,Multiple output policiesDavid Peterbefore adoption99d24b7
line 40why, one step back40 output_policy: &CommandOutputPolicy,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 41why, one step back41 ) -> Result<Measurement>;Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 42why, one step back42Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
lines 43–57why, one step back43 /// Run a lifecycle command through a shell, always treating failures as errors.44 fn run_intermediate_command_and_measure(45 &self,46 command: &Command<'_>,47 iteration: BenchmarkIteration,48 output_policy: &CommandOutputPolicy,49 ) -> Result<Measurement> {50 self.run_command_and_measure(51 command,52 iteration,53 Some(CmdFailureAction::RaiseError),54 output_policy,55 )56 }57Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 58–67why, one step back58 /// Perform a calibration of this executor. For example,59 /// when running commands through a shell, we need to60 /// measure the shell spawning time separately in order61 /// to subtract it from the full runtime later.62 fn calibrate(&mut self) -> Result<()>;6364 /// Return the time overhead for this executor when65 /// performing a measurement. This should return the time66 /// that is being used in addition to the actual runtime67 /// of the command.Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 68why, one step back68 fn time_overhead(&self) -> Time;Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 69–72why, one step back69}7071fn run_command_and_measure_common(72 mut command: std::process::Command,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 73why, one step back73 iteration: BenchmarkIteration,Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
lines 74–75why, one step back74 command_failure_action: Option<CmdFailureAction>,75 options: &Options,Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 76–77why, one step back76 command_output_policy: &CommandOutputPolicy,77 command_name: &str,Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 78why, one step back78 collect_hardware_counters: bool,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 79why, one step back79) -> Result<Measurement> {Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
line 80why, one step back80 let stdin = options.command_input_policy.get_stdin()?;Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 81–88why, one step back81 let (stdout, stderr) = command_output_policy.get_stdout_stderr()?;82 command.stdin(stdin).stdout(stdout).stderr(stderr);8384 command.env(85 "HYPERFINE_RANDOMIZED_ENVIRONMENT_OFFSET",86 randomized_environment_offset::value(),87 );88Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
lines 89–92why, one step back89 if let Some(value) = iteration.to_env_var_value() {90 command.env("HYPERFINE_ITERATION", value);91 }92Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 93why, one step back93 let measurement = execute_and_measure(command, collect_hardware_counters)style: simplify string interpolationHamir Mahalbefore adoptionef12632
line 94why, one step back94 .with_context(|| format!("Failed to run command '{command_name}'"))?;Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 95why, one step back95Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 96why, one step back96 if !measurement.exit_status.success() {Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
lines 97–98why, one step back97 use crate::util::exit_code::extract_exit_code;98Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
lines 99–103why, one step back99 let show_ignore_failure_hint = command_failure_action.is_none();100 let should_fail = match command_failure_action101 .as_ref()102 .unwrap_or(&options.command_failure_action)103 {Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
lines 104–105why, one step back104 CmdFailureAction::RaiseError => true,105 CmdFailureAction::IgnoreAllFailures => false,Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
line 106why, one step back106 CmdFailureAction::IgnoreSpecificFailures(codes) => {Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
line 107why, one step back107 // 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 108why, one step back108 if let Some(exit_code) = extract_exit_code(measurement.exit_status) {Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
lines 109–114why, one step back109 !codes.contains(&exit_code)110 } else {111 // If we can't extract an exit code, treat it as a failure112 true113 }114 }Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
lines 115–116why, one step back115 };116Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
lines 117–124why, one step back117 if should_fail {118 let when = match iteration {119 BenchmarkIteration::NonBenchmarkRun => "a non-benchmark run".to_string(),120 BenchmarkIteration::Warmup(0) => "the first warmup run".to_string(),121 BenchmarkIteration::Warmup(i) => format!("warmup iteration {i}"),122 BenchmarkIteration::Benchmark(0) => "the first benchmark run".to_string(),123 BenchmarkIteration::Benchmark(i) => format!("benchmark iteration {i}"),124 };Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
lines 125–127why, one step back125 let cause = measurement.exit_status.code().map_or_else(126 || "was terminated by a signal".to_owned(),127 |code| format!("terminated with non-zero exit code {code}"),Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
line 128why, one step back128 );Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
lines 129–135why, one step back129 let hint = if show_ignore_failure_hint {130 " Use the '-i'/'--ignore-failure' option if you want to ignore this. \131 Alternatively, use the '--show-output' option to debug what went wrong."132 } else {133 " Use the '--show-output' option to debug what went wrong."134 };135 bail!("Command '{command_name}' {cause} in {when}.{hint}");Support list of exit codes in --ignore-failureDavid Peterbefore adoptionb5a6860
line 136why, one step back136 }Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 137–138why, one step back137 }138Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 139why, one step back139 Ok(measurement)Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 140–151why, one step back140}141142pub struct RawExecutor<'a> {143 options: &'a Options,144}145146impl<'a> RawExecutor<'a> {147 pub fn new(options: &'a Options) -> Self {148 RawExecutor { options }149 }150}151apply clippy advices on executor/commands lifetimes.David Carlierbefore adoption2899deb
line 152why, one step back152impl Executor for RawExecutor<'_> {Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 153–155why, one step back153 fn run_command_and_measure(154 &self,155 command: &Command<'_>,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 156why, one step back156 iteration: BenchmarkIteration,Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 157why, one step back157 command_failure_action: Option<CmdFailureAction>,Multiple output policiesDavid Peterbefore adoption99d24b7
line 158why, one step back158 output_policy: &CommandOutputPolicy,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
lines 159–160why, one step back159 ) -> Result<Measurement> {160 run_command_and_measure_common(Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 161why, one step back161 command.get_command()?,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 162why, one step back162 iteration,Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
lines 163–164why, one step back163 command_failure_action,164 self.options,Multiple output policiesDavid Peterbefore adoption99d24b7
line 165why, one step back165 output_policy,Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 166why, one step back166 &command.get_command_line(),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 167why, one step back167 matches!(iteration, BenchmarkIteration::Benchmark(_)),Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 168why, one step back168 )Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 169–170why, one step back169 }170Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
lines 171–182why, one step back171 fn run_intermediate_command_and_measure(172 &self,173 command: &Command<'_>,174 iteration: BenchmarkIteration,175 output_policy: &CommandOutputPolicy,176 ) -> Result<Measurement> {177 // Keep shell startup in the hook's duration: raw benchmarks have no178 // calibrated shell overhead to add back when estimating the run count.179 ShellExecutor::new(&Shell::platform_default(), self.options)180 .run_intermediate_command_and_measure(command, iteration, output_policy)181 }182Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 183–186why, one step back183 fn calibrate(&mut self) -> Result<()> {184 Ok(())185 }186Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
lines 187–188why, one step back187 fn time_overhead(&self) -> Time {188 Time::zero()Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 189–194why, one step back189 }190}191192pub struct ShellExecutor<'a> {193 options: &'a Options,194 shell: &'a Shell,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 195why, one step back195 shell_spawning_time: Option<Measurement>,Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 196–207why, one step back196}197198impl<'a> ShellExecutor<'a> {199 pub fn new(shell: &'a Shell, options: &'a Options) -> Self {200 ShellExecutor {201 shell,202 options,203 shell_spawning_time: None,204 }205 }206}207apply clippy advices on executor/commands lifetimes.David Carlierbefore adoption2899deb
line 208why, one step back208impl Executor for ShellExecutor<'_> {Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 209–211why, one step back209 fn run_command_and_measure(210 &self,211 command: &Command<'_>,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 212why, one step back212 iteration: BenchmarkIteration,Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 213why, one step back213 command_failure_action: Option<CmdFailureAction>,Multiple output policiesDavid Peterbefore adoption99d24b7
line 214why, one step back214 output_policy: &CommandOutputPolicy,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 215why, one step back215 ) -> Result<Measurement> { bug: quoting failure on windows-platform (#296)Pedro Witzelbefore adoptionbece2ea
line 216why, one step back216 let on_windows_cmd = cfg!(windows) && *self.shell == Shell::Default("cmd.exe");Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 217why, one step back217 let mut command_builder = self.shell.command();Add --env for benchmark environment overridesDavid Peterbefore adoption6dddb02
line 218why, one step back218 command_builder.envs(command.get_environment());fmt: apply cargo fmt suggestionsPedro Witzelbefore adoptionc2f99e5
line 219why, one step back219 command_builder.arg(if on_windows_cmd { "/C" } else { "-c" }); bug: quoting failure on windows-platform (#296)Pedro Witzelbefore adoptionbece2ea
line 220why, one step back220fmt: apply cargo fmt suggestionsPedro Witzelbefore adoptionc2f99e5
lines 221–222why, one step back221 // Windows needs special treatment for its behavior on parsing cmd arguments222 if on_windows_cmd {cfg: adding more pre-processing for windows-only parserPedro Witzelbefore adoptionae9b0bb
line 223why, one step back223 #[cfg(windows)]fmt: apply cargo fmt suggestionsPedro Witzelbefore adoptionc2f99e5
lines 224–227why, one step back224 command_builder.raw_arg(command.get_command_line());225 } else {226 command_builder.arg(command.get_command_line());227 }Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 228why, one step back228Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 229why, one step back229 let mut measurement = run_command_and_measure_common(Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 230why, one step back230 command_builder,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 231why, one step back231 iteration,Run setup/cleanup commands in a shell (#990)David Peterbefore adoption4a9e066
lines 232–233why, one step back232 command_failure_action,233 self.options,Multiple output policiesDavid Peterbefore adoption99d24b7
line 234why, one step back234 output_policy,Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 235why, one step back235 &command.get_command_line(),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 236why, one step back236 false,Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 237–239why, one step back237 )?;238239 // Subtract shell spawning timeMerge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 240–245why, one step back240 fn ensure_non_negative(time: Time) -> Time {241 if time < Time::zero() {242 Time::zero()243 } else {244 time245 }Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 246–247why, one step back246 }247Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 248–254why, one step back248 if let Some(ref spawning_time) = self.shell_spawning_time {249 measurement.time_wall_clock =250 ensure_non_negative(measurement.time_wall_clock - spawning_time.time_wall_clock);251 measurement.time_user =252 ensure_non_negative(measurement.time_user - spawning_time.time_user);253 measurement.time_system =254 ensure_non_negative(measurement.time_system - spawning_time.time_system);Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 255why, one step back255 measurement.time_cpu = measurement.time_user + measurement.time_system;Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 256–258why, one step back256 }257258 Ok(measurement)Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 259–273why, one step back259 }260261 /// Measure the average shell spawning time262 fn calibrate(&mut self) -> Result<()> {263 const COUNT: u64 = 50;264 let progress_bar = if self.options.output_style != OutputStyleOption::Disabled {265 Some(get_progress_bar(266 COUNT,267 "Measuring shell spawning time",268 self.options.output_style,269 ))270 } else {271 None272 };273Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 274why, one step back274 let mut measurements = Measurements::default();Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 275–277why, one step back275276 for _ in 0..COUNT {277 // Just run the shell without any commandMerge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 278why, one step back278 let measurement = self.run_command_and_measure(Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
lines 279–281why, one step back279 &Command::new(None, ""),280 BenchmarkIteration::NonBenchmarkRun,281 None,Multiple output policiesDavid Peterbefore adoption99d24b7
line 282why, one step back282 &CommandOutputPolicy::Null,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 283why, one step back283 );Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 284why, one step back284Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 285why, one step back285 match measurement {Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 286–297why, one step back286 Err(_) => {287 let shell_cmd = if cfg!(windows) {288 format!("{} /C \"\"", self.shell)289 } else {290 format!("{} -c \"\"", self.shell)291 };292293 bail!(294 "Could not measure shell execution time. Make sure you can run '{}'.",295 shell_cmd296 );297 }Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
lines 298–299why, one step back298 Ok(result) => {299 measurements.push(result);Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 300–311why, one step back300 }301 }302303 if let Some(bar) = progress_bar.as_ref() {304 bar.inc(1)305 }306 }307308 if let Some(bar) = progress_bar.as_ref() {309 bar.finish_and_clear()310 }311Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 312why, one step back312 self.shell_spawning_time = Some(Measurement {Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 313why, one step back313 time_wall_clock: measurements.time_wall_clock_mean(),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 314why, one step back314 time_cpu: measurements.time_user_mean() + measurements.time_system_mean(),Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
lines 315–316why, one step back315 time_user: measurements.time_user_mean(),316 time_system: measurements.time_system_mean(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 317why, one step back317 memory_peak_resident: None,Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 318why, one step back318 hardware_counters: Default::default(),Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 319why, one step back319 exit_status: ExitStatus::default(),Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 320–324why, one step back320 });321322 Ok(())323 }324Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 325why, one step back325 fn time_overhead(&self) -> Time {Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 326why, one step back326 self.shell_spawning_time.as_ref().unwrap().time_wall_clockBump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 327–339why, one step back327 }328}329330#[derive(Clone)]331pub struct MockExecutor {332 shell: Option<String>,333}334335impl MockExecutor {336 pub fn new(shell: Option<String>) -> Self {337 MockExecutor { shell }338 }339Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 340why, one step back340 fn extract_time<S: AsRef<str>>(sleep_command: S) -> Time {Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 341why, one step back341 assert!(sleep_command.as_ref().starts_with("sleep "));Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
lines 342–348why, one step back342 Time::new::<second>(343 sleep_command344 .as_ref()345 .trim_start_matches("sleep ")346 .parse::<f64>()347 .unwrap(),348 )Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 349–355why, one step back349 }350}351352impl Executor for MockExecutor {353 fn run_command_and_measure(354 &self,355 command: &Command<'_>,Add iteration information to failure error messageDavid Peterbefore adoption83f04cd
line 356why, one step back356 _iteration: BenchmarkIteration,Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 357why, one step back357 _command_failure_action: Option<CmdFailureAction>,Multiple output policiesDavid Peterbefore adoption99d24b7
line 358why, one step back358 _output_policy: &CommandOutputPolicy,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 359why, one step back359 ) -> Result<Measurement> {Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 360why, one step back360 #[cfg(unix)]Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 361why, one step back361 let exit_status = {Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 362–366why, one step back362 use std::os::unix::process::ExitStatusExt;363 ExitStatus::from_raw(0)364 };365366 #[cfg(windows)]Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 367why, one step back367 let exit_status = {Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 368–371why, one step back368 use std::os::windows::process::ExitStatusExt;369 ExitStatus::from_raw(0)370 };371Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 372why, one step back372 Ok(Measurement {Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 373why, one step back373 time_wall_clock: Self::extract_time(command.get_command_line()),Alternative performance metrics in the terminal (#986)David Peterbefore adoptionbdbfae9
line 374why, one step back374 time_cpu: Time::zero(),Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
lines 375–376why, one step back375 time_user: Time::zero(),376 time_system: Time::zero(),Merge pull request #790 from sharkdp/new-metricsDavid Peterbefore adoptionf26c015
line 377why, one step back377 memory_peak_resident: Some(Information::zero()),Support hardware counters (instructions, cache misses, ...) (#983)David Peterbefore adoptionbc3a3f0
line 378why, one step back378 hardware_counters: Default::default(),Merge pull request #958 from sharkdp/codex/measurements-collectionDavid Peterbefore adoption16e23a1
line 379why, one step back379 exit_status,Merge pull request #954 from sharkdp/codex/remove-statisticalDavid Peterbefore adoption750fe11
line 380why, one step back380 })Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 381–386why, one step back381 }382383 fn calibrate(&mut self) -> Result<()> {384 Ok(())385 }386Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 387why, one step back387 fn time_overhead(&self) -> Time {Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 388why, one step back388 match &self.shell {Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
line 389why, one step back389 None => Time::zero(),Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
lines 390–396why, one step back390 Some(shell) => Self::extract_time(shell),391 }392 }393}394395#[test]396fn test_mock_executor_extract_time() {Merge pull request #961 from sharkdp/codex/uom-quantitiesDavid Peterbefore adoption975a25c
lines 397–400why, one step back397 assert_eq!(398 MockExecutor::extract_time("sleep 0.1"),399 Time::new::<second>(0.1)400 );Bump serde from 1.0.174 to 1.0.179dependabot[bot]before adoption0f91d0c
line 401why, one step back401}