Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions crates/runner-shared/src/perf_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#[derive(Debug, Clone, Copy)]
pub enum PerfEvent {
CpuCycles,
CacheReferences,
L1DCache,
L2DCache,
CacheMisses,
Instructions,
}
Expand All @@ -11,26 +12,18 @@ impl PerfEvent {
pub fn to_perf_string(&self) -> &'static str {
match self {
PerfEvent::CpuCycles => "cpu-cycles",
PerfEvent::CacheReferences => "cache-references",
PerfEvent::CacheMisses => "cache-misses",
PerfEvent::L1DCache => "l1d_cache",
PerfEvent::L2DCache => "l2d_cache",
PerfEvent::CacheMisses => "l2d_cache_refill",
PerfEvent::Instructions => "instructions",
}
}

pub fn from_perf_string(event: &str) -> Option<PerfEvent> {
match event {
"cpu-cycles" => Some(PerfEvent::CpuCycles),
"cache-references" => Some(PerfEvent::CacheReferences),
"cache-misses" => Some(PerfEvent::CacheMisses),
"instructions" => Some(PerfEvent::Instructions),
_ => None,
}
}

pub fn all_events() -> Vec<PerfEvent> {
vec![
PerfEvent::CpuCycles,
PerfEvent::CacheReferences,
PerfEvent::L1DCache,
PerfEvent::L2DCache,
PerfEvent::CacheMisses,
PerfEvent::Instructions,
]
Expand Down
2 changes: 1 addition & 1 deletion src/executor/wall_time/perf/perf_executable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn get_event_flags(perf_executable: &OsString) -> anyhow::Result<Option<Stri

if !missing_events.is_empty() {
warn!(
"Not all required perf events available. Missing: [{}], using default events",
"Not all required perf events available. Missing: [{}], disabling detailed event sampling.",
missing_events.into_iter().join(", ")
);
return Ok(None);
Expand Down
Loading