diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-11-04 14:05:28 +0000 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-11-06 15:50:10 +0000 |
commit | 5dc816e7d027170992e45d22ae11ae3000de9244 (patch) | |
tree | d96d8a759dd0bcd9b98df36698ded032caa13bd0 /src/profiling/TimelineUtilityMethods.cpp | |
parent | 5edc8816118fcddb2681379db04c978041ce8b46 (diff) | |
download | armnn-5dc816e7d027170992e45d22ae11ae3000de9244.tar.gz |
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
Diffstat (limited to 'src/profiling/TimelineUtilityMethods.cpp')
-rw-r--r-- | src/profiling/TimelineUtilityMethods.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
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 |