Skip to content
Open
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
6 changes: 4 additions & 2 deletions src/cli/exec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ fn build_orchestrator_config(
poll_results_options: PollResultsOptions,
) -> Result<OrchestratorConfig> {
let modes = args.shared.resolve_modes()?;
let cycle_estimation = args.shared.resolve_cycle_estimation();
let exclude_allocations = args.shared.resolve_exclude_allocations();
let raw_upload_url = args
.shared
.upload_url
Expand Down Expand Up @@ -90,8 +92,8 @@ fn build_orchestrator_config(
poll_results_options,
extra_env: HashMap::new(),
fair_sched: args.shared.experimental.experimental_fair_sched,
cycle_estimation: args.shared.cycle_estimation,
exclude_allocations: args.shared.exclude_allocations,
cycle_estimation,
exclude_allocations,
simulation_track_subprocess: args.shared.simulation_track_subprocess,
memory_track_physical: args.shared.experimental.experimental_memory_track_physical,
})
Expand Down
20 changes: 7 additions & 13 deletions src/cli/experimental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ pub struct ExperimentalArgs {
)]
pub experimental_memory_track_physical: bool,

/// Deprecated: cycle estimation is enabled by default and this flag has no effect.
/// Deprecated alias for `--cycle-estimation`, still honored for now.
#[arg(long, hide = true, env = "CODSPEED_EXPERIMENTAL_CYCLE_ESTIMATION")]
pub experimental_cycle_estimation: bool,

/// Deprecated: allocation exclusion is controlled by `--exclude-allocations` and this flag has no effect.
/// Deprecated alias for `--exclude-allocations`, still honored for now.
#[arg(long, hide = true, env = "CODSPEED_EXPERIMENTAL_EXCLUDE_ALLOCATIONS")]
pub experimental_exclude_allocations: bool,
}
Expand Down Expand Up @@ -72,31 +72,25 @@ impl ExperimentalArgs {
);
}

/// Warns about deprecated flags that were graduated to default-on options and
/// no longer have any effect.
/// Warns about deprecated flags that graduated to stable options. They are still
/// honored, but will be removed in a future release.
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 {}.",
style(Icon::Warning.to_string()).yellow(),
style(*flag).bold(),
feature,
style(*new_flag).bold(),
for (_, flag, new_flag) in deprecated.iter().filter(|(set, ..)| *set) {
log::warn!(
"{flag} is deprecated and will be removed in a future release: use {new_flag} instead."
);
}
}
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 @@ -101,6 +101,8 @@ fn build_orchestrator_config(
) -> Result<OrchestratorConfig> {
let instruments = Instruments::try_from(&args)?;
let modes = args.shared.resolve_modes()?;
let cycle_estimation = args.shared.resolve_cycle_estimation();
let exclude_allocations = args.shared.resolve_exclude_allocations();
let raw_upload_url = args
.shared
.upload_url
Expand Down Expand Up @@ -133,8 +135,8 @@ fn build_orchestrator_config(
poll_results_options,
extra_env: HashMap::new(),
fair_sched: args.shared.experimental.experimental_fair_sched,
cycle_estimation: args.shared.cycle_estimation,
exclude_allocations: args.shared.exclude_allocations,
cycle_estimation,
exclude_allocations,
simulation_track_subprocess: args.shared.simulation_track_subprocess,
memory_track_physical: args.shared.experimental.experimental_memory_track_physical,
})
Expand Down
12 changes: 12 additions & 0 deletions src/cli/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ impl ExecAndRunSharedArgs {

Ok(modes)
}

/// Resolves cycle estimation, honoring the deprecated
/// `--experimental-cycle-estimation` alias.
pub fn resolve_cycle_estimation(&self) -> bool {
self.cycle_estimation || self.experimental.experimental_cycle_estimation
Comment thread
not-matthias marked this conversation as resolved.
}

/// Resolves allocation exclusion, honoring the deprecated
/// `--experimental-exclude-allocations` alias.
pub fn resolve_exclude_allocations(&self) -> bool {
self.exclude_allocations || self.experimental.experimental_exclude_allocations
}
}

#[derive(Debug, Copy, Clone, PartialEq, ValueEnum, Default)]
Expand Down