Skip to content

Commit 9e21a9c

Browse files
feat: use extra events when using samply on linux
1 parent 5c3fd1c commit 9e21a9c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

  • src/executor/wall_time/profiler/samply

src/executor/wall_time/profiler/samply/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ impl Profiler for SamplyProfiler {
113113
),
114114
]);
115115

116+
// Extra hardware events to capture alongside the sampling event,
117+
// stored by samply as per-sample delta columns in the profile, as
118+
// `<name>:<type>:<config>` specs resolved for the CPU we run on.
119+
// samply degrades gracefully to cycles-only sampling when the PMU
120+
// can't deliver them, so this is safe to request unconditionally.
121+
// Linux only: the events go through perf_event_open.
122+
#[cfg(target_os = "linux")]
123+
cmd_builder.env(
124+
"SAMPLY_PERF_EVENTS",
125+
runner_shared::perf_event::PerfEvent::all_events()
126+
.iter()
127+
.filter_map(|event| event.to_samply_spec())
128+
.join(","),
129+
);
130+
116131
// If `setup` decided the bash on PATH is Apple-signed, prepend brew's
117132
// bin so samply's spawned shell resolves to the ad-hoc-signed brew bash
118133
// instead. Only the samply child's PATH is touched.

0 commit comments

Comments
 (0)