Skip to content

Commit bc292e3

Browse files
committed
chore: try to outline get_hooks
1 parent 6ed891b commit bc292e3

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

core/include/measurement.hpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,13 @@ __attribute__((always_inline)) inline void measurement_start() {
5252
CALLGRIND_START_INSTRUMENTATION;
5353
}
5454

55+
void measurement_stop_outline(const std::string& name)
56+
__attribute__((noinline));
57+
5558
__attribute__((always_inline)) inline void measurement_stop(
5659
const std::string& name) {
5760
CALLGRIND_STOP_INSTRUMENTATION;
58-
instrument_hooks_stop_benchmark(get_hooks());
59-
60-
#ifdef _WIN32
61-
auto current_pid = _getpid();
62-
#else
63-
auto current_pid = getpid();
64-
#endif
65-
instrument_hooks_executed_benchmark(get_hooks(), current_pid, name.c_str());
61+
measurement_stop_outline(name);
6662
};
6763
#else
6864
// Stub implementations for non-instrumentation builds

core/src/measurement.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "measurement.hpp"
2+
3+
__attribute__((noinline)) void measurement_stop_outline(
4+
const std::string& name) {
5+
instrument_hooks_stop_benchmark(get_hooks());
6+
7+
#ifdef _WIN32
8+
auto current_pid = _getpid();
9+
#else
10+
auto current_pid = getpid();
11+
#endif
12+
instrument_hooks_executed_benchmark(get_hooks(), current_pid, name.c_str());
13+
}

0 commit comments

Comments
 (0)