Skip to content

Commit be25214

Browse files
roypatpb8o
authored andcommitted
fix: subtract pre-run() execution time from startup time again
Deprecating --startup-time-cpu-us accidentally involved us to double count some time spent in the jailer. This commit reverts that behavior. Fixes: 21f0dea Signed-off-by: Patrick Roy <[email protected]>
1 parent 8f31f27 commit be25214

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/jailer/src/env.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ impl Env {
596596
}
597597

598598
pub fn run(mut self) -> Result<(), JailerError> {
599+
let jailer_start_time_cpu = utils::time::get_time_us(utils::time::ClockType::ProcessCpu);
599600
let exec_file_name = self.copy_exec_to_chroot()?;
600601
let chroot_exec_file = PathBuf::from("/").join(exec_file_name);
601602

@@ -723,7 +724,8 @@ impl Env {
723724
}
724725

725726
// Compute jailer's total CPU time up to the current time.
726-
self.jailer_cpu_time_us += utils::time::get_time_us(utils::time::ClockType::ProcessCpu);
727+
self.jailer_cpu_time_us +=
728+
utils::time::get_time_us(utils::time::ClockType::ProcessCpu) - jailer_start_time_cpu;
727729

728730
// If specified, exec the provided binary into a new PID namespace.
729731
if self.new_pid_ns {

0 commit comments

Comments
 (0)