You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: stop double counting jailer time in process_startup_time_cpu_us
In `report_cpu_start_time()`, Firecracker computers the CPU time it took
until the API socket was available as
CLOCK_PROCESS_CPUTIME_ID - cpu_start_time + jailer_time
However, here `cpu_start_time` is always zero currently (it's the value
the jailer passes via `--cpu-start-time`), and in the case where the
jailer exec()s into Firecracker (without prior fork() or clone()), this
is wrong: CLOCK_PROCESS_CPUTIME_ID will now be the CPU time since the
_jailer_ process started, and thus adding the jailer_time to it is
nonsense. This all works out if we set cpu_start_time to be the CPU time
right before we exec() into Firecracker: If we did not fork(), then it
will cause the calculation above to correctly discard all time before
exec()-ing into Firecracker (before re-adding specifically the time
spent in the jailer). If we _did_ fork(), then it will be approximately
zero, and thus preserve the current semantics (as the jailer time will
only be the time _until_ we did the last fork(), and
CLOCK_PROCESS_CPUTIME_ID will only be the absolute CPU time _since_ the
last fork()).
Signed-off-by: Patrick Roy <[email protected]>
0 commit comments