Skip to content

Commit a4ac960

Browse files
committed
fix: dont start perf unless it's not already started
1 parent 9428766 commit a4ac960

File tree

1 file changed

+14
-0
lines changed
  • src/run/runner/wall_time/perf

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ impl PerfRunner {
294294
.num_nanoseconds() as u64
295295
};
296296

297+
let mut benchmark_started = false;
297298
loop {
298299
let perf_ping =
299300
tokio::time::timeout(Duration::from_secs(perf_ping_timeout), perf_fifo.ping())
@@ -334,12 +335,25 @@ impl PerfRunner {
334335
runner_fifo.send_cmd(FifoCommand::Ack).await?;
335336
}
336337
FifoCommand::StartBenchmark => {
338+
if benchmark_started {
339+
warn!("Received duplicate StartBenchmark command, ignoring");
340+
runner_fifo.send_cmd(FifoCommand::Ack).await?;
341+
continue;
342+
}
343+
benchmark_started = true;
337344
markers.push(MarkerType::SampleStart(current_time()));
338345

339346
perf_fifo.start_events().await?;
340347
runner_fifo.send_cmd(FifoCommand::Ack).await?;
341348
}
342349
FifoCommand::StopBenchmark => {
350+
if !benchmark_started {
351+
warn!("Received StopBenchmark command before StartBenchmark, ignoring");
352+
runner_fifo.send_cmd(FifoCommand::Ack).await?;
353+
continue;
354+
}
355+
benchmark_started = false;
356+
343357
markers.push(MarkerType::SampleEnd(current_time()));
344358

345359
perf_fifo.stop_events().await?;

0 commit comments

Comments
 (0)