aboutsummaryrefslogtreecommitdiff
path: root/src/perfcnt/mod.rs
diff options
context:
space:
mode:
authorGravatar Gerd Zellweger <mail@gerdzellweger.com> 2015-11-27 08:05:35 +0100
committerGravatar Gerd Zellweger <mail@gerdzellweger.com> 2015-11-27 08:05:35 +0100
commit447c2562dec4bde02593e91a6b16e1daa2163f32 (patch)
treead5d14a396f06707df3f664f995c3c2d485746cc /src/perfcnt/mod.rs
parent7665b2cfe821853466216be3072a87ab155c69c6 (diff)
downloadrust-x86-447c2562dec4bde02593e91a6b16e1daa2163f32.tar.gz
rust-x86-447c2562dec4bde02593e91a6b16e1daa2163f32.tar.zst
rust-x86-447c2562dec4bde02593e91a6b16e1daa2163f32.zip
Test for counter retrieval.
Diffstat (limited to 'src/perfcnt/mod.rs')
-rw-r--r--src/perfcnt/mod.rs11
1 files changed, 10 insertions, 1 deletions
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