Skip to content

Commit d1a60fc

Browse files
feat: forward the fair-sched flag to valgrind
1 parent d41acd7 commit d1a60fc

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

src/cli/exec/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ fn build_orchestrator_config(
8989
show_full_output: args.shared.show_full_output,
9090
poll_results_options,
9191
extra_env: HashMap::new(),
92+
fair_sched: args.shared.experimental.fair_sched,
9293
})
9394
}
9495

src/cli/run/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ fn build_orchestrator_config(
121121
show_full_output: args.shared.show_full_output,
122122
poll_results_options,
123123
extra_env: HashMap::new(),
124+
fair_sched: args.shared.experimental.fair_sched,
124125
})
125126
}
126127

src/executor/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ pub struct OrchestratorConfig {
7979
pub poll_results_options: PollResultsOptions,
8080
/// Additional environment variables forwarded to executor subprocesses.
8181
pub extra_env: HashMap<String, String>,
82+
/// Enable valgrind's --fair-sched option.
83+
pub fair_sched: bool,
8284
}
8385

8486
/// Per-execution configuration passed to executors.
@@ -111,6 +113,8 @@ pub struct ExecutorConfig {
111113
/// Whether to enable language-level introspection (Node.js, Go wrappers in PATH).
112114
/// Disabled for exec-harness targets since they don't need it.
113115
pub enable_introspection: bool,
116+
/// Enable valgrind's --fair-sched option.
117+
pub fair_sched: bool,
114118
}
115119

116120
#[derive(Debug, Clone, PartialEq)]
@@ -186,6 +190,7 @@ impl OrchestratorConfig {
186190
go_runner_version: self.go_runner_version.clone(),
187191
extra_env: self.extra_env.clone(),
188192
enable_introspection,
193+
fair_sched: self.fair_sched,
189194
}
190195
}
191196
}
@@ -223,6 +228,7 @@ impl OrchestratorConfig {
223228
show_full_output: false,
224229
poll_results_options: PollResultsOptions::new(false, None),
225230
extra_env: HashMap::new(),
231+
fair_sched: false,
226232
}
227233
}
228234
}

src/executor/valgrind/measure.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::{env::consts::ARCH, process::Command};
1717
use tempfile::TempPath;
1818

1919
/// Builds the Valgrind argument list for the given simulation tool.
20-
fn get_valgrind_args(tool: &SimulationTool) -> Vec<String> {
20+
fn get_valgrind_args(tool: &SimulationTool, config: &ExecutorConfig) -> Vec<String> {
2121
let mut args: Vec<String> = [
2222
"-q",
2323
"--trace-children=yes",
@@ -50,6 +50,11 @@ fn get_valgrind_args(tool: &SimulationTool) -> Vec<String> {
5050
"--trace-children-skip={}",
5151
children_skip_patterns.join(",")
5252
));
53+
54+
if config.fair_sched {
55+
args.push("--fair-sched=yes".to_string());
56+
}
57+
5358
args
5459
}
5560

@@ -114,7 +119,7 @@ pub async fn measure(
114119
cmd.current_dir(abs_cwd);
115120
}
116121
// Configure valgrind
117-
let valgrind_args = get_valgrind_args(&config.simulation_tool);
122+
let valgrind_args = get_valgrind_args(&config.simulation_tool, config);
118123
let log_path = profile_folder.join("valgrind.log");
119124
cmd.arg("valgrind").args(valgrind_args.iter());
120125
if config.simulation_tool == SimulationTool::Callgrind {

0 commit comments

Comments
 (0)