From 34e335741cfa2c4e67818b964aa216d4725cd71e Mon Sep 17 00:00:00 2001 From: not-matthias Date: Wed, 17 Jun 2026 18:33:59 +0200 Subject: [PATCH] feat(runner): add experimental --cycle-estimation flag --- src/cli/exec/mod.rs | 1 + src/cli/experimental.rs | 13 +++++++++++++ src/cli/run/mod.rs | 2 ++ src/executor/config.rs | 6 ++++++ src/executor/valgrind/measure.rs | 5 +++++ 5 files changed, 27 insertions(+) diff --git a/src/cli/exec/mod.rs b/src/cli/exec/mod.rs index 3aebddd1..f006bddf 100644 --- a/src/cli/exec/mod.rs +++ b/src/cli/exec/mod.rs @@ -89,6 +89,7 @@ fn build_orchestrator_config( poll_results_options, extra_env: HashMap::new(), fair_sched: args.shared.experimental.experimental_fair_sched, + cycle_estimation: args.shared.experimental.cycle_estimation, }) } diff --git a/src/cli/experimental.rs b/src/cli/experimental.rs index fdebba20..e1d060b2 100644 --- a/src/cli/experimental.rs +++ b/src/cli/experimental.rs @@ -16,6 +16,16 @@ pub struct ExperimentalArgs { env = "CODSPEED_EXPERIMENTAL_FAIR_SCHED" )] pub experimental_fair_sched: bool, + + /// Enable Valgrind cycle estimation (--cycle-estimation) in simulation mode. + #[arg( + long, + default_value_t = false, + action = clap::ArgAction::Set, + help_heading = "Experimental", + env = "CODSPEED_CYCLE_ESTIMATION" + )] + pub cycle_estimation: bool, } impl ExperimentalArgs { @@ -25,6 +35,9 @@ impl ExperimentalArgs { if self.experimental_fair_sched { flags.push("--experimental-fair-sched"); } + if self.cycle_estimation { + flags.push("--cycle-estimation"); + } flags } diff --git a/src/cli/run/mod.rs b/src/cli/run/mod.rs index ff1e2e7f..6c9d5ebf 100644 --- a/src/cli/run/mod.rs +++ b/src/cli/run/mod.rs @@ -78,6 +78,7 @@ impl RunArgs { }, experimental: ExperimentalArgs { experimental_fair_sched: false, + cycle_estimation: false, }, }, instruments: vec![], @@ -127,6 +128,7 @@ fn build_orchestrator_config( poll_results_options, extra_env: HashMap::new(), fair_sched: args.shared.experimental.experimental_fair_sched, + cycle_estimation: args.shared.experimental.cycle_estimation, }) } diff --git a/src/executor/config.rs b/src/executor/config.rs index 8934d898..3fcdfb6a 100644 --- a/src/executor/config.rs +++ b/src/executor/config.rs @@ -91,6 +91,8 @@ pub struct OrchestratorConfig { pub extra_env: HashMap, /// Enable valgrind's --fair-sched option. pub fair_sched: bool, + /// Enable valgrind's --cycle-estimation option. + pub cycle_estimation: bool, } /// Per-execution configuration passed to executors. @@ -124,6 +126,8 @@ pub struct ExecutorConfig { pub enable_introspection: bool, /// Enable valgrind's --fair-sched option. pub fair_sched: bool, + /// Enable valgrind's --cycle-estimation option. + pub cycle_estimation: bool, } #[derive(Debug, Clone, PartialEq)] @@ -193,6 +197,7 @@ impl OrchestratorConfig { extra_env: self.extra_env.clone(), enable_introspection, fair_sched: self.fair_sched, + cycle_estimation: self.cycle_estimation, } } } @@ -225,6 +230,7 @@ impl OrchestratorConfig { poll_results_options: PollResultsOptions::new(false, None), extra_env: HashMap::new(), fair_sched: false, + cycle_estimation: false, } } } diff --git a/src/executor/valgrind/measure.rs b/src/executor/valgrind/measure.rs index 1a8e16ff..5b257083 100644 --- a/src/executor/valgrind/measure.rs +++ b/src/executor/valgrind/measure.rs @@ -34,6 +34,11 @@ fn get_valgrind_args(tool: &SimulationTool, config: &ExecutorConfig) -> Vec { args.push("--tool=callgrind".to_string());