Skip to content

Commit 466fbc5

Browse files
committed
fix: allow perf to be started/resumed
1 parent 3323c5a commit 466fbc5

File tree

1 file changed

+18
-17
lines changed
  • src/run/runner/wall_time/perf

1 file changed

+18
-17
lines changed

src/run/runner/wall_time/perf/mod.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,11 @@ impl PerfRunner {
167167
.unwrap_or(false)
168168
})
169169
.sorted_by_key(|path| path.file_name().unwrap().to_string_lossy().to_string())
170-
// The first perf.data will only contain metadata that is not relevant to the benchmarks. We
171-
// capture the symbols and unwind data separately.
170+
// We split the perf.data in SetExecutedBenchmark which will also split the last
171+
// entry, which will add an extra perf.data file that is empty. We can just skip it.
172+
.rev()
172173
.skip(1)
174+
.rev()
173175
.map(|src_path| {
174176
let profile_folder = profile_folder.clone();
175177
tokio::task::spawn(async move {
@@ -330,19 +332,7 @@ impl PerfRunner {
330332
FifoCommand::CurrentBenchmark { pid, uri } => {
331333
bench_order_by_pid.entry(pid).or_default().push(uri);
332334

333-
#[cfg(target_os = "linux")]
334-
if !symbols_by_pid.contains_key(&pid) && !unwind_data_by_pid.contains_key(&pid)
335-
{
336-
Self::process_memory_mappings(
337-
pid,
338-
&mut symbols_by_pid,
339-
&mut unwind_data_by_pid,
340-
)?;
341-
}
342-
343-
runner_fifo.send_cmd(FifoCommand::Ack).await?;
344-
}
345-
FifoCommand::StartBenchmark => {
335+
// Split the perf.data file
346336
let perf_pid = perf_pid.get_or_init(|| {
347337
let output = std::process::Command::new("sh")
348338
.arg("-c")
@@ -355,10 +345,21 @@ impl PerfRunner {
355345
.parse::<u32>()
356346
.expect("Failed to parse perf pid")
357347
});
358-
359-
// Split the perf.data file
360348
run_with_sudo(&["kill", "-USR2", &perf_pid.to_string()])?;
361349

350+
#[cfg(target_os = "linux")]
351+
if !symbols_by_pid.contains_key(&pid) && !unwind_data_by_pid.contains_key(&pid)
352+
{
353+
Self::process_memory_mappings(
354+
pid,
355+
&mut symbols_by_pid,
356+
&mut unwind_data_by_pid,
357+
)?;
358+
}
359+
360+
runner_fifo.send_cmd(FifoCommand::Ack).await?;
361+
}
362+
FifoCommand::StartBenchmark => {
362363
perf_fifo.start_events().await?;
363364
runner_fifo.send_cmd(FifoCommand::Ack).await?;
364365
}

0 commit comments

Comments
 (0)