diff --git a/src/context/switch.rs b/src/context/switch.rs index 7ef694f170..c3815bf200 100644 --- a/src/context/switch.rs +++ b/src/context/switch.rs @@ -297,8 +297,8 @@ pub fn switch(token: &mut CleanLockToken) -> SwitchResult { prev_context.syscall_debug_info = percpu .syscall_debug_info .replace(next_context.syscall_debug_info); - prev_context.syscall_debug_info.on_switch_from(); - next_context.syscall_debug_info.on_switch_to(); + prev_context.syscall_debug_info.on_switch_from(token); + next_context.syscall_debug_info.on_switch_to(token); } percpu diff --git a/src/syscall/debug.rs b/src/syscall/debug.rs index 2291c3dcab..a81c52fbd8 100644 --- a/src/syscall/debug.rs +++ b/src/syscall/debug.rs @@ -211,13 +211,13 @@ impl SyscallDebugInfo { } #[cfg(feature = "syscall_debug")] - pub fn on_switch_from(&mut self) { - let now = crate::time::monotonic(); + pub fn on_switch_from(&mut self, token: &mut CleanLockToken) { + let now = crate::time::monotonic(token); self.accumulated_time += now - core::mem::replace(&mut self.this_switch_time, now); } #[cfg(feature = "syscall_debug")] - pub fn on_switch_to(&mut self) { - self.this_switch_time = crate::time::monotonic(); + pub fn on_switch_to(&mut self, token: &mut CleanLockToken) { + self.this_switch_time = crate::time::monotonic(token); } }