@@ -1440,21 +1440,23 @@ class Fixture : public internal::Benchmark {
1440
1440
1441
1441
#ifdef CODSPEED_ENABLED
1442
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__)))
1443
+ #define CUR_FILE \
1444
+ std::filesystem::relative (__FILE__, CODSPEED_GIT_ROOT_DIR).string() + "::"
1445
+ #define TYPE_START " ["
1446
+ #define TYPE_END " ]"
1447
+ #define FUNC_TEST_SEP " ::"
1451
1448
#else
1449
+ #define CUR_FILE std::string ()
1450
+ #define TYPE_START " <"
1451
+ #define TYPE_END " >"
1452
+ #define FUNC_TEST_SEP " /"
1453
+ #endif
1454
+
1452
1455
#define BENCHMARK (...) \
1453
1456
BENCHMARK_PRIVATE_DECLARE (_benchmark_) = \
1454
1457
(::benchmark::internal::RegisterBenchmarkInternal( \
1455
1458
std::make_unique<::benchmark::internal::FunctionBenchmark>( \
1456
- #__VA_ARGS__, __VA_ARGS__)))
1457
- #endif
1459
+ CUR_FILE + #__VA_ARGS__, __VA_ARGS__)))
1458
1460
1459
1461
// Old-style macros
1460
1462
#define BENCHMARK_WITH_ARG (n, a ) BENCHMARK(n)->Arg ((a))
@@ -1479,7 +1481,7 @@ class Fixture : public internal::Benchmark {
1479
1481
BENCHMARK_PRIVATE_DECLARE (_benchmark_) = \
1480
1482
(::benchmark::internal::RegisterBenchmarkInternal( \
1481
1483
std::make_unique<::benchmark::internal::FunctionBenchmark>( \
1482
- #func " / " #test_case_name, \
1484
+ CUR_FILE + #func FUNC_TEST_SEP #test_case_name, \
1483
1485
[](::benchmark::State& st) { func (st, __VA_ARGS__); })))
1484
1486
1485
1487
// This will register a benchmark for a templatized function. For example:
@@ -1494,19 +1496,20 @@ class Fixture : public internal::Benchmark {
1494
1496
BENCHMARK_PRIVATE_DECLARE (n) = \
1495
1497
(::benchmark::internal::RegisterBenchmarkInternal( \
1496
1498
std::make_unique<::benchmark::internal::FunctionBenchmark>( \
1497
- #n " < " #a " > " , n<a>)))
1499
+ CUR_FILE + #n TYPE_START #a TYPE_END , n<a>)))
1498
1500
1499
1501
#define BENCHMARK_TEMPLATE2 (n, a, b ) \
1500
1502
BENCHMARK_PRIVATE_DECLARE (n) = \
1501
1503
(::benchmark::internal::RegisterBenchmarkInternal( \
1502
1504
std::make_unique<::benchmark::internal::FunctionBenchmark>( \
1503
- #n " < " #a " ," #b " > " , n<a, b>)))
1505
+ CUR_FILE + #n TYPE_START #a " ," #b TYPE_END , n<a, b>)))
1504
1506
1505
1507
#define BENCHMARK_TEMPLATE (n, ...) \
1506
1508
BENCHMARK_PRIVATE_DECLARE (n) = \
1507
1509
(::benchmark::internal::RegisterBenchmarkInternal( \
1508
1510
std::make_unique<::benchmark::internal::FunctionBenchmark>( \
1509
- #n " <" #__VA_ARGS__ " >" , n<__VA_ARGS__>)))
1511
+ CUR_FILE + #n TYPE_START #__VA_ARGS__ TYPE_END, \
1512
+ n<__VA_ARGS__>)))
1510
1513
1511
1514
// This will register a benchmark for a templatized function,
1512
1515
// with the additional arguments specified by `...`.
@@ -1520,15 +1523,20 @@ class Fixture : public internal::Benchmark {
1520
1523
// /* Registers a benchmark named "BM_takes_args<void>/int_string_test` */
1521
1524
// BENCHMARK_TEMPLATE1_CAPTURE(BM_takes_args, void, int_string_test, 42,
1522
1525
// std::string("abc"));
1526
+ #ifdef CODSPEED_ENABLED
1527
+ #define BENCHMARK_TEMPLATE1_CAPTURE (func, a, test_case_name, ...) \
1528
+ BENCHMARK_CAPTURE (func, test_case_name, __VA_ARGS__)
1529
+ #else
1523
1530
#define BENCHMARK_TEMPLATE1_CAPTURE (func, a, test_case_name, ...) \
1524
1531
BENCHMARK_CAPTURE (func<a>, test_case_name, __VA_ARGS__)
1532
+ #endif
1525
1533
1526
1534
#define BENCHMARK_TEMPLATE2_CAPTURE (func, a, b, test_case_name, ...) \
1527
1535
BENCHMARK_PRIVATE_DECLARE (func) = \
1528
1536
(::benchmark::internal::RegisterBenchmarkInternal( \
1529
1537
std::make_unique<::benchmark::internal::FunctionBenchmark>( \
1530
- #func " < " #a " , " #b " > " \
1531
- " / " #test_case_name, \
1538
+ CUR_FILE + #func TYPE_START #a \
1539
+ " , " #b TYPE_END FUNC_TEST_SEP #test_case_name, \
1532
1540
[](::benchmark::State& st) { func<a, b>(st, __VA_ARGS__); })))
1533
1541
1534
1542
#define BENCHMARK_PRIVATE_DECLARE_F (BaseClass, Method ) \
@@ -1680,6 +1688,7 @@ struct BENCHMARK_EXPORT SystemInfo {
1680
1688
// which allows individual fields to be modified or cleared before
1681
1689
// building the final name using 'str()'.
1682
1690
struct BENCHMARK_EXPORT BenchmarkName {
1691
+ std::string path;
1683
1692
std::string function_name;
1684
1693
std::string args;
1685
1694
std::string min_time;
0 commit comments