Make PercpuBlock const constructable

This commit is contained in:
bjorn3
2025-09-15 19:00:03 +02:00
parent 3329a41121
commit 4884d749af
8 changed files with 62 additions and 11 deletions
+10 -1
View File
@@ -196,12 +196,21 @@ pub struct SyscallDebugInfo {
accumulated_time: u128,
do_debug: bool,
}
#[cfg(feature = "syscall_debug")]
impl SyscallDebugInfo {
pub const fn default() -> Self {
Self {
this_switch_time: 0,
accumulated_time: 0,
do_debug: false,
}
}
#[cfg(feature = "syscall_debug")]
pub fn on_switch_from(&mut self) {
let now = crate::time::monotonic();
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();
}