@@ -1447,6 +1447,7 @@ class Fixture : public internal::Benchmark {
1447
1447
std::filesystem::relative (__FILE__, CODSPEED_GIT_ROOT_DIR).string() + "::"
1448
1448
#define NAMESPACE \
1449
1449
(([]() { return extract_lambda_namespace (__PRETTY_FUNCTION__); })())
1450
+ #define STATIC_NAMESPACE_STRING (name ) static std::string name = NAMESPACE;
1450
1451
1451
1452
#define FILE_AND_NAMESPACE CUR_FILE + NAMESPACE
1452
1453
@@ -1581,6 +1582,62 @@ class Fixture : public internal::Benchmark {
1581
1582
[](::benchmark::State& st) { func<a, b>(st, __VA_ARGS__); })))
1582
1583
#endif
1583
1584
1585
+ #ifdef CODSPEED_ENABLED
1586
+
1587
+ #define BENCHMARK_PRIVATE_DECLARE_F (BaseClass, Method ) \
1588
+ STATIC_NAMESPACE_STRING (ns_##BaseClass##_##Method); \
1589
+ class BaseClass ##_##Method##_Benchmark : public BaseClass { \
1590
+ public: \
1591
+ BaseClass##_##Method##_Benchmark() { \
1592
+ this ->SetName (CUR_FILE + ns_##BaseClass##_##Method + \
1593
+ #Method " [" #BaseClass " ]" ); \
1594
+ } \
1595
+ \
1596
+ protected: \
1597
+ void BenchmarkCase (::benchmark::State&) override ; \
1598
+ };
1599
+
1600
+ #define BENCHMARK_TEMPLATE1_PRIVATE_DECLARE_F (BaseClass, Method, a ) \
1601
+ STATIC_NAMESPACE_STRING (ns_##BaseClass##_##Method); \
1602
+ class BaseClass ##_##Method##_Benchmark : public BaseClass<a> { \
1603
+ public: \
1604
+ BaseClass##_##Method##_Benchmark() { \
1605
+ this ->SetName (CUR_FILE + ns_##BaseClass##_##Method + \
1606
+ #Method " [" #BaseClass " , " #a " ]" ); \
1607
+ } \
1608
+ \
1609
+ protected: \
1610
+ void BenchmarkCase (::benchmark::State&) override ; \
1611
+ };
1612
+
1613
+ #define BENCHMARK_TEMPLATE2_PRIVATE_DECLARE_F (BaseClass, Method, a, b ) \
1614
+ STATIC_NAMESPACE_STRING (ns_##BaseClass##_##Method); \
1615
+ class BaseClass ##_##Method##_Benchmark : public BaseClass<a, b> { \
1616
+ public: \
1617
+ BaseClass##_##Method##_Benchmark() { \
1618
+ this ->SetName (CUR_FILE + ns_##BaseClass##_##Method + \
1619
+ #Method " [" #BaseClass " , " #a " , " #b " ]" ); \
1620
+ } \
1621
+ \
1622
+ protected: \
1623
+ void BenchmarkCase (::benchmark::State&) override ; \
1624
+ };
1625
+
1626
+ #define BENCHMARK_TEMPLATE_PRIVATE_DECLARE_F (BaseClass, Method, ...) \
1627
+ STATIC_NAMESPACE_STRING (ns_##BaseClass##_##Method); \
1628
+ class BaseClass ##_##Method##_Benchmark : public BaseClass<__VA_ARGS__> { \
1629
+ public: \
1630
+ BaseClass##_##Method##_Benchmark() { \
1631
+ this ->SetName (CUR_FILE + ns_##BaseClass##_##Method + \
1632
+ #Method " [" #BaseClass " , " #__VA_ARGS__ " ]" ); \
1633
+ } \
1634
+ \
1635
+ protected: \
1636
+ void BenchmarkCase (::benchmark::State&) override ; \
1637
+ };
1638
+
1639
+ #else // CODSPEED_ENABLED undefined:
1640
+
1584
1641
#define BENCHMARK_PRIVATE_DECLARE_F (BaseClass, Method ) \
1585
1642
class BaseClass ##_##Method##_Benchmark : public BaseClass { \
1586
1643
public: \
@@ -1602,7 +1659,6 @@ class Fixture : public internal::Benchmark {
1602
1659
protected: \
1603
1660
void BenchmarkCase (::benchmark::State&) override ; \
1604
1661
};
1605
-
1606
1662
#define BENCHMARK_TEMPLATE2_PRIVATE_DECLARE_F (BaseClass, Method, a, b ) \
1607
1663
class BaseClass ##_##Method##_Benchmark : public BaseClass<a, b> { \
1608
1664
public: \
@@ -1624,6 +1680,7 @@ class Fixture : public internal::Benchmark {
1624
1680
protected: \
1625
1681
void BenchmarkCase (::benchmark::State&) override ; \
1626
1682
};
1683
+ #endif
1627
1684
1628
1685
#define BENCHMARK_DEFINE_F (BaseClass, Method ) \
1629
1686
BENCHMARK_PRIVATE_DECLARE_F (BaseClass, Method) \
0 commit comments