aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/armnn/Profiling.hpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/armnn/Profiling.hpp b/src/armnn/Profiling.hpp
index 08e55a14c5..c0d37dc13e 100644
--- a/src/armnn/Profiling.hpp
+++ b/src/armnn/Profiling.hpp
@@ -156,15 +156,21 @@ private:
} // namespace armnn
-
-#include <boost/preprocessor.hpp>
-
-#define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC(backendId, /*name,*/ ...) \
- armnn::ScopedProfilingEvent BOOST_PP_CAT(e_,__LINE__)(backendId, /*name,*/ __VA_ARGS__);
-
-// The event name must be known at compile time
+#define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC_INNER(lineNumber, backendId, /*name,*/ ...) \
+ armnn::ScopedProfilingEvent e_ ## lineNumber(backendId, /*name,*/ __VA_ARGS__);
+
+#define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC(lineNumber, backendId, /*name,*/ ...) \
+ ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC_INNER(lineNumber, backendId, /*name,*/ __VA_ARGS__)
+
+// The event name must be known at compile time i.e. if you are going to use this version of the macro
+// in code the first argument you supply after the backendId must be the name.
+// NOTE: need to pass the line number as an argument from here so by the time it gets to the UNIQUE_LOC_INNER
+// above it has expanded to a string and will concat (##) correctly with the 'e_' prefix to yield a
+// legal and unique variable name (so long as you don't use the macro twice on the same line).
+// The concat preprocessing operator (##) very unhelpfully will not expand macros see
+// https://gcc.gnu.org/onlinedocs/cpp/Concatenation.html for the gory details.
#define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS(backendId, /*name,*/ ...) \
- ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC(backendId, /*name,*/ __VA_ARGS__);
+ ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC(__LINE__,backendId, /*name,*/ __VA_ARGS__)
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name) \
ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS(backendId, name, armnn::WallClockTimer())