Skip to content

Commit a1d7820

Browse files
committed
refactor: make it obvious that we always pass 0 to start-time-cpu-us
Instead of setting the variable to 0 unconditionally right before it is used, just inline this zero into the only use-site. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
1 parent 95858fb commit a1d7820

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/jailer/src/env.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ impl Env {
476476
Command::new(chroot_exec_file)
477477
.args(["--id", &self.id])
478478
.args(["--start-time-us", &self.start_time_us.to_string()])
479-
.args(["--start-time-cpu-us", &self.start_time_cpu_us.to_string()])
479+
.args(["--start-time-cpu-us", "0"])
480480
.args(["--parent-cpu-time-us", &self.jailer_cpu_time_us.to_string()])
481481
.stdin(Stdio::inherit())
482482
.stdout(Stdio::inherit())
@@ -698,8 +698,6 @@ impl Env {
698698
// Compute jailer's total CPU time up to the current time.
699699
self.jailer_cpu_time_us += get_time_us(ClockType::ProcessCpu);
700700
self.jailer_cpu_time_us -= self.start_time_cpu_us;
701-
// Reset process start time.
702-
self.start_time_cpu_us = 0;
703701

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

0 commit comments

Comments
 (0)