mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
cleanup error messages from perflib
This commit is contained in:
parent
e515092636
commit
9489342d4b
1 changed files with 39 additions and 2 deletions
|
|
@ -2,8 +2,36 @@ use utralib::generated::*;
|
|||
use core::num::{NonZeroU8, NonZeroU16};
|
||||
use std::cell::RefCell;
|
||||
|
||||
// To read out performance monitoring data, use the `usb_update.py` script as follows:
|
||||
// ` python3 .\..\usb_update.py --dump v2p.txt --dump-file .\ring_aes_8.bin`
|
||||
// where the `v2p.txt` file contains a virtual to physical mapping that is generated by the `perflib` framework and
|
||||
|
||||
pub const BUFLEN: usize = 1024 * 512;
|
||||
|
||||
/// ($pid:expr, $fid:expr, $meta:expr, $index:expr, $line:expr)
|
||||
/// general format of a performance counter entry:
|
||||
/// file ID | process ID | meta codes | index | line number
|
||||
/// 31 29 28 24 23 21 20 13 12 0
|
||||
/// This gives tracking across:
|
||||
/// - 8 files
|
||||
/// - 32 processes
|
||||
/// - 8 "meta" codes
|
||||
/// - a loop index of up to 255 times
|
||||
/// - a file line number of up to 8192
|
||||
#[macro_export]
|
||||
macro_rules! perf_entry {
|
||||
($pid:expr, $fid:expr, $meta:expr, $index:expr, $line:expr) => {
|
||||
(($fid as u32) & 0x7) << 29 |
|
||||
(($pid as u32) & 0x1F) << 24 |
|
||||
(($meta as u32) & 0x7) << 21 |
|
||||
(($index as u32) & 0xFF) << 13 |
|
||||
(($line as u32) & 0x1FFF)
|
||||
};
|
||||
}
|
||||
pub const PERFMETA_NONE: u32 = 0;
|
||||
pub const PERFMETA_STARTBLOCK: u32 = 1;
|
||||
pub const PERFMETA_ENDBLOCK: u32 = 2;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct PerfLogEntry {
|
||||
code: u32,
|
||||
|
|
@ -117,9 +145,18 @@ impl <'a> PerfMgr<'a> {
|
|||
d.ts = 0;
|
||||
}
|
||||
self.perf_csr.wfo(utra::perfcounter::RUN_STOP, 1);
|
||||
let mut first_i: Option<u32> = None;
|
||||
let mut last_i = 0;
|
||||
while self.perf_csr.rf(utra::perfcounter::STATUS_READABLE) == 1 {
|
||||
let i = self.perf_csr.r(utra::perfcounter::EVENT_INDEX); // this advances the FIFO until it is empty
|
||||
log::warn!("FIFO was not drained before reset: {}", i);
|
||||
if first_i.is_none() {
|
||||
first_i = Some(i);
|
||||
} else {
|
||||
last_i = i;
|
||||
}
|
||||
}
|
||||
if let Some(i) = first_i {
|
||||
log::warn!("FIFO was not drained before reset: indices [{}..{}]", i, last_i);
|
||||
}
|
||||
// stop the counter if it would rollover
|
||||
self.perf_csr.wo(utra::perfcounter::SATURATE_LIMIT0, self.saturation_limit as u32);
|
||||
|
|
@ -237,7 +274,7 @@ impl <'a> PerfMgr<'a> {
|
|||
}
|
||||
}
|
||||
self.ts_cont.replace(self.ts_cont.take() + ts_offset as u64);
|
||||
log::info!("FIFO final flush had {} entries", expected_i - 1);
|
||||
log::info!("FIFO final flush had {} entries", if expected_i == 0 { 0 } else { expected_i - 1 });
|
||||
log::info!("Had {} buffer entries", *self.dbg_buf_count.borrow()); // should be the same as above, but trying to chase down some minor issues...
|
||||
if !oom {
|
||||
Ok(*self.dbg_buf_count.borrow())
|
||||
|
|
|
|||
Loading…
Reference in a new issue