Skip to content

Commit 0a1f106

Browse files
committed
fixup! feat(walltime): add Profiler trait abstraction
1 parent 17d51d5 commit 0a1f106

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/executor/wall_time/executor.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ async fn run_with_profiler(
214214
config: &ExecutorConfig,
215215
profile_folder: &Path,
216216
) -> Result<std::process::ExitStatus> {
217-
let wrapped = profiler.wrap(cmd_builder, config, profile_folder).await?;
217+
let wrapped = profiler
218+
.wrap_command(cmd_builder, config, profile_folder)
219+
.await?;
218220
let cmd = wrapped.build();
219221
debug!("cmd: {cmd:?}");
220222

src/executor/wall_time/profiler/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub trait Profiler {
3838
/// `CommandBuilder` is what gets spawned. Profilers stash any live state
3939
/// they need for the duration of the run (control fifos, output paths)
4040
/// on `self`.
41-
async fn wrap(
41+
async fn wrap_command(
4242
&mut self,
4343
cmd: CommandBuilder,
4444
config: &ExecutorConfig,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ pub mod perf_executable;
4545
const PERF_PIPEDATA_FILE_NAME: &str = "perf.pipedata";
4646

4747
pub struct PerfProfiler {
48-
/// Set by [`Profiler::wrap`]; used by the FIFO hooks to control event
48+
/// Set by [`Profiler::wrap_command`]; used by the FIFO hooks to control event
4949
/// recording on the live `perf record` process.
5050
perf_fifo: Option<PerfFifo>,
5151

5252
/// Path to the file that the wrapped command pipes `perf record`'s
53-
/// stdout into. Set by [`Profiler::wrap`]; consumed by [`Profiler::finalize`].
53+
/// stdout into. Set by [`Profiler::wrap_command`]; consumed by [`Profiler::finalize`].
5454
perf_file_path: Option<PathBuf>,
5555
}
5656

@@ -65,7 +65,7 @@ impl PerfProfiler {
6565
fn perf_fifo_mut(&mut self) -> anyhow::Result<&mut PerfFifo> {
6666
self.perf_fifo
6767
.as_mut()
68-
.context("PerfProfiler::wrap must be called before FIFO hooks")
68+
.context("PerfProfiler::wrap_command must be called before FIFO hooks")
6969
}
7070
}
7171

@@ -84,7 +84,7 @@ impl Profiler for PerfProfiler {
8484
ensure_linux_profiling_sysctls()
8585
}
8686

87-
async fn wrap(
87+
async fn wrap_command(
8888
&mut self,
8989
mut cmd_builder: CommandBuilder,
9090
config: &ExecutorConfig,
@@ -208,7 +208,7 @@ impl Profiler for PerfProfiler {
208208
let perf_file_path = self
209209
.perf_file_path
210210
.as_ref()
211-
.context("PerfProfiler::wrap must be called before finalize")?;
211+
.context("PerfProfiler::wrap_command must be called before finalize")?;
212212

213213
let bench_data = BenchmarkData {
214214
fifo_data,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const SAMPLY_OUTPUT_FILE_NAME: &str = "samply-profile.json.gz";
2020
const SAMPLY_RATE_HZ: &str = "997";
2121

2222
pub struct SamplyProfiler {
23-
/// Set by [`Profiler::wrap`]. Currently unused after `wrap` returns —
24-
/// samply writes the file itself — but we hold onto it so future
23+
/// Set by [`Profiler::wrap_command`]. Currently unused after `wrap_command`
24+
/// returns — samply writes the file itself — but we hold onto it so future
2525
/// `finalize` work (e.g. validation, conversion) has the path on hand.
2626
output_path: Option<PathBuf>,
2727
}
@@ -42,7 +42,7 @@ impl Profiler for SamplyProfiler {
4242
ensure_linux_profiling_sysctls()
4343
}
4444

45-
async fn wrap(
45+
async fn wrap_command(
4646
&mut self,
4747
mut cmd_builder: CommandBuilder,
4848
_config: &ExecutorConfig,

0 commit comments

Comments
 (0)