Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cli/exec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}

Expand Down
53 changes: 33 additions & 20 deletions src/cli/experimental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Comment thread
not-matthias marked this conversation as resolved.

/// 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,
Comment thread
not-matthias marked this conversation as resolved.
Comment thread
not-matthias marked this conversation as resolved.
}

Expand All @@ -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
}

Expand All @@ -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(),
);
}
}
}
2 changes: 2 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions src/cli/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
})
}

Expand Down
18 changes: 18 additions & 0 deletions src/cli/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,24 @@ pub struct ExecAndRunSharedArgs {
#[arg(long)]
pub base: Option<String>,

/// Enable Valgrind cycle estimation (--cycle-estimation) in simulation mode.
#[arg(
long,
env = "CODSPEED_CYCLE_ESTIMATION",
default_value_t = true,
action = clap::ArgAction::Set
Comment thread
not-matthias marked this conversation as resolved.
)]
pub cycle_estimation: bool,
Comment thread
not-matthias marked this conversation as resolved.

/// Exclude memory allocation time from simulation results.
#[arg(
long,
env = "CODSPEED_EXCLUDE_ALLOCATIONS",
default_value_t = true,
Comment thread
not-matthias marked this conversation as resolved.
action = clap::ArgAction::Set
Comment thread
not-matthias marked this conversation as resolved.
)]
pub exclude_allocations: bool,
Comment thread
not-matthias marked this conversation as resolved.

#[command(flatten)]
pub profiler_run_args: ProfilerRunArgs,

Expand Down
4 changes: 2 additions & 2 deletions src/executor/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/upload/interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down