Skip to content

Commit 5e9a938

Browse files
committed
feat: add protocol version
1 parent 67f2644 commit 5e9a938

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

  • crates/runner-shared/src
  • src/run/runner/wall_time/perf

crates/runner-shared/src/fifo.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
pub const RUNNER_CTL_FIFO: &str = "/tmp/runner.ctl.fifo";
44
pub const RUNNER_ACK_FIFO: &str = "/tmp/runner.ack.fifo";
55

6+
pub const CURRENT_PROTOCOL_VERSION: u64 = 1;
7+
68
/// The different markers that can be set in the perf.data.
79
///
810
/// `SampleStart/End`: Marks the start and end of a sampling period. This is used to differentiate between benchmarks.
@@ -27,4 +29,5 @@ pub enum Command {
2729
SetIntegration { name: String, version: String },
2830
Err,
2931
AddMarker { pid: u32, marker: MarkerType },
32+
SetVersion(u64),
3033
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,15 @@ impl PerfRunner {
337337
markers.push(marker);
338338
runner_fifo.send_cmd(FifoCommand::Ack).await?;
339339
}
340+
FifoCommand::SetVersion(protocol_version) => {
341+
if protocol_version != runner_shared::fifo::CURRENT_PROTOCOL_VERSION {
342+
panic!(
343+
"Integration is outdated, please update the codspeed integration to the latest version."
344+
);
345+
}
346+
347+
runner_fifo.send_cmd(FifoCommand::Ack).await?;
348+
}
340349
_ => {
341350
warn!("Received unexpected command: {cmd:?}");
342351
runner_fifo.send_cmd(FifoCommand::Err).await?;

0 commit comments

Comments
 (0)