diff --git a/src/cli/exec/mod.rs b/src/cli/exec/mod.rs index 01bdd6da..5ae0692a 100644 --- a/src/cli/exec/mod.rs +++ b/src/cli/exec/mod.rs @@ -90,8 +90,8 @@ fn build_orchestrator_config( poll_results_options, extra_env: HashMap::new(), fair_sched: args.shared.experimental.experimental_fair_sched, - cycle_estimation: args.shared.experimental.experimental_cycle_estimation, - exclude_allocations: args.shared.experimental.experimental_exclude_allocations, + cycle_estimation: args.shared.cycle_estimation, + exclude_allocations: args.shared.exclude_allocations, }) } diff --git a/src/cli/experimental.rs b/src/cli/experimental.rs index b38b9e47..2afb40fa 100644 --- a/src/cli/experimental.rs +++ b/src/cli/experimental.rs @@ -17,22 +17,12 @@ pub struct ExperimentalArgs { )] pub experimental_fair_sched: bool, - /// Enable Valgrind cycle estimation (--cycle-estimation) in simulation mode. - #[arg( - long, - default_value_t = false, - help_heading = "Experimental", - env = "CODSPEED_EXPERIMENTAL_CYCLE_ESTIMATION" - )] + /// Deprecated: cycle estimation is enabled by default and this flag has no effect. + #[arg(long, hide = true, env = "CODSPEED_EXPERIMENTAL_CYCLE_ESTIMATION")] pub experimental_cycle_estimation: bool, - /// Exclude memory allocation time from simulation results. - #[arg( - long, - default_value_t = false, - help_heading = "Experimental", - env = "CODSPEED_EXPERIMENTAL_EXCLUDE_ALLOCATIONS" - )] + /// Deprecated: allocation exclusion is enabled by default and this flag has no effect. + #[arg(long, hide = true, env = "CODSPEED_EXPERIMENTAL_EXCLUDE_ALLOCATIONS")] pub experimental_exclude_allocations: bool, } @@ -43,12 +33,6 @@ impl ExperimentalArgs { if self.experimental_fair_sched { flags.push("--experimental-fair-sched"); } - if self.experimental_cycle_estimation { - flags.push("--experimental-cycle-estimation"); - } - if self.experimental_exclude_allocations { - flags.push("--experimental-exclude-allocations"); - } flags } @@ -74,4 +58,33 @@ impl ExperimentalArgs { style("https://github.com/CodSpeedHQ/codspeed/issues").underlined(), ); } + + /// Warns about deprecated flags that were graduated to default-on options and + /// no longer have any effect. + pub fn warn_if_deprecated(&self) { + let deprecated = [ + ( + self.experimental_cycle_estimation, + "--experimental-cycle-estimation", + "cycle estimation", + "--cycle-estimation", + ), + ( + self.experimental_exclude_allocations, + "--experimental-exclude-allocations", + "allocation exclusion", + "--exclude-allocations", + ), + ]; + + for (_, flag, feature, new_flag) in deprecated.iter().filter(|(set, ..)| *set) { + eprintln!( + " {} {} has no effect: {} is now controlled by {} (defaults to true).", + style(Icon::Warning.to_string()).yellow(), + style(*flag).bold(), + feature, + style(*new_flag).bold(), + ); + } + } } diff --git a/src/cli/mod.rs b/src/cli/mod.rs index dae96ca5..5487b45b 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -171,6 +171,7 @@ pub async fn run() -> Result<()> { .upload_url .get_or_insert_with(|| codspeed_config.upload_url.clone()); args.shared.experimental.warn_if_active(); + args.shared.experimental.warn_if_deprecated(); run::run( args, &mut api_client, @@ -185,6 +186,7 @@ pub async fn run() -> Result<()> { .upload_url .get_or_insert_with(|| codspeed_config.upload_url.clone()); args.shared.experimental.warn_if_active(); + args.shared.experimental.warn_if_deprecated(); exec::run( args, &mut api_client, diff --git a/src/cli/run/mod.rs b/src/cli/run/mod.rs index 03058fd0..d7f9089e 100644 --- a/src/cli/run/mod.rs +++ b/src/cli/run/mod.rs @@ -69,6 +69,8 @@ impl RunArgs { go_runner_version: None, show_full_output: false, base: None, + cycle_estimation: true, + exclude_allocations: true, profiler_run_args: ProfilerRunArgs { enable_profiler: false, enable_perf: None, @@ -129,8 +131,8 @@ fn build_orchestrator_config( poll_results_options, extra_env: HashMap::new(), fair_sched: args.shared.experimental.experimental_fair_sched, - cycle_estimation: args.shared.experimental.experimental_cycle_estimation, - exclude_allocations: args.shared.experimental.experimental_exclude_allocations, + cycle_estimation: args.shared.cycle_estimation, + exclude_allocations: args.shared.exclude_allocations, }) } diff --git a/src/cli/shared.rs b/src/cli/shared.rs index c697881f..1a6db1d6 100644 --- a/src/cli/shared.rs +++ b/src/cli/shared.rs @@ -113,6 +113,24 @@ pub struct ExecAndRunSharedArgs { #[arg(long)] pub base: Option, + /// Enable Valgrind cycle estimation (--cycle-estimation) in simulation mode. + #[arg( + long, + env = "CODSPEED_CYCLE_ESTIMATION", + default_value_t = true, + action = clap::ArgAction::Set + )] + pub cycle_estimation: bool, + + /// Exclude memory allocation time from simulation results. + #[arg( + long, + env = "CODSPEED_EXCLUDE_ALLOCATIONS", + default_value_t = true, + action = clap::ArgAction::Set + )] + pub exclude_allocations: bool, + #[command(flatten)] pub profiler_run_args: ProfilerRunArgs, diff --git a/src/executor/config.rs b/src/executor/config.rs index 0dc40678..b0748d34 100644 --- a/src/executor/config.rs +++ b/src/executor/config.rs @@ -235,8 +235,8 @@ impl OrchestratorConfig { poll_results_options: PollResultsOptions::new(false, None), extra_env: HashMap::new(), fair_sched: false, - cycle_estimation: false, - exclude_allocations: false, + cycle_estimation: true, + exclude_allocations: true, } } } diff --git a/src/upload/interfaces.rs b/src/upload/interfaces.rs index 3b874af3..9c650e6a 100644 --- a/src/upload/interfaces.rs +++ b/src/upload/interfaces.rs @@ -34,8 +34,8 @@ pub struct Runner { /// Whether memory allocation time is excluded from results. Part of the run's /// measurement configuration: runs with different values are not comparable. /// - /// Skipped when `false` so the default payload stays byte-identical to runs - /// without this feature, keeping the metadata hash and version unchanged. + /// Skipped when `false` so the opt-out path (`--exclude-allocations=false`) + /// stays byte-identical to legacy runs that predate this field. #[serde(skip_serializing_if = "std::ops::Not::not")] pub exclude_allocations: bool, #[serde(flatten)]