aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/TimelineUtilityMethods.cpp
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2020-03-18 10:57:30 +0000
committerSadik Armagan <sadik.armagan@arm.com>2020-03-18 15:48:21 +0000
commit3184c907b2420e6c66485529f336251b2b62aecf (patch)
treeb79190007f80da9bb9d827efb714ce13a0ffb2bb /src/profiling/TimelineUtilityMethods.cpp
parente6a2ccd09060ba93203ddc5a7f79260cedf2c147 (diff)
downloadarmnn-3184c907b2420e6c66485529f336251b2b62aecf.tar.gz
IVGCVSW-4463 Change ProfilingService to a member of runtime from a singleton
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com> Change-Id: I345c39a10a4693a500aa1687d9a5cee76da791c3
Diffstat (limited to 'src/profiling/TimelineUtilityMethods.cpp')
-rw-r--r--src/profiling/TimelineUtilityMethods.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/profiling/TimelineUtilityMethods.cpp b/src/profiling/TimelineUtilityMethods.cpp
index 972916104e..7310b759d2 100644
--- a/src/profiling/TimelineUtilityMethods.cpp
+++ b/src/profiling/TimelineUtilityMethods.cpp
@@ -4,7 +4,6 @@
//
#include "TimelineUtilityMethods.hpp"
-#include "ProfilingService.hpp"
#include "LabelsAndEventClasses.hpp"
namespace armnn
@@ -13,12 +12,12 @@ namespace armnn
namespace profiling
{
-std::unique_ptr<TimelineUtilityMethods> TimelineUtilityMethods::GetTimelineUtils()
+std::unique_ptr<TimelineUtilityMethods> TimelineUtilityMethods::GetTimelineUtils(ProfilingService& profilingService)
{
- if (ProfilingService::Instance().IsEnabled())
+ if (profilingService.IsProfilingEnabled())
{
- std::unique_ptr<ISendTimelinePacket> sendTimelinepacket = ProfilingService::Instance().GetSendTimelinePacket();
- return std::make_unique<TimelineUtilityMethods>(sendTimelinepacket);
+ std::unique_ptr<ISendTimelinePacket> sendTimelinepacket = profilingService.GetSendTimelinePacket();
+ return std::make_unique<TimelineUtilityMethods>(sendTimelinepacket, profilingService);
}
else
{
@@ -92,7 +91,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateNamedTypedEntity(const std::s
}
// Generate dynamic GUID of the entity
- ProfilingDynamicGuid entityGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid entityGuid = m_ProfilingService.GetNextGuid();
CreateNamedTypedEntity(entityGuid, name, type);
@@ -155,7 +154,7 @@ ProfilingStaticGuid TimelineUtilityMethods::DeclareLabel(const std::string& labe
}
// Generate a static GUID for the given label name
- ProfilingStaticGuid labelGuid = ProfilingService::Instance().GenerateStaticId(labelName);
+ ProfilingStaticGuid labelGuid = m_ProfilingService.GetStaticId(labelName);
// Send the new label to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
@@ -178,7 +177,7 @@ void TimelineUtilityMethods::MarkEntityWithLabel(ProfilingGuid entityGuid,
ProfilingStaticGuid labelGuid = DeclareLabel(labelName);
// Generate a GUID for the label relationship
- ProfilingDynamicGuid relationshipGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid relationshipGuid = m_ProfilingService.GetNextGuid();
// Send the new label link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
@@ -187,7 +186,7 @@ void TimelineUtilityMethods::MarkEntityWithLabel(ProfilingGuid entityGuid,
labelGuid);
// Generate a GUID for the label relationship
- ProfilingDynamicGuid relationshipLabelGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid relationshipLabelGuid = m_ProfilingService.GetNextGuid();
// Send the new label link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
@@ -200,7 +199,7 @@ void TimelineUtilityMethods::MarkEntityWithType(ProfilingGuid entityGuid,
ProfilingStaticGuid typeNameGuid)
{
// Generate a GUID for the label relationship
- ProfilingDynamicGuid relationshipGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid relationshipGuid = m_ProfilingService.GetNextGuid();
// Send the new label link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
@@ -209,7 +208,7 @@ void TimelineUtilityMethods::MarkEntityWithType(ProfilingGuid entityGuid,
typeNameGuid);
// Generate a GUID for the label relationship
- ProfilingDynamicGuid relationshipLabelGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid relationshipLabelGuid = m_ProfilingService.GetNextGuid();
// Send the new label link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::LabelLink,
@@ -250,7 +249,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateNamedTypedChildEntity(Profili
ProfilingDynamicGuid childEntityGuid = CreateNamedTypedEntity(entityName, entityType);
// Generate a GUID for the retention link relationship
- ProfilingDynamicGuid retentionLinkGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid retentionLinkGuid = m_ProfilingService.GetNextGuid();
// Send the new retention link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
@@ -284,7 +283,7 @@ void TimelineUtilityMethods::CreateNamedTypedChildEntity(ProfilingGuid childEnti
CreateNamedTypedEntity(childEntityGuid, entityName, entityType);
// Generate a GUID for the retention link relationship
- ProfilingDynamicGuid retentionLinkGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid retentionLinkGuid = m_ProfilingService.GetNextGuid();
// Send the new retention link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
@@ -309,7 +308,7 @@ void TimelineUtilityMethods::CreateNamedTypedChildEntity(ProfilingGuid childEnti
CreateNamedTypedEntity(childEntityGuid, entityName, typeGuid);
// Generate a GUID for the retention link relationship
- ProfilingDynamicGuid retentionLinkGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid retentionLinkGuid = m_ProfilingService.GetNextGuid();
// Send the new retention link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::RetentionLink,
@@ -323,7 +322,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateRelationship(ProfilingRelatio
ProfilingGuid tailGuid)
{
// Generate a GUID for the relationship
- ProfilingDynamicGuid relationshipGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid relationshipGuid = m_ProfilingService.GetNextGuid();
// Send the new retention link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
@@ -338,7 +337,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::CreateConnectionRelationship(Profil
ProfilingGuid tailGuid)
{
// Generate a GUID for the relationship
- ProfilingDynamicGuid relationshipGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid relationshipGuid = m_ProfilingService.GetNextGuid();
// Send the new retention link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
@@ -368,13 +367,13 @@ ProfilingDynamicGuid TimelineUtilityMethods::RecordEvent(ProfilingGuid entityGui
std::thread::id threadId = std::this_thread::get_id();
// Generate a GUID for the event
- ProfilingDynamicGuid eventGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid eventGuid = m_ProfilingService.GetNextGuid();
// 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();
+ ProfilingDynamicGuid executionLinkId = m_ProfilingService.GetNextGuid();
// Send the new execution link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::ExecutionLink,
@@ -383,7 +382,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::RecordEvent(ProfilingGuid entityGui
eventGuid);
// Generate a GUID for the data relationship link
- ProfilingDynamicGuid eventClassLinkId = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid eventClassLinkId = m_ProfilingService.GetNextGuid();
// Send the new data relationship link to the external profiling service, this call throws in case of error
m_SendTimelinePacket->SendTimelineRelationshipBinaryPacket(ProfilingRelationshipType::DataLink,
@@ -397,7 +396,7 @@ ProfilingDynamicGuid TimelineUtilityMethods::RecordEvent(ProfilingGuid entityGui
ProfilingDynamicGuid TimelineUtilityMethods::RecordWorkloadInferenceAndStartOfLifeEvent(ProfilingGuid workloadGuid,
ProfilingGuid inferenceGuid)
{
- ProfilingDynamicGuid workloadInferenceGuid = ProfilingService::Instance().NextGuid();
+ ProfilingDynamicGuid workloadInferenceGuid = m_ProfilingService.GetNextGuid();
CreateTypedEntity(workloadInferenceGuid, LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID);
CreateRelationship(ProfilingRelationshipType::RetentionLink, inferenceGuid, workloadInferenceGuid);
CreateRelationship(ProfilingRelationshipType::RetentionLink, workloadGuid, workloadInferenceGuid);