Fix profiling code.
This commit is contained in:
@@ -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
@@ -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
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user