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
committerNarumol Prangnawarat <narumol.prangnawarat@arm.com>2019-10-30 16:21:13 +0000
commitd034e087d9b48a7541aa588b5cad1373693a8e95 (patch)
tree09acedf864621647ee4e42453f9fe4cbcfc2cae3 /src/profiling/TimelineUtilityMethods.cpp
parentc0a87c14bd2bc8a02f6c5c9f919abca27ca4dde0 (diff)
downloadarmnn-d034e087d9b48a7541aa588b5cad1373693a8e95.tar.gz
IVGCVSW-4036 Add CreateNamedTypedEntity function
* Add CreateNamedTypedEntity function * Add NameEntity function * Add TypeEntity function * Unit tests Change-Id: I3cc27157a0b41c8709b0a468f93b58b63a1ad8d1 Signed-off-by: Narumol Prangnawarat <narumol.prangnawarat@arm.com>
Diffstat (limited to 'src/profiling/TimelineUtilityMethods.cpp')
-rw-r--r--src/profiling/TimelineUtilityMethods.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/profiling/TimelineUtilityMethods.cpp b/src/profiling/TimelineUtilityMethods.cpp
index b34b70f984..429967fc2f 100644
--- a/src/profiling/TimelineUtilityMethods.cpp
+++ b/src/profiling/TimelineUtilityMethods.cpp
@@ -34,6 +34,35 @@ void TimelineUtilityMethods::SendWellKnownLabelsAndEventClasses()
m_SendTimelinePacket.SendTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS);
}
+ProfilingDynamicGuid TimelineUtilityMethods::CreateNamedTypedEntity(const std::string& name, const std::string& type)
+{
+ // Check that the entity name is valid
+ if (name.empty())
+ {
+ throw InvalidArgumentException("Invalid entity name, the entity name cannot be empty");
+ }
+
+ // Check that the entity type is valid
+ if (type.empty())
+ {
+ throw InvalidArgumentException("Invalid entity type, the entity type cannot be empty");
+ }
+
+ // Generate dynamic GUID of the entity
+ ProfilingDynamicGuid entityGuid = ProfilingService::Instance().NextGuid();
+
+ // Send Entity Binary Packet of the entity to the external profiling service
+ m_SendTimelinePacket.SendTimelineEntityBinaryPacket(entityGuid);
+
+ // Create name entity and send the relationship of the entity with the given name
+ NameEntity(entityGuid, name);
+
+ // Create type entity and send the relationship of the entity with the given type
+ TypeEntity(entityGuid, type);
+
+ return entityGuid;
+}
+
ProfilingStaticGuid TimelineUtilityMethods::DeclareLabel(const std::string& labelName)
{
// Check that the label name is valid
@@ -85,6 +114,16 @@ void TimelineUtilityMethods::CreateTypedLabel(ProfilingGuid entityGuid,
labelTypeGuid);
}
+void TimelineUtilityMethods::NameEntity(ProfilingGuid entityGuid, const std::string& name)
+{
+ CreateTypedLabel(entityGuid, name, LabelsAndEventClasses::NAME_GUID);
+}
+
+void TimelineUtilityMethods::TypeEntity(ProfilingGuid entityGuid, const std::string& type)
+{
+ CreateTypedLabel(entityGuid, type, LabelsAndEventClasses::TYPE_GUID);
+}
+
} // namespace profiling
} // namespace armnn