Skip to content
Myr

Simplify

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

authored by David Peter · committed by David Peter · parent 7fd4aea · Browse files · 1 file+7 added−20 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+7 added−20 removed

  • other:+7 added−20 removed

1 file+7 added−20 removed

modified:src/benchmark/executor.rs+7 added-20 removed
38 unmodified lines
39 shell_spawning_time: Option<TimingResult>,40}4142impl<'a> ShellExecutor<'a> {43 fn subtract_shell_spawning_time(&self, time: Second, shell_spawning_time: Second) -> Second {44 if time < shell_spawning_time {45 0.046 } else {47 time - shell_spawning_time48 }49 }5043 pub fn new(shell: &'a Shell, options: &'a Options) -> Self {44 ShellExecutor {45 shell,46 options,
21 unmodified lines
68 )69 .arg(if cfg!(windows) { "/C" } else { "-c" })70 .arg(command.get_command_line());7180 let result = execute_and_measure(command_builder)72 let mut result = execute_and_measure(command_builder)73 .with_context(|| format!("Failed to run command '{}'", command.get_command_line()))?;7483 let mut time_real = result.time_real;8485 let mut time_user = result.time_user;86 let mut time_system = result.time_system;8775 if command_failure_action.unwrap_or(self.options.command_failure_action)76 == CmdFailureAction::RaiseError77 && !result.status.success()78 {
8 unmodified lines
87 }8889 // Subtract shell spawning time90 if let Some(spawning_time) = self.shell_spawning_time {104 time_real = self.subtract_shell_spawning_time(time_real, spawning_time.time_real);105 time_user = self.subtract_shell_spawning_time(time_user, spawning_time.time_user);106 time_system = self.subtract_shell_spawning_time(time_system, spawning_time.time_system);91 result.time_real = (result.time_real - spawning_time.time_real).max(0.0);92 result.time_user = (result.time_user - spawning_time.time_user).max(0.0);93 result.time_system = (result.time_system - spawning_time.time_system).max(0.0);94 }9596 Ok((97 TimingResult {111 time_real,112 time_user,113 time_system,98 time_real: result.time_real,99 time_user: result.time_user,100 time_system: result.time_system,101 },102 result.status,103 ))104 }
129 unmodified lines