From 5dc816e7d027170992e45d22ae11ae3000de9244 Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Mon, 4 Nov 2019 14:05:28 +0000 Subject: 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 Change-Id: Ia3f8fe7397915fa6c903ce0c0abab3047cea628c --- src/profiling/TimelineUtilityMethods.cpp | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/profiling/TimelineUtilityMethods.cpp') diff --git a/src/profiling/TimelineUtilityMethods.cpp b/src/profiling/TimelineUtilityMethods.cpp index 65668697f7..8c84aa73e9 100644 --- a/src/profiling/TimelineUtilityMethods.cpp +++ b/src/profiling/TimelineUtilityMethods.cpp @@ -157,6 +157,41 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateNamedTypedChildEntity(Profili return childEntityGuid; } +ProfilingDynamicGuid TimelineUtilityMethods::RecordEvent(ProfilingGuid entityGuid, ProfilingStaticGuid eventClassGuid) +{ + // Take a timestamp + uint64_t timestamp = GetTimestamp(); + + // Get the thread id + std::thread::id threadId = std::this_thread::get_id(); + + // Generate a GUID for the event + ProfilingDynamicGuid eventGuid = ProfilingService::Instance().NextGuid(); + + // Send the new timeline event to the external profiling service, this call throws in case of error + m_SendTimelinePacket.SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid); + + // Generate a GUID for the execution link + ProfilingDynamicGuid executionLinkId = ProfilingService::Instance().NextGuid(); + + // Send the new execution link to the external profiling service, this call throws in case of error + m_SendTimelinePacket.SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink, + executionLinkId, + entityGuid, + eventGuid); + + // Generate a GUID for the data relationship link + ProfilingDynamicGuid eventClassLinkId = ProfilingService::Instance().NextGuid(); + + // Send the new data relationship link to the external profiling service, this call throws in case of error + m_SendTimelinePacket.SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink, + eventClassLinkId, + entityGuid, + eventClassGuid); + + return eventGuid; +} + } // namespace profiling } // namespace armnn -- cgit v1.2.1