Skip to content

Commit 3ef317d

Browse files
feat: add l2d cache events to perf command
1 parent 7ad6ef7 commit 3ef317d

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

crates/runner-shared/src/perf_event.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#[derive(Debug, Clone, Copy)]
33
pub enum PerfEvent {
44
CpuCycles,
5-
CacheReferences,
5+
L1DCache,
6+
L2DCache,
67
CacheMisses,
78
Instructions,
89
}
@@ -11,26 +12,18 @@ impl PerfEvent {
1112
pub fn to_perf_string(&self) -> &'static str {
1213
match self {
1314
PerfEvent::CpuCycles => "cpu-cycles",
14-
PerfEvent::CacheReferences => "cache-references",
15-
PerfEvent::CacheMisses => "cache-misses",
15+
PerfEvent::L1DCache => "l1d_cache",
16+
PerfEvent::L2DCache => "l2d_cache",
17+
PerfEvent::CacheMisses => "l2d_cache_refill",
1618
PerfEvent::Instructions => "instructions",
1719
}
1820
}
1921

20-
pub fn from_perf_string(event: &str) -> Option<PerfEvent> {
21-
match event {
22-
"cpu-cycles" => Some(PerfEvent::CpuCycles),
23-
"cache-references" => Some(PerfEvent::CacheReferences),
24-
"cache-misses" => Some(PerfEvent::CacheMisses),
25-
"instructions" => Some(PerfEvent::Instructions),
26-
_ => None,
27-
}
28-
}
29-
3022
pub fn all_events() -> Vec<PerfEvent> {
3123
vec![
3224
PerfEvent::CpuCycles,
33-
PerfEvent::CacheReferences,
25+
PerfEvent::L1DCache,
26+
PerfEvent::L2DCache,
3427
PerfEvent::CacheMisses,
3528
PerfEvent::Instructions,
3629
]

src/executor/wall_time/perf/perf_executable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub fn get_event_flags(perf_executable: &OsString) -> anyhow::Result<Option<Stri
104104

105105
if !missing_events.is_empty() {
106106
warn!(
107-
"Not all required perf events available. Missing: [{}], using default events",
107+
"Not all required perf events available. Missing: [{}], disabling detailed event sampling.",
108108
missing_events.into_iter().join(", ")
109109
);
110110
return Ok(None);

0 commit comments

Comments
 (0)