Skip to content

Commit 7241899

Browse files
committed
fixup! fix: exclude paused sections from instrumentation measurement
1 parent 3212716 commit 7241899

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

core/include/measurement.hpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,18 @@ inline void measurement_set_metadata() {
5656
instrument_hooks_write_environment(g_hooks, getpid());
5757
}
5858

59+
#ifdef CODSPEED_ANALYSIS
60+
// inline (C++17) so every translation unit shares one definition; a static
61+
// would give each TU its own copy and silently desync the toggle parity.
62+
inline bool measurement_collecting = true;
63+
#endif
64+
5965
ALWAYS_INLINE void measurement_start() {
66+
#ifdef CODSPEED_ANALYSIS
67+
// START_INSTRUMENTATION leaves callgrind collecting (collect-atstart=yes),
68+
// so the parity flag must start each benchmark in the ON state.
69+
measurement_collecting = true;
70+
#endif
6071
instrument_hooks_start_benchmark_inline(g_hooks);
6172
}
6273

@@ -89,8 +100,6 @@ ALWAYS_INLINE void measurement_add_benchmark_timestamps(uint64_t start,
89100
}
90101

91102
#ifdef CODSPEED_ANALYSIS
92-
static bool measurement_collecting = true;
93-
94103
ALWAYS_INLINE void measurement_pause_timing() {
95104
if (measurement_collecting) {
96105
callgrind_toggle_collect();

0 commit comments

Comments
 (0)