Skip to content

Commit 3323c5a

Browse files
committed
feat: detect stack size at runtime
1 parent b980718 commit 3323c5a

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

  • src/run/runner/wall_time/perf

src/run/runner/wall_time/perf/mod.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,24 @@ impl PerfRunner {
9494
.tempfile_in(&self.perf_dir)?;
9595

9696
// Infer the unwinding mode from the benchmark cmd
97-
let cg_mode = match (config.perf_unwinding_mode, &bench_cmd) {
98-
(Some(mode), _) => mode,
99-
(None, cmd) if cmd.contains("pytest") => UnwindingMode::FramePointer,
100-
(None, cmd) if cmd.contains("cargo") => UnwindingMode::Dwarf,
101-
(None, _) => {
102-
// Default to dwarf unwinding since it works well with most binaries.
103-
debug!("No call graph mode detected, defaulting to dwarf");
104-
UnwindingMode::Dwarf
105-
}
97+
let (cg_mode, stack_size) = if let Some(mode) = config.perf_unwinding_mode {
98+
(mode, None)
99+
} else if config.command.contains("cargo") {
100+
(UnwindingMode::Dwarf, None)
101+
} else if config.command.contains("pytest")
102+
|| config.command.contains("uv")
103+
|| config.command.contains("python")
104+
{
105+
(UnwindingMode::Dwarf, Some(65528))
106+
} else {
107+
// Default to dwarf unwinding since it works well with most binaries.
108+
debug!("No call graph mode detected, defaulting to dwarf");
109+
(UnwindingMode::Dwarf, None)
106110
};
107111

108112
let cg_mode = match cg_mode {
109113
UnwindingMode::FramePointer => "fp",
110-
UnwindingMode::Dwarf => "dwarf",
114+
UnwindingMode::Dwarf => &format!("dwarf,{}", stack_size.unwrap_or(8192)),
111115
};
112116
debug!("Using call graph mode: {cg_mode:?}");
113117

0 commit comments

Comments
 (0)