Skip to content

Commit 19b4838

Browse files
committed
fixup: fix win build
1 parent b93318f commit 19b4838

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

core/include/measurement.hpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
#include <string>
55
#ifdef _WIN32
66
#include <process.h>
7+
#define getpid _getpid
8+
#define ALWAYS_INLINE __forceinline
79
#else
810
#include <unistd.h>
11+
#define ALWAYS_INLINE __attribute__((always_inline))
912
#endif
1013

1114
extern "C" {
@@ -37,21 +40,17 @@ inline void measurement_set_metadata() {
3740
instrument_hooks_set_integration(g_hooks, "codspeed-cpp", version.c_str());
3841
}
3942

40-
__attribute__((always_inline)) inline void measurement_start() {
43+
ALWAYS_INLINE inline void measurement_start() {
4144
instrument_hooks_start_benchmark_inline(g_hooks);
4245
}
4346

44-
__attribute__((always_inline)) inline void measurement_stop() {
47+
ALWAYS_INLINE inline void measurement_stop() {
4548
instrument_hooks_stop_benchmark_inline(g_hooks);
4649
}
4750

48-
__attribute__((always_inline)) inline void measurement_set_executed_benchmark(
51+
ALWAYS_INLINE inline void measurement_set_executed_benchmark(
4952
const std::string& name) {
50-
#ifdef _WIN32
51-
auto current_pid = _getpid();
52-
#else
5353
auto current_pid = getpid();
54-
#endif
5554
instrument_hooks_executed_benchmark(g_hooks, current_pid, name.c_str());
5655
}
5756

0 commit comments

Comments
 (0)