feat: add --track-allocators toggle for memory mode - #469
Conversation
Greptile SummaryAdds configurable allocator tracking alongside expanded RSS accounting.
Confidence Score: 5/5The PR appears safe to merge because no blocking failures remain within the follow-up review scope. No blocking failures remain. Important Files Changed
|
Merging this PR will not alter performance
|
d983261 to
131f8a3
Compare
GuillaumeLagrange
left a comment
There was a problem hiding this comment.
I'm not sure what's really the usecase of this? olgtm but I'm not sure we've discussed
| long, | ||
| env = "CODSPEED_TRACK_ALLOCATORS", | ||
| default_value_t = true, | ||
| action = clap::ArgAction::Set |
There was a problem hiding this comment.
not sure we need to explicitly set action = clap::ArgAction::Set here
Add a --track-allocators flag (default on, env CODSPEED_TRACK_ALLOCATORS) to the memtrack track subcommand. When disabled, memtrack skips the allocator uprobe machinery (exec watcher + attach worker) and only emits coarse mmap/munmap/brk events, reducing overhead on allocation-heavy programs. The mmap/munmap/brk syscall tracepoints are now always attached in every memory run. The runner does not add a CLI flag for this: it relies on the CODSPEED_TRACK_ALLOCATORS environment variable being inherited by the memtrack subprocess, keeping the runner decoupled from the installed memtrack version. Standalone memtrack can still use the CLI flag.
131f8a3 to
f1dbc8a
Compare
What
Adds a
--track-allocatorsflag (default on, envCODSPEED_TRACK_ALLOCATORS) onrun/execand thememtrack tracksubcommand. When disabled (--track-allocators false), memtrack skips the per-allocation uprobe machinery and only emits coarsemmap/munmap/brkevents.Why
Allocation-heavy programs (e.g. a Rust build) generate an overwhelming number of
malloc/freeevents, and the per-allocation uprobes slow the target significantly. This flag lets users trade allocation granularity for lower overhead while still collecting RSS-relevant memory events.How
mmap/munmap/brksyscall tracepoints (already compiled into the BPF program but never attached) are now always attached in every memory run. The flag gates only the expensive allocator uprobes (exec-mapping watcher + attach worker).Tracker::new(track_allocators: bool)conditionally starts the exec watcher /AttachWorker;spawn/finishtolerate aNoneworker.ExecAndRunSharedArgs, threaded throughOrchestratorConfig→ExecutorConfig(mirroringexclude_allocations), and passed to the memtrack subprocess as an explicit--track-allocators <bool>arg (not via env inheritance, to survive glibc secure-execution env stripping).Default runs are unchanged in allocation coverage and now additionally emit
mmap/brkevents.Testing
cargo check --workspace --tests,cargo test --release -p codspeed-runner— green.run/exec/memtrack track --helpshow the flag (defaulttrue);CODSPEED_TRACK_ALLOCATORS=falseparses.test_track_allocators_disabled_skips_allocations) asserts that with allocators disabled, the trace containsMmapevents and zero allocation-kind events.Fixes COD-3231.