Skip to content
Merged
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 @@ -93,6 +93,7 @@ fn build_orchestrator_config(
cycle_estimation: args.shared.cycle_estimation,
exclude_allocations: args.shared.exclude_allocations,
simulation_track_subprocess: args.shared.simulation_track_subprocess,
memory_track_physical: args.shared.experimental.experimental_memory_track_physical,
})
}

Expand Down
13 changes: 13 additions & 0 deletions src/cli/experimental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ pub struct ExperimentalArgs {
)]
pub experimental_fair_sched: bool,

/// Enable physical (resident) memory tracking in memory mode.
#[arg(
long,
Comment thread
not-matthias marked this conversation as resolved.
default_value_t = false,
help_heading = "Experimental",
env = "CODSPEED_MEMTRACK_TRACK_PHYSICAL",
value_parser = clap::builder::FalseyValueParser::new()
)]
pub experimental_memory_track_physical: bool,

/// Deprecated: cycle estimation is enabled by default and this flag has no effect.
#[arg(long, hide = true, env = "CODSPEED_EXPERIMENTAL_CYCLE_ESTIMATION")]
pub experimental_cycle_estimation: bool,
Expand All @@ -33,6 +43,9 @@ impl ExperimentalArgs {
if self.experimental_fair_sched {
flags.push("--experimental-fair-sched");
}
if self.experimental_memory_track_physical {
flags.push("--experimental-memory-track-physical");
}
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 @@ -83,6 +83,7 @@ impl RunArgs {
experimental_fair_sched: false,
experimental_cycle_estimation: false,
experimental_exclude_allocations: false,
experimental_memory_track_physical: false,
},
},
instruments: vec![],
Expand Down Expand Up @@ -135,6 +136,7 @@ fn build_orchestrator_config(
cycle_estimation: args.shared.cycle_estimation,
exclude_allocations: args.shared.exclude_allocations,
simulation_track_subprocess: args.shared.simulation_track_subprocess,
memory_track_physical: args.shared.experimental.experimental_memory_track_physical,
})
}

Expand Down
9 changes: 9 additions & 0 deletions src/executor/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ pub struct OrchestratorConfig {
/// Inherit valgrind's instrumentation state across a traced exec, so the cost of
/// subprocesses spawned by a benchmark is measured too.
pub simulation_track_subprocess: bool,
/// Enable physical (resident) memory tracking in memory mode.
pub memory_track_physical: bool,
}

/// Per-execution configuration passed to executors.
Expand Down Expand Up @@ -138,6 +140,11 @@ pub struct ExecutorConfig {
/// Inherit valgrind's instrumentation state across a traced exec, so the cost of
/// subprocesses spawned by a benchmark is measured too.
pub simulation_track_subprocess: bool,
/// Enable physical (resident) memory tracking in memory mode.
///
/// Only read by the memory executor, which is Linux-only.
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
pub memory_track_physical: bool,
}

#[derive(Debug, Clone, PartialEq)]
Expand Down Expand Up @@ -210,6 +217,7 @@ impl OrchestratorConfig {
cycle_estimation: self.cycle_estimation,
exclude_allocations: self.exclude_allocations,
simulation_track_subprocess: self.simulation_track_subprocess,
memory_track_physical: self.memory_track_physical,
}
}
}
Expand Down Expand Up @@ -245,6 +253,7 @@ impl OrchestratorConfig {
cycle_estimation: true,
exclude_allocations: false,
simulation_track_subprocess: false,
memory_track_physical: false,
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/executor/memory/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ impl MemoryExecutor {

// Build the memtrack command
let mut cmd_builder = CommandBuilder::new(MEMTRACK_COMMAND);
if execution_context.config.memory_track_physical {
cmd_builder.env("CODSPEED_MEMTRACK_TRACK_PHYSICAL", "1");
Comment thread
not-matthias marked this conversation as resolved.
}
cmd_builder.arg("track");
cmd_builder.arg("--output");
cmd_builder.arg(execution_context.profile_folder.join("results"));
Expand Down