Skip to content

Commit f5575eb

Browse files
feat!: make perf enabled by default
1 parent ed9652d commit f5575eb

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/run/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ pub enum UnwindingMode {
5050

5151
#[derive(Args, Debug, Clone)]
5252
pub struct PerfRunArgs {
53-
/// Enable the performance runner, which uses `perf` to collect performance data.
53+
/// Enable the linux perf profiler to collect granular performance data.
5454
/// This is only supported on Linux.
55-
#[arg(long, env = "CODSPEED_PERF_ENABLED", default_value_t = false)]
55+
#[arg(long, env = "CODSPEED_PERF_ENABLED", default_value_t = true)]
5656
enable_perf: bool,
5757

5858
/// The unwinding mode that should be used with perf to collect the call stack.

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,13 @@ impl PerfRunner {
206206
harvest_perf_maps_for_pids(profile_folder, &perf_map_pids).await?;
207207

208208
// Append perf maps, unwind info and other metadata
209-
bench_data.save_to(profile_folder).unwrap();
209+
if let Err(BenchmarkDataSaveError::MissingIntegration) = bench_data.save_to(profile_folder)
210+
{
211+
warn!(
212+
"Perf is enabled, but failed to detect benchmarks. If you wish to disable this warning, set CODSPEED_PERF_ENABLED=false"
213+
);
214+
return Ok(());
215+
}
210216

211217
let elapsed = start.elapsed();
212218
debug!("Perf teardown took: {elapsed:?}");
@@ -371,8 +377,16 @@ pub struct BenchmarkData {
371377
unwind_data_by_pid: HashMap<u32, Vec<UnwindData>>,
372378
}
373379

380+
#[derive(Debug)]
381+
pub enum BenchmarkDataSaveError {
382+
MissingIntegration,
383+
}
384+
374385
impl BenchmarkData {
375-
pub fn save_to<P: AsRef<std::path::Path>>(&self, path: P) -> anyhow::Result<()> {
386+
pub fn save_to<P: AsRef<std::path::Path>>(
387+
&self,
388+
path: P,
389+
) -> Result<(), BenchmarkDataSaveError> {
376390
for proc_sym in self.symbols_by_pid.values() {
377391
proc_sym.save_to(&path).unwrap();
378392
}
@@ -387,7 +401,7 @@ impl BenchmarkData {
387401
integration: self
388402
.integration
389403
.clone()
390-
.context("Couldn't find integration metadata")?,
404+
.ok_or(BenchmarkDataSaveError::MissingIntegration)?,
391405
bench_order_by_pid: self.bench_order_by_pid.clone(),
392406
ignored_modules: {
393407
let mut to_ignore = vec![];

0 commit comments

Comments
 (0)