Skip to content
Draft
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
1 change: 1 addition & 0 deletions src/cli/exec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}

Expand Down
13 changes: 13 additions & 0 deletions src/cli/experimental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions src/cli/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl RunArgs {
},
experimental: ExperimentalArgs {
experimental_fair_sched: false,
cycle_estimation: false,
},
},
instruments: vec![],
Expand Down Expand Up @@ -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,
})
}

Expand Down
6 changes: 6 additions & 0 deletions src/executor/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ pub struct OrchestratorConfig {
pub extra_env: HashMap<String, String>,
/// 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.
Expand Down Expand Up @@ -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)]
Expand Down Expand Up @@ -193,6 +197,7 @@ impl OrchestratorConfig {
extra_env: self.extra_env.clone(),
enable_introspection,
fair_sched: self.fair_sched,
cycle_estimation: self.cycle_estimation,
}
}
}
Expand Down Expand Up @@ -225,6 +230,7 @@ impl OrchestratorConfig {
poll_results_options: PollResultsOptions::new(false, None),
extra_env: HashMap::new(),
fair_sched: false,
cycle_estimation: false,
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/executor/valgrind/measure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ fn get_valgrind_args(tool: &SimulationTool, config: &ExecutorConfig) -> Vec<Stri
.map(|x| x.to_string())
.collect();

args.push(format!(
"--cycle-estimation={}",
if config.cycle_estimation { "yes" } else { "no" }
));

match tool {
SimulationTool::Callgrind => {
args.push("--tool=callgrind".to_string());
Expand Down
Loading