Skip to content

Commit 56e27df

Browse files
committed
refactor: rename Benchmark FIFO commands/markers to Profiler/Round
Rename `StartBenchmark`/`StopBenchmark` to `StartProfiler`/`StopProfiler` and `BenchmarkStart`/`BenchmarkEnd` markers to `RoundStart`/`RoundEnd` to match the profiler-agnostic data format.
1 parent cdc098a commit 56e27df

6 files changed

Lines changed: 19 additions & 19 deletions

File tree

crates/runner-shared/src/fifo.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ const _: () = assert!(
1818
/// The different markers that can be set in the perf.data.
1919
///
2020
/// `SampleStart/End`: Marks the start and end of a sampling period. This is used to differentiate between benchmarks.
21-
/// `BenchmarkStart/End`: Marks the start and end of a benchmark. This is used to measure the duration of a benchmark, without the benchmark harness code.
21+
/// `RoundStart/End`: Marks the start and end of a measured round. This is used to measure the duration of a benchmark, without the benchmark harness code.
2222
#[derive(
2323
serde::Serialize, serde::Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone,
2424
)]
2525
pub enum MarkerType {
2626
SampleStart(u64),
2727
SampleEnd(u64),
28-
BenchmarkStart(u64),
29-
BenchmarkEnd(u64),
28+
RoundStart(u64),
29+
RoundEnd(u64),
3030
}
3131

3232
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
@@ -42,8 +42,8 @@ pub enum Command {
4242
pid: i32,
4343
uri: String,
4444
},
45-
StartBenchmark,
46-
StopBenchmark,
45+
StartProfiler,
46+
StopProfiler,
4747
Ack,
4848
#[deprecated(note = "Use `GetIntegrationMode` instead")]
4949
PingProfiler,

src/executor/memory/executor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ impl MemoryExecutor {
207207
);
208208
}
209209
}
210-
FifoCommand::StartBenchmark => {
210+
FifoCommand::StartProfiler => {
211211
debug!("Enabling memtrack via IPC");
212212
if let Err(e) = ipc_client.enable() {
213213
error!("Failed to enable memtrack: {e}");
214214
return Ok(Some(FifoCommand::Err));
215215
}
216216
}
217-
FifoCommand::StopBenchmark => {
217+
FifoCommand::StopProfiler => {
218218
debug!("Disabling memtrack via IPC");
219219
if let Err(e) = ipc_client.disable() {
220220
// There's a chance that memtrack has already exited here, so just log as debug

src/executor/shared/fifo.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,21 +210,21 @@ impl RunnerFifo {
210210
bench_pids.insert(*pid);
211211
self.send_cmd(FifoCommand::Ack).await?;
212212
}
213-
FifoCommand::StartBenchmark => {
213+
FifoCommand::StartProfiler => {
214214
if !benchmark_started {
215215
benchmark_started = true;
216216
markers.push(MarkerType::SampleStart(get_current_time()));
217217
} else {
218-
warn!("Received duplicate StartBenchmark command, ignoring");
218+
warn!("Received duplicate StartProfiler command, ignoring");
219219
}
220220
self.send_cmd(FifoCommand::Ack).await?;
221221
}
222-
FifoCommand::StopBenchmark => {
222+
FifoCommand::StopProfiler => {
223223
if benchmark_started {
224224
benchmark_started = false;
225225
markers.push(MarkerType::SampleEnd(get_current_time()));
226226
} else {
227-
warn!("Received StopBenchmark command before StartBenchmark, ignoring");
227+
warn!("Received StopProfiler command before StartProfiler, ignoring");
228228
}
229229
self.send_cmd(FifoCommand::Ack).await?;
230230
}

src/executor/wall_time/executor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,12 @@ async fn run_with_profiler(
251251

252252
run_command_with_log_pipe_and_callback(cmd, async move |mut child| {
253253
let on_cmd = async |c: &FifoCommand| match c {
254-
FifoCommand::StartBenchmark => {
255-
profiler.on_start_benchmark().await?;
254+
FifoCommand::StartProfiler => {
255+
profiler.on_start_profiler().await?;
256256
Ok(None)
257257
}
258-
FifoCommand::StopBenchmark => {
259-
profiler.on_stop_benchmark().await?;
258+
FifoCommand::StopProfiler => {
259+
profiler.on_stop_profiler().await?;
260260
Ok(None)
261261
}
262262
#[allow(deprecated)]

src/executor/wall_time/profiler/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ pub trait Profiler {
5454
) -> anyhow::Result<CommandBuilder>;
5555

5656
/// The benchmarked process signaled the start of a measured region.
57-
async fn on_start_benchmark(&mut self) -> anyhow::Result<()> {
57+
async fn on_start_profiler(&mut self) -> anyhow::Result<()> {
5858
Ok(())
5959
}
6060

6161
/// The benchmarked process signaled the end of a measured region.
62-
async fn on_stop_benchmark(&mut self) -> anyhow::Result<()> {
62+
async fn on_stop_profiler(&mut self) -> anyhow::Result<()> {
6363
Ok(())
6464
}
6565

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ impl Profiler for PerfProfiler {
187187
Ok(wrapped_builder)
188188
}
189189

190-
async fn on_start_benchmark(&mut self) -> anyhow::Result<()> {
190+
async fn on_start_profiler(&mut self) -> anyhow::Result<()> {
191191
self.perf_fifo_mut()?.start_events().await
192192
}
193193

194-
async fn on_stop_benchmark(&mut self) -> anyhow::Result<()> {
194+
async fn on_stop_profiler(&mut self) -> anyhow::Result<()> {
195195
self.perf_fifo_mut()?.stop_events().await
196196
}
197197

0 commit comments

Comments
 (0)