Fix profiling code.

This commit is contained in:
4lDO2
2024-03-23 15:52:18 +01:00
parent 299a829ff3
commit 1b3e024f7d
3 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ pub type IdtReservations = [AtomicU32; 8];
#[repr(C)]
pub struct Idt {
entries: IdtEntries,
pub(crate) entries: IdtEntries,
reservations: IdtReservations,
}
impl Idt {
+4 -2
View File
@@ -12,7 +12,7 @@ use crate::{
interrupt::{irq::aux_timer, InterruptStack},
percpu::PercpuBlock,
syscall::{error::*, usercopy::UserSliceWo},
LogicalCpuId,
cpu_set::LogicalCpuId,
};
const N: usize = 64 * 1024 * 1024;
@@ -96,14 +96,16 @@ const NULL: AtomicPtr<RingBuffer> = AtomicPtr::new(core::ptr::null_mut());
pub static BUFS: [AtomicPtr<RingBuffer>; 4] = [NULL; 4];
pub const PROFILE_TOGGLEABLE: bool = true;
pub static IS_PROFILING: AtomicBool = AtomicBool::new(false);
pub static IS_PROFILING: AtomicBool = AtomicBool::new(true);
pub fn serio_command(index: usize, data: u8) {
if PROFILE_TOGGLEABLE {
if index == 0 && data == 30 {
// "a" key in QEMU
log::info!("Enabling profiling");
IS_PROFILING.store(true, Ordering::SeqCst);
} else if index == 0 && data == 48 {
// "b" key
log::info!("Disabling profiling");
IS_PROFILING.store(false, Ordering::SeqCst);
}
+1 -1
View File
@@ -121,7 +121,7 @@ impl KernelScheme for DebugScheme {
#[cfg(feature = "profiling")]
if handle.num != !0 {
return crate::profiling::drain_buffer(
crate::LogicalCpuId::new(handle.num as u32),
crate::cpu_set::LogicalCpuId::new(handle.num as u32),
buf,
);
}