aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/TimelineUtilityMethods.cpp
diff options
context:
space:
mode:
authorNarumol Prangnawarat <narumol.prangnawarat@arm.com>2019-10-30 12:48:31 +0000
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-30 17:36:27 +0000
commit94a3088479694ee1dfdd2e321a353ffcc79f4126 (patch)
treeec92c438c1f7b8d16fd57c21fa36b372d08c4e70 /src/profiling/TimelineUtilityMethods.cpp
parentd034e087d9b48a7541aa588b5cad1373693a8e95 (diff)
downloadarmnn-94a3088479694ee1dfdd2e321a353ffcc79f4126.tar.gz
IVGCVSW-4037 Add a CreateNamedTypedChildEntity method
* Added new method to the TimelineUtilityMethods class * Added unit tests * Code refactoring * Skipped the 0 when generating a dynamic GUID for testing purposes Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com> Change-Id: Ic2c8033ad010e07b0f8b7971ce653263e21c6f97
Diffstat (limited to 'src/profiling/TimelineUtilityMethods.cpp')
-rw-r--r--src/profiling/TimelineUtilityMethods.cpp39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/profiling/TimelineUtilityMethods.cpp b/src/profiling/TimelineUtilityMethods.cpp
index 429967fc2f..65668697f7 100644
--- a/src/profiling/TimelineUtilityMethods.cpp
+++ b/src/profiling/TimelineUtilityMethods.cpp
@@ -93,10 +93,10 @@ void TimelineUtilityMethods::CreateTypedLabel(ProfilingGuid entityGuid,
}
// Declare a label with the entity's name, this call throws in case of error
- ProfilingGuid labelGuid = DeclareLabel(entityName);
+ ProfilingStaticGuid labelGuid = DeclareLabel(entityName);
// Generate a GUID for the label relationship
- ProfilingGuid relationshipGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid 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,
@@ -105,7 +105,7 @@ void TimelineUtilityMethods::CreateTypedLabel(ProfilingGuid entityGuid,
labelGuid);
// Generate a GUID for the label relationship
- ProfilingGuid relationshipLabelGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid 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,
@@ -124,6 +124,39 @@ void TimelineUtilityMethods::TypeEntity(ProfilingGuid entityGuid, const std::str
CreateTypedLabel(entityGuid, type, LabelsAndEventClasses::TYPE_GUID);
}
+ProfilingDynamicGuid TimelineUtilityMethods::CreateNamedTypedChildEntity(ProfilingGuid parentEntityGuid,
+ const std::string& entityName,
+ const std::string& entityType)
+{
+ // 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");
+ }
+
+ // Check that the entity type is valid
+ if (entityType.empty())
+ {
+ // The entity type is invalid
+ throw InvalidArgumentException("Invalid entity type, the entity type cannot be empty");
+ }
+
+ // Create a named type entity from the given name and type, this call throws in case of error
+ ProfilingDynamicGuid childEntityGuid = CreateNamedTypedEntity(entityName, entityType);
+
+ // Generate a GUID for the retention link relationship
+ ProfilingDynamicGuid retentionLinkGuid = ProfilingService::Instance().NextGuid();
+
+ // Send the new retention link to the external profiling service, this call throws in case of error
+ m_SendTimelinePacket.SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
+ retentionLinkGuid,
+ parentEntityGuid,
+ childEntityGuid);
+
+ return childEntityGuid;
+}
+
} // namespace profiling
} // namespace armnn