Skip to content

Commit 4068b2b

Browse files
committed
Revert "[HACK] dump total instructions-minus-irqs:u for statistics."
This reverts commit 451373a.
1 parent 451373a commit 4068b2b

File tree

2 files changed

+11
-33
lines changed

2 files changed

+11
-33
lines changed

measureme/src/counters.rs

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,21 @@ macro_rules! really_warn {
1111
}
1212

1313
pub enum Counter {
14-
Zero(InstructionsMinusIrqs),
15-
WallTime(InstructionsMinusIrqs, WallTime),
16-
Instructions(InstructionsMinusIrqs, Instructions),
14+
WallTime(WallTime),
15+
Instructions(Instructions),
1716
InstructionsMinusIrqs(InstructionsMinusIrqs),
1817
InstructionsMinusRaw0420(InstructionsMinusRaw0420),
1918
}
2019

2120
impl Counter {
2221
pub fn by_name(name: &str) -> Result<Self, Box<dyn Error + Send + Sync>> {
2322
Ok(match name {
24-
"0" => Counter::Zero(InstructionsMinusIrqs::new()?),
25-
"t" | WallTime::NAME => {
26-
Counter::WallTime(InstructionsMinusIrqs::new()?, WallTime::new())
27-
}
28-
"i" | Instructions::NAME => {
29-
Counter::Instructions(InstructionsMinusIrqs::new()?, Instructions::new()?)
30-
}
31-
"I" | InstructionsMinusIrqs::NAME => {
23+
WallTime::NAME => Counter::WallTime(WallTime::new()),
24+
Instructions::NAME => Counter::Instructions(Instructions::new()?),
25+
InstructionsMinusIrqs::NAME => {
3226
Counter::InstructionsMinusIrqs(InstructionsMinusIrqs::new()?)
3327
}
34-
"r" | InstructionsMinusRaw0420::NAME => {
28+
InstructionsMinusRaw0420::NAME => {
3529
Counter::InstructionsMinusRaw0420(InstructionsMinusRaw0420::new()?)
3630
}
3731
_ => return Err(format!("{:?} is not a valid counter name", name).into()),
@@ -40,12 +34,11 @@ impl Counter {
4034

4135
pub(super) fn describe_as_json(&self) -> String {
4236
let (name, units) = match self {
43-
Counter::Zero(_) => ("zero", "[]"),
44-
Counter::WallTime(..) => (
37+
Counter::WallTime(_) => (
4538
WallTime::NAME,
4639
r#"[["ns", 1], ["μs", 1000], ["ms", 1000000], ["s", 1000000000]]"#,
4740
),
48-
Counter::Instructions(..) => (Instructions::NAME, r#"[["instructions", 1]]"#),
41+
Counter::Instructions(_) => (Instructions::NAME, r#"[["instructions", 1]]"#),
4942
Counter::InstructionsMinusIrqs(_) => {
5043
(InstructionsMinusIrqs::NAME, r#"[["instructions", 1]]"#)
5144
}
@@ -59,9 +52,8 @@ impl Counter {
5952
#[inline]
6053
pub(super) fn since_start(&self) -> u64 {
6154
match self {
62-
Counter::Zero(_) => 0,
63-
Counter::WallTime(_, counter) => counter.since_start(),
64-
Counter::Instructions(_, counter) => counter.since_start(),
55+
Counter::WallTime(counter) => counter.since_start(),
56+
Counter::Instructions(counter) => counter.since_start(),
6557
Counter::InstructionsMinusIrqs(counter) => counter.since_start(),
6658
Counter::InstructionsMinusRaw0420(counter) => counter.since_start(),
6759
}
@@ -140,17 +132,6 @@ impl InstructionsMinusIrqs {
140132
}
141133
}
142134

143-
// HACK(eddyb) dump total `instructions-minus-irqs:u` for statistics.
144-
impl Drop for InstructionsMinusIrqs {
145-
fn drop(&mut self) {
146-
eprintln!(
147-
"pid={:06} instructions-minus-irqs:u={}",
148-
std::process::id(),
149-
self.since_start(),
150-
);
151-
}
152-
}
153-
154135
// HACK(eddyb) this is a variant of `instructions-minus-irqs:u`, where `r0420`
155136
// is subtracted, instead of the usual "hardware interrupts" (aka IRQs).
156137
// `r0420` is an undocumented counter on AMD Zen CPUs which appears to count

measureme/src/profiler.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ impl Profiler {
1919
pub fn new<P: AsRef<Path>>(path_stem: P) -> Result<Profiler, Box<dyn Error + Send + Sync>> {
2020
Self::with_counter(
2121
path_stem,
22-
Counter::WallTime(
23-
crate::counters::InstructionsMinusIrqs::new()?,
24-
crate::counters::WallTime::new(),
25-
),
22+
Counter::WallTime(crate::counters::WallTime::new()),
2623
)
2724
}
2825

0 commit comments

Comments
 (0)