Skip to content

Commit 13499ef

Browse files
committed
feat: enable cycle estimation and allocation exclusion by default
Graduate --cycle-estimation and --exclude-allocations out of the experimental flag set. They are now normal, default-on options that can be disabled with --cycle-estimation=false / --exclude-allocations=false (env: CODSPEED_CYCLE_ESTIMATION, CODSPEED_EXCLUDE_ALLOCATIONS). --experimental-fair-sched remains experimental.
1 parent c17b77f commit 13499ef

6 files changed

Lines changed: 61 additions & 26 deletions

File tree

src/cli/exec/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ fn build_orchestrator_config(
8989
poll_results_options,
9090
extra_env: HashMap::new(),
9191
fair_sched: args.shared.experimental.experimental_fair_sched,
92-
cycle_estimation: args.shared.experimental.experimental_cycle_estimation,
93-
exclude_allocations: args.shared.experimental.experimental_exclude_allocations,
92+
cycle_estimation: args.shared.cycle_estimation,
93+
exclude_allocations: args.shared.exclude_allocations,
9494
})
9595
}
9696

src/cli/experimental.rs

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,12 @@ pub struct ExperimentalArgs {
1717
)]
1818
pub experimental_fair_sched: bool,
1919

20-
/// Enable Valgrind cycle estimation (--cycle-estimation) in simulation mode.
21-
#[arg(
22-
long,
23-
default_value_t = false,
24-
help_heading = "Experimental",
25-
env = "CODSPEED_EXPERIMENTAL_CYCLE_ESTIMATION"
26-
)]
20+
/// Deprecated: cycle estimation is enabled by default and this flag has no effect.
21+
#[arg(long, hide = true, env = "CODSPEED_EXPERIMENTAL_CYCLE_ESTIMATION")]
2722
pub experimental_cycle_estimation: bool,
2823

29-
/// Exclude memory allocation time from simulation results.
30-
#[arg(
31-
long,
32-
default_value_t = false,
33-
help_heading = "Experimental",
34-
env = "CODSPEED_EXPERIMENTAL_EXCLUDE_ALLOCATIONS"
35-
)]
24+
/// Deprecated: allocation exclusion is enabled by default and this flag has no effect.
25+
#[arg(long, hide = true, env = "CODSPEED_EXPERIMENTAL_EXCLUDE_ALLOCATIONS")]
3626
pub experimental_exclude_allocations: bool,
3727
}
3828

@@ -43,12 +33,6 @@ impl ExperimentalArgs {
4333
if self.experimental_fair_sched {
4434
flags.push("--experimental-fair-sched");
4535
}
46-
if self.experimental_cycle_estimation {
47-
flags.push("--experimental-cycle-estimation");
48-
}
49-
if self.experimental_exclude_allocations {
50-
flags.push("--experimental-exclude-allocations");
51-
}
5236
flags
5337
}
5438

@@ -74,4 +58,33 @@ impl ExperimentalArgs {
7458
style("https://github.com/CodSpeedHQ/codspeed/issues").underlined(),
7559
);
7660
}
61+
62+
/// Warns about deprecated flags that were graduated to default-on options and
63+
/// no longer have any effect.
64+
pub fn warn_if_deprecated(&self) {
65+
let deprecated = [
66+
(
67+
self.experimental_cycle_estimation,
68+
"--experimental-cycle-estimation",
69+
"cycle estimation",
70+
"--cycle-estimation=false",
71+
),
72+
(
73+
self.experimental_exclude_allocations,
74+
"--experimental-exclude-allocations",
75+
"allocation exclusion",
76+
"--exclude-allocations=false",
77+
),
78+
];
79+
80+
for (_, flag, feature, disable) in deprecated.iter().filter(|(set, ..)| *set) {
81+
eprintln!(
82+
" {} {} has no effect: {} is now enabled by default. Use {} to disable.",
83+
style(Icon::Warning.to_string()).yellow(),
84+
style(*flag).bold(),
85+
feature,
86+
style(*disable).bold(),
87+
);
88+
}
89+
}
7790
}

src/cli/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ pub async fn run() -> Result<()> {
161161
.upload_url
162162
.get_or_insert_with(|| codspeed_config.upload_url.clone());
163163
args.shared.experimental.warn_if_active();
164+
args.shared.experimental.warn_if_deprecated();
164165
run::run(
165166
args,
166167
&mut api_client,
@@ -175,6 +176,7 @@ pub async fn run() -> Result<()> {
175176
.upload_url
176177
.get_or_insert_with(|| codspeed_config.upload_url.clone());
177178
args.shared.experimental.warn_if_active();
179+
args.shared.experimental.warn_if_deprecated();
178180
exec::run(
179181
args,
180182
&mut api_client,

src/cli/run/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ impl RunArgs {
6969
go_runner_version: None,
7070
show_full_output: false,
7171
base: None,
72+
cycle_estimation: true,
73+
exclude_allocations: true,
7274
profiler_run_args: ProfilerRunArgs {
7375
enable_profiler: false,
7476
enable_perf: None,
@@ -129,8 +131,8 @@ fn build_orchestrator_config(
129131
poll_results_options,
130132
extra_env: HashMap::new(),
131133
fair_sched: args.shared.experimental.experimental_fair_sched,
132-
cycle_estimation: args.shared.experimental.experimental_cycle_estimation,
133-
exclude_allocations: args.shared.experimental.experimental_exclude_allocations,
134+
cycle_estimation: args.shared.cycle_estimation,
135+
exclude_allocations: args.shared.exclude_allocations,
134136
})
135137
}
136138

src/cli/shared.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,24 @@ pub struct ExecAndRunSharedArgs {
113113
#[arg(long)]
114114
pub base: Option<String>,
115115

116+
/// Enable Valgrind cycle estimation (--cycle-estimation) in simulation mode.
117+
#[arg(
118+
long,
119+
env = "CODSPEED_CYCLE_ESTIMATION",
120+
default_value_t = true,
121+
action = clap::ArgAction::Set
122+
)]
123+
pub cycle_estimation: bool,
124+
125+
/// Exclude memory allocation time from simulation results.
126+
#[arg(
127+
long,
128+
env = "CODSPEED_EXCLUDE_ALLOCATIONS",
129+
default_value_t = true,
130+
action = clap::ArgAction::Set
131+
)]
132+
pub exclude_allocations: bool,
133+
116134
#[command(flatten)]
117135
pub profiler_run_args: ProfilerRunArgs,
118136

src/executor/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ impl OrchestratorConfig {
235235
poll_results_options: PollResultsOptions::new(false, None),
236236
extra_env: HashMap::new(),
237237
fair_sched: false,
238-
cycle_estimation: false,
239-
exclude_allocations: false,
238+
cycle_estimation: true,
239+
exclude_allocations: true,
240240
}
241241
}
242242
}

0 commit comments

Comments
 (0)