File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ add_subdirectory (${PROJECT_SOURCE_DIR} /../core codspeed)
2
+
3
+ execute_process (
4
+ COMMAND git rev-parse --show-toplevel
5
+ OUTPUT_VARIABLE GIT_ROOT_DIR
6
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
7
+
8
+ target_compile_definitions (codspeed
9
+ INTERFACE -DCODSPEED_GIT_ROOT_DIR="${GIT_ROOT_DIR} " )
10
+
1
11
# Step 1: Check if CODSPEED_MODE is set via the command line
2
12
3
13
# CMake cache kind of breaks this mechanism, keeping it for first time
Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond);
171
171
#include < cstddef>
172
172
#include < initializer_list>
173
173
#include < iosfwd>
174
+ #include < iostream>
174
175
#include < limits>
175
176
#include < map>
176
177
#include < memory>
@@ -1437,11 +1438,23 @@ class Fixture : public internal::Benchmark {
1437
1438
static ::benchmark::internal::Benchmark const * const BENCHMARK_PRIVATE_NAME ( \
1438
1439
n) [[maybe_unused]]
1439
1440
1441
+ #ifdef CODSPEED_INSTRUMENTATION
1442
+ #include < filesystem>
1443
+ #define BENCHMARK (...) \
1444
+ BENCHMARK_PRIVATE_DECLARE (_benchmark_) = \
1445
+ (::benchmark::internal::RegisterBenchmarkInternal( \
1446
+ std::make_unique<::benchmark::internal::FunctionBenchmark>( \
1447
+ std::filesystem::relative (__FILE__, CODSPEED_GIT_ROOT_DIR) \
1448
+ .string() + \
1449
+ "::" + #__VA_ARGS__, \
1450
+ __VA_ARGS__)))
1451
+ #else
1440
1452
#define BENCHMARK (...) \
1441
1453
BENCHMARK_PRIVATE_DECLARE (_benchmark_) = \
1442
1454
(::benchmark::internal::RegisterBenchmarkInternal( \
1443
1455
std::make_unique<::benchmark::internal::FunctionBenchmark>( \
1444
1456
#__VA_ARGS__, __VA_ARGS__)))
1457
+ #endif
1445
1458
1446
1459
// Old-style macros
1447
1460
#define BENCHMARK_WITH_ARG (n, a ) BENCHMARK(n)->Arg ((a))
You can’t perform that action at this time.
0 commit comments