aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Flynn <jim.flynn@arm.com>2019-10-24 18:07:44 +0100
committerJim Flynn <jim.flynn@arm.com>2019-10-25 12:26:00 +0100
commit8b20065e8e139901f09e2da1a761c6225048102a (patch)
tree39bff65b9ca07caff094585176fb576497fe42ae
parent00f3aaf282c53b47f4cebfa4b29d7039da883bc1 (diff)
downloadarmnn-8b20065e8e139901f09e2da1a761c6225048102a.tar.gz
IVGCVSW-4028 Add TimelinePacketWriterFactory to ProfilingService
Change-Id: I1baf6ff49fc591577efab8190352f2ae5a7dc5e5 Signed-off-by: Jim Flynn <jim.flynn@arm.com>
-rw-r--r--src/profiling/ProfilingService.cpp5
-rw-r--r--src/profiling/ProfilingService.hpp19
-rw-r--r--src/profiling/test/SendTimelinePacketTests.cpp11
3 files changed, 28 insertions, 7 deletions
diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
index 6122ed99c2..c4063a583c 100644
--- a/src/profiling/ProfilingService.cpp
+++ b/src/profiling/ProfilingService.cpp
@@ -251,6 +251,11 @@ ProfilingStaticGuid ProfilingService::GenerateStaticId(const std::string& str)
return m_GuidGenerator.GenerateStaticId(str);
}
+std::unique_ptr<ISendTimelinePacket> ProfilingService::GetSendTimelinePacket() const
+{
+ return m_TimelinePacketWriterFactory.GetSendTimelinePacket();
+}
+
void ProfilingService::Initialize()
{
// Register a category for the basic runtime counters
diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp
index c70c670a87..54b0f93694 100644
--- a/src/profiling/ProfilingService.hpp
+++ b/src/profiling/ProfilingService.hpp
@@ -5,19 +5,20 @@
#pragma once
-#include "ProfilingStateMachine.hpp"
-#include "ProfilingConnectionFactory.hpp"
+#include "BufferManager.hpp"
+#include "CommandHandler.hpp"
+#include "ConnectionAcknowledgedCommandHandler.hpp"
#include "CounterDirectory.hpp"
#include "ICounterValues.hpp"
-#include "CommandHandler.hpp"
-#include "BufferManager.hpp"
-#include "SendCounterPacket.hpp"
#include "PeriodicCounterCapture.hpp"
-#include "ConnectionAcknowledgedCommandHandler.hpp"
-#include "RequestCounterDirectoryCommandHandler.hpp"
#include "PeriodicCounterSelectionCommandHandler.hpp"
#include "PerJobCounterSelectionCommandHandler.hpp"
+#include "ProfilingConnectionFactory.hpp"
#include "ProfilingGuidGenerator.hpp"
+#include "ProfilingStateMachine.hpp"
+#include "RequestCounterDirectoryCommandHandler.hpp"
+#include "SendCounterPacket.hpp"
+#include "TimelinePacketWriterFactory.hpp"
namespace armnn
{
@@ -73,6 +74,8 @@ public:
/// Create a ProfilingStaticGuid based on a hash of the string
ProfilingStaticGuid GenerateStaticId(const std::string& str) override;
+ std::unique_ptr<ISendTimelinePacket> GetSendTimelinePacket() const;
+
private:
// Copy/move constructors/destructors and copy/move assignment operators are deleted
ProfilingService(const ProfilingService&) = delete;
@@ -109,6 +112,7 @@ private:
PeriodicCounterSelectionCommandHandler m_PeriodicCounterSelectionCommandHandler;
PerJobCounterSelectionCommandHandler m_PerJobCounterSelectionCommandHandler;
ProfilingGuidGenerator m_GuidGenerator;
+ TimelinePacketWriterFactory m_TimelinePacketWriterFactory;
protected:
// Default constructor/destructor kept protected for testing
@@ -151,6 +155,7 @@ protected:
5,
m_PacketVersionResolver.ResolvePacketVersion(0, 5).GetEncodedValue(),
m_StateMachine)
+ , m_TimelinePacketWriterFactory(m_BufferManager)
{
// Register the "Connection Acknowledged" command handler
m_CommandHandlerRegistry.RegisterFunctor(&m_ConnectionAcknowledgedCommandHandler);
diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp
index 4045d263fa..9b144bb3d3 100644
--- a/src/profiling/test/SendTimelinePacketTests.cpp
+++ b/src/profiling/test/SendTimelinePacketTests.cpp
@@ -403,4 +403,15 @@ BOOST_AUTO_TEST_CASE(GetGuidsFromProfilingService)
BOOST_CHECK(dynamicGuid == expectedDynamicValue);
}
+BOOST_AUTO_TEST_CASE(GetTimelinePackerWriterFromProfilingService)
+{
+ armnn::Runtime::CreationOptions::ExternalProfilingOptions options;
+ options.m_EnableProfiling = true;
+ ProfilingService& profilingService = ProfilingService::Instance();
+ profilingService.ResetExternalProfilingOptions(options, true);
+
+ std::unique_ptr<ISendTimelinePacket> writer = profilingService.GetSendTimelinePacket();
+ BOOST_CHECK(writer != nullptr);
+}
+
BOOST_AUTO_TEST_SUITE_END()