Commit eafc113
committed
fix: exclude paused sections via callgrind collection toggling
Replace the per-pause CALLGRIND_STOP/START_INSTRUMENTATION calls with
CALLGRIND_TOGGLE_COLLECT. Toggling instrumentation flushes callgrind's
simulated cache, so every benchmark measured an artificial cold-cache
warmup phase and the cache-warming repetition in RunAnalysis was wasted,
regressing 76 benchmarks. Toggling collection excludes paused sections
without touching simulator state.
Gate the toggles to explicit user PauseTiming()/ResumeTiming() calls:
TOGGLE_COLLECT is parity-based and collection starts enabled, so the
implicit StartKeepRunning()/FinishKeepRunning() bracket must not toggle
or it would invert the collection state for the whole run.
Bump instrument-hooks for the new callgrind_toggle_collect helper.
Fixes COD-20331 parent 696eaa1 commit eafc113
4 files changed
Lines changed: 35 additions & 4 deletions
File tree
- core
- google_benchmark
- include/benchmark
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
Submodule instrument-hooks updated 45 files
- .clang-format+4-4
- .github/workflows/ci.yml+16
- .gitignore+1
- .pre-commit-config.yaml+9-1
- AGENTS.md+92
- CLAUDE.md+1
- CUSTOM_HARNESS.md+354
- Justfile+11-3
- README.md+2-13
- build.zig+44-10
- dist/core.c+55.2k-5.1k
- example/CMakeLists.txt+4-2
- example/main.c+14-5
- includes/callgrind.h+37-25
- includes/core.h+30-4
- scripts/release.py+36-7
- scripts/stub.c+84-25
- src/c.zig+121-15
- src/environment/linked_libraries/elf_view.zig+222
- src/environment/linked_libraries/root.zig+155
- src/environment/linked_libraries/testdata/test_lib.c+7
- src/environment/linked_libraries/testdata/test_lib.ver+9
- src/environment/root.zig+333
- src/fifo/posix.zig+52-51
- src/fifo/root.zig+17
- src/fifo/windows.zig+71
- src/helpers/valgrind.zig+1
- src/helpers/valgrind_wrapper.c+23-13
- src/instrument_hooks.zig+25
- src/instruments/fifo_instrument.zig+2-2
- src/instruments/perf.zig-6
- src/instruments/root.zig+25-21
- src/instruments/valgrind.zig+1-1
- src/instruments/walltime.zig+6
- src/logger.zig+4-1
- src/root.zig+4-1
- src/runner_fifo.zig+16-16
- src/shared.zig+8-7
- src/tests/deserialize_rust/Cargo.lock+308
- src/tests/deserialize_rust/Cargo.toml+14
- src/tests/deserialize_rust/main.rs+13-21
- src/tests/deserialize_rust/rust_deser.zig+2-2
- src/tests/deserialize_rust/serialized.zig+18-258
- src/tests/runner.zig+9-2
- src/utils.zig+17-25
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
949 | 949 | | |
950 | 950 | | |
951 | 951 | | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
952 | 961 | | |
953 | 962 | | |
954 | 963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
202 | 205 | | |
203 | 206 | | |
204 | 207 | | |
| |||
273 | 276 | | |
274 | 277 | | |
275 | 278 | | |
276 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
277 | 286 | | |
278 | 287 | | |
279 | 288 | | |
| |||
314 | 323 | | |
315 | 324 | | |
316 | 325 | | |
317 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
318 | 330 | | |
319 | 331 | | |
320 | 332 | | |
| |||
367 | 379 | | |
368 | 380 | | |
369 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
370 | 387 | | |
371 | 388 | | |
372 | 389 | | |
373 | 390 | | |
374 | 391 | | |
375 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
376 | 398 | | |
377 | 399 | | |
378 | 400 | | |
| |||
0 commit comments