@@ -1447,6 +1447,7 @@ class Fixture : public internal::Benchmark {
14471447 std::filesystem::relative (__FILE__, CODSPEED_GIT_ROOT_DIR).string() + "::"
14481448#define NAMESPACE \
14491449 (([]() { return extract_lambda_namespace (__PRETTY_FUNCTION__); })())
1450+ #define STATIC_NAMESPACE_STRING (name ) static std::string name = NAMESPACE;
14501451
14511452#define FILE_AND_NAMESPACE CUR_FILE + NAMESPACE
14521453
@@ -1461,7 +1462,9 @@ class Fixture : public internal::Benchmark {
14611462// Extra space after the comma for readability
14621463#define COMMA " , "
14631464#else
1465+ #define CUR_FILE std::string ()
14641466#define FILE_AND_NAMESPACE std::string ()
1467+ #define STATIC_NAMESPACE_STRING (name ) static std::string name = " " ;
14651468
14661469#define TYPE_START " <"
14671470#define TYPE_END " >"
@@ -1582,27 +1585,67 @@ class Fixture : public internal::Benchmark {
15821585#endif
15831586
15841587#define BENCHMARK_PRIVATE_DECLARE_F (BaseClass, Method ) \
1588+ STATIC_NAMESPACE_STRING (ns_##BaseClass##_##Method); \
15851589 class BaseClass ##_##Method##_Benchmark : public BaseClass { \
15861590 public: \
15871591 BaseClass##_##Method##_Benchmark() { \
1588- this ->SetName (#BaseClass " /" #Method); \
1592+ this ->SetName (CUR_FILE + ns_##BaseClass##_##Method + \
1593+ #BaseClass NAME_START #Method NAME_END); \
15891594 } \
15901595 \
15911596 protected: \
15921597 void BenchmarkCase (::benchmark::State&) override ; \
15931598 };
15941599
1600+ #ifdef CODSPEED_ENABLED
15951601#define BENCHMARK_TEMPLATE1_PRIVATE_DECLARE_F (BaseClass, Method, a ) \
1602+ STATIC_NAMESPACE_STRING (ns_##BaseClass##_##Method); \
15961603 class BaseClass ##_##Method##_Benchmark : public BaseClass<a> { \
15971604 public: \
15981605 BaseClass##_##Method##_Benchmark() { \
1599- this ->SetName (#BaseClass " <" #a " >/" #Method); \
1606+ this ->SetName (CUR_FILE + ns_##BaseClass##_##Method + \
1607+ #BaseClass " [" #Method " , " #a " ]" ); \
16001608 } \
16011609 \
16021610 protected: \
16031611 void BenchmarkCase (::benchmark::State&) override ; \
16041612 };
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+ #BaseClass " [" #Method " , " #a " , " #b " ]" ); \
1620+ } \
1621+ \
1622+ protected: \
1623+ void BenchmarkCase (::benchmark::State&) override ; \
1624+ };
16051625
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+ #BaseClass " [" #Method " , " #__VA_ARGS__ " ]" ); \
1633+ } \
1634+ \
1635+ protected: \
1636+ void BenchmarkCase (::benchmark::State&) override ; \
1637+ };
1638+ #else
1639+ #define BENCHMARK_TEMPLATE1_PRIVATE_DECLARE_F (BaseClass, Method, a ) \
1640+ class BaseClass ##_##Method##_Benchmark : public BaseClass<a> { \
1641+ public: \
1642+ BaseClass##_##Method##_Benchmark() { \
1643+ this ->SetName (#BaseClass " <" #a " >/" #Method); \
1644+ } \
1645+ \
1646+ protected: \
1647+ void BenchmarkCase (::benchmark::State&) override ; \
1648+ };
16061649#define BENCHMARK_TEMPLATE2_PRIVATE_DECLARE_F (BaseClass, Method, a, b ) \
16071650 class BaseClass ##_##Method##_Benchmark : public BaseClass<a, b> { \
16081651 public: \
@@ -1624,6 +1667,7 @@ class Fixture : public internal::Benchmark {
16241667 protected: \
16251668 void BenchmarkCase (::benchmark::State&) override ; \
16261669 };
1670+ #endif
16271671
16281672#define BENCHMARK_DEFINE_F (BaseClass, Method ) \
16291673 BENCHMARK_PRIVATE_DECLARE_F (BaseClass, Method) \
0 commit comments