diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/irq.rs | 1 | ||||
-rw-r--r-- | src/perfcnt/intel/counters.rs | 6 | ||||
-rw-r--r-- | src/perfcnt/mod.rs | 11 |
3 files changed, 15 insertions, 3 deletions
@@ -179,7 +179,6 @@ impl fmt::Debug for PageFaultError { #[test] fn bit_macro() { - assert!(PFAULT_ERROR_PK.bits() == 0b100000); assert!(PFAULT_ERROR_ID.bits() == 0b10000); assert!(PFAULT_ERROR_RSVD.bits() == 0b1000); diff --git a/src/perfcnt/intel/counters.rs b/src/perfcnt/intel/counters.rs index d05fd5c..9d046bf 100644 --- a/src/perfcnt/intel/counters.rs +++ b/src/perfcnt/intel/counters.rs @@ -5,4 +5,8 @@ use super::description::PebsType; use super::description::Tuple; use super::description::MSRIndex; -include!(concat!(env!("OUT_DIR"), "/counters.rs"));
\ No newline at end of file +#[cfg(not(feature = "cached_counters"))] +include!(concat!(env!("OUT_DIR"), "/counters.rs")); + +#[cfg(feature = "cached_counters")] +include!("generated.rs"); diff --git a/src/perfcnt/mod.rs b/src/perfcnt/mod.rs index 79e536c..fba94bd 100644 --- a/src/perfcnt/mod.rs +++ b/src/perfcnt/mod.rs @@ -6,7 +6,7 @@ use core::str; pub mod intel; -const MODEL_LEN: usize = 20; +const MODEL_LEN: usize = 30; #[derive(Default)] struct ModelWriter { @@ -64,3 +64,12 @@ pub fn core_counters() -> Option<&'static phf::Map<&'static str, intel::descript pub fn uncore_counters() -> Option<&'static phf::Map<&'static str, intel::description::IntelPerformanceCounterDescription>> { get_counters!("{}-{}-{:X}{:X}-uncore") } + +#[test] +fn counter_test() { + core_counters().map(|cc| { + cc.get("INST_RETIRED.ANY").map(|p| { + assert!(p.event_name == "INST_RETIRED.ANY"); + }); + }); +}
\ No newline at end of file |