IVGCVSW-4065 Add a RecordEvent function
* Added RecordEvent utility function to the TimelineUtilityMethods
class
* Added new utility function to get a timestamp
* Added unit tests
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Change-Id: Ia3f8fe7397915fa6c903ce0c0abab3047cea628c
diff --git a/src/profiling/ProfilingUtils.cpp b/src/profiling/ProfilingUtils.cpp
index 4202b68..b649747 100644
--- a/src/profiling/ProfilingUtils.cpp
+++ b/src/profiling/ProfilingUtils.cpp
@@ -8,6 +8,8 @@
#include <armnn/Version.hpp>
#include <armnn/Conversion.hpp>
+#include <WallClockTimer.hpp>
+
#include <boost/assert.hpp>
#include <fstream>
@@ -889,7 +891,6 @@
return TimelinePacketStatus::Ok;
}
-
std::string CentreAlignFormatting(const std::string& stringToPass, const int spacingWidth)
{
std::stringstream outputStream, centrePadding;
@@ -1090,6 +1091,19 @@
std::cout << "\n";
}
+uint64_t GetTimestamp()
+{
+#if USE_CLOCK_MONOTONIC_RAW
+ using clock = MonotonicClockRaw;
+#else
+ using clock = std::chrono::steady_clock;
+#endif
+
+ // Take a timestamp
+ auto timestamp = clock::now();
+
+ return static_cast<uint64_t>(timestamp.time_since_epoch().count());
+}
} // namespace profiling