(
&mut self,
execution_context: &ExecutionContext,
_mongo_tracer: &Option<MongoTracer>,
)
| 136 | } |
| 137 | |
| 138 | async fn run( |
| 139 | &mut self, |
| 140 | execution_context: &ExecutionContext, |
| 141 | _mongo_tracer: &Option<MongoTracer>, |
| 142 | ) -> Result<()> { |
| 143 | // Resolve isolation once: this runs the pre-bench setup, wraps the bench |
| 144 | // leaf, and (for hook mode) runs post-bench on drop. Held for the whole run |
| 145 | // so its teardown fires after the benchmark completes. `requires_sudo` is |
| 146 | // read off it for the privilege wrapping below (or in the profiler). |
| 147 | let isolation = Isolation::resolve(); |
| 148 | let requires_sudo = isolation.requires_sudo(); |
| 149 | |
| 150 | let (_env_file, _script_file, cmd_builder) = |
| 151 | WallTimeExecutor::walltime_bench_cmd(&execution_context.config, execution_context)?; |
| 152 | let cmd_builder = isolation.wrap_bench(cmd_builder)?; |
| 153 | |
| 154 | // Split-borrow `self` so the closure inside `run_with_profiler` can |
| 155 | // capture `benchmark_state` while we hold `&mut profiler`. |
| 156 | let Self { |
| 157 | profiler, |
| 158 | benchmark_state, |
| 159 | .. |
| 160 | } = self; |
| 161 | |
| 162 | let status = match profiler.as_mut() { |
| 163 | Some(profiler) if execution_context.config.enable_profiler => { |
| 164 | run_with_profiler( |
| 165 | profiler.as_mut(), |
| 166 | cmd_builder, |
| 167 | &execution_context.config, |
| 168 | &execution_context.profile_folder, |
| 169 | requires_sudo, |
| 170 | benchmark_state, |
| 171 | ) |
| 172 | .await |
| 173 | } |
| 174 | _ => { |
| 175 | let cmd_builder = if requires_sudo { |
| 176 | wrap_with_sudo(cmd_builder)? |
| 177 | } else { |
| 178 | cmd_builder |
| 179 | }; |
| 180 | let cmd = cmd_builder.build().into(); |
| 181 | debug!("cmd: {cmd:?}"); |
| 182 | run_command_with_log_pipe(cmd).await |
| 183 | } |
| 184 | }; |
| 185 | |
| 186 | let status = status.map_err(|e| anyhow!("failed to execute the benchmark process. {e}"))?; |
| 187 | debug!("cmd exit status: {status:?}"); |
| 188 | |
| 189 | if !status.success() { |
| 190 | bail!("failed to execute the benchmark process: {status}"); |
| 191 | } |
| 192 | |
| 193 | Ok(()) |
| 194 | } |
| 195 |
nothing calls this directly
no test coverage detected