From c04019985db1ee44c71834892ad17365185a3f8d Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Mon, 28 Oct 2019 15:24:34 +0000 Subject: IVGCVSW-4035 Add a CreateTypedLabel function * Create new utility function in the TimelineUtilityMethods class * Added unit tests Signed-off-by: Matteo Martincigh Change-Id: I63704b94d5cc6861e4e160de2aae4ae497699dd2 --- src/profiling/TimelineUtilityMethods.cpp | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/profiling/TimelineUtilityMethods.cpp') diff --git a/src/profiling/TimelineUtilityMethods.cpp b/src/profiling/TimelineUtilityMethods.cpp index aa9f5a5635..b34b70f984 100644 --- a/src/profiling/TimelineUtilityMethods.cpp +++ b/src/profiling/TimelineUtilityMethods.cpp @@ -52,6 +52,39 @@ ProfilingStaticGuid TimelineUtilityMethods::DeclareLabel(const std::string& labe return labelGuid; } +void TimelineUtilityMethods::CreateTypedLabel(ProfilingGuid entityGuid, + const std::string& entityName, + ProfilingStaticGuid labelTypeGuid) +{ + // Check that the entity name is valid + if (entityName.empty()) + { + // The entity name is invalid + throw InvalidArgumentException("Invalid entity name, the entity name cannot be empty"); + } + + // Declare a label with the entity's name, this call throws in case of error + ProfilingGuid labelGuid = DeclareLabel(entityName); + + // Generate a GUID for the label relationship + ProfilingGuid relationshipGuid = ProfilingService::Instance().NextGuid(); + + // Send the new label link to the external profiling service, this call throws in case of error + m_SendTimelinePacket.SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink, + relationshipGuid, + entityGuid, + labelGuid); + + // Generate a GUID for the label relationship + ProfilingGuid relationshipLabelGuid = ProfilingService::Instance().NextGuid(); + + // Send the new label link to the external profiling service, this call throws in case of error + m_SendTimelinePacket.SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink, + relationshipLabelGuid, + relationshipGuid, + labelTypeGuid); +} + } // namespace profiling } // namespace armnn -- cgit v1.2.1