diff --git a/src/cli/exec/mod.rs b/src/cli/exec/mod.rs index 82192133f..6d51f800e 100644 --- a/src/cli/exec/mod.rs +++ b/src/cli/exec/mod.rs @@ -97,6 +97,7 @@ fn build_orchestrator_config( poll_results_options, extra_env: HashMap::new(), fair_sched: args.shared.experimental.experimental_fair_sched, + rep_bulk_cost: args.shared.experimental.experimental_rep_bulk_cost, cycle_estimation, exclude_allocations, simulation_track_subprocess: args.shared.simulation_track_subprocess, diff --git a/src/cli/experimental.rs b/src/cli/experimental.rs index ec3155682..56523d192 100644 --- a/src/cli/experimental.rs +++ b/src/cli/experimental.rs @@ -17,6 +17,16 @@ pub struct ExperimentalArgs { )] pub experimental_fair_sched: bool, + /// Enable valgrind's calibrated `rep movs`/`rep stos` cost model (--rep-bulk-cost). + /// Only applies with --cycle-estimation. + #[arg( + long, + default_value_t = false, + help_heading = "Experimental", + env = "CODSPEED_EXPERIMENTAL_REP_BULK_COST" + )] + pub experimental_rep_bulk_cost: bool, + /// Do not set PYTHONMALLOC for simulation runs. #[arg( long, @@ -66,6 +76,9 @@ impl ExperimentalArgs { if self.experimental_fair_sched { flags.push("--experimental-fair-sched"); } + if self.experimental_rep_bulk_cost { + flags.push("--experimental-rep-bulk-cost"); + } if self.experimental_disable_pythonmalloc_override { flags.push("--experimental-disable-pythonmalloc-override"); } diff --git a/src/cli/run/mod.rs b/src/cli/run/mod.rs index 6d25e1470..25c0843af 100644 --- a/src/cli/run/mod.rs +++ b/src/cli/run/mod.rs @@ -84,6 +84,7 @@ impl RunArgs { }, experimental: ExperimentalArgs { experimental_fair_sched: false, + experimental_rep_bulk_cost: false, experimental_memory_capture_stack: None, experimental_cycle_estimation: false, experimental_exclude_allocations: false, @@ -142,6 +143,7 @@ fn build_orchestrator_config( poll_results_options, extra_env: HashMap::new(), fair_sched: args.shared.experimental.experimental_fair_sched, + rep_bulk_cost: args.shared.experimental.experimental_rep_bulk_cost, cycle_estimation, exclude_allocations, simulation_track_subprocess: args.shared.simulation_track_subprocess, diff --git a/src/executor/config.rs b/src/executor/config.rs index 3c50e5858..21d99bc44 100644 --- a/src/executor/config.rs +++ b/src/executor/config.rs @@ -113,6 +113,8 @@ pub struct OrchestratorConfig { pub extra_env: HashMap, /// Enable valgrind's --fair-sched option. pub fair_sched: bool, + /// Enable valgrind's --rep-bulk-cost option. + pub rep_bulk_cost: bool, /// Enable valgrind's --cycle-estimation option. pub cycle_estimation: bool, /// Signal the backend to exclude memory allocation time from simulation results. @@ -160,6 +162,8 @@ pub struct ExecutorConfig { pub enable_introspection: bool, /// Enable valgrind's --fair-sched option. pub fair_sched: bool, + /// Enable valgrind's --rep-bulk-cost option. + pub rep_bulk_cost: bool, /// Enable valgrind's --cycle-estimation option. pub cycle_estimation: bool, /// Signal the backend to exclude memory allocation time from simulation results. @@ -246,6 +250,7 @@ impl OrchestratorConfig { extra_env: self.extra_env.clone(), enable_introspection: !uses_exec_harness, fair_sched: self.fair_sched, + rep_bulk_cost: self.rep_bulk_cost, cycle_estimation: self.cycle_estimation, exclude_allocations: self.exclude_allocations, simulation_track_subprocess: self.simulation_track_subprocess || uses_exec_harness, @@ -284,6 +289,7 @@ impl OrchestratorConfig { poll_results_options: PollResultsOptions::new(false, None), extra_env: HashMap::new(), fair_sched: false, + rep_bulk_cost: false, cycle_estimation: true, exclude_allocations: false, simulation_track_subprocess: false, diff --git a/src/executor/valgrind/measure.rs b/src/executor/valgrind/measure.rs index 545c796cb..04f51bd9b 100644 --- a/src/executor/valgrind/measure.rs +++ b/src/executor/valgrind/measure.rs @@ -47,6 +47,9 @@ fn get_valgrind_args(tool: &SimulationTool, config: &ExecutorConfig) -> Vec { if config.cycle_estimation { args.push("--cycle-estimation=yes".to_string()); + if config.rep_bulk_cost { + args.push("--rep-bulk-cost=yes".to_string()); + } } args.push("--tool=callgrind".to_string());