aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKeith Davis <keith.davis@arm.com>2020-03-30 10:43:41 +0100
committerFinn Williams <Finn.Williams@arm.com>2020-04-02 16:56:24 +0100
commit33ed221e2e8e3a77b5f543061e0cce07b259fc64 (patch)
tree8467f2e4ce019bfa2837ae1030c321509414780c /tests
parent0fe279bbf22fd2116b283b9df61076d526f115e4 (diff)
downloadarmnn-33ed221e2e8e3a77b5f543061e0cce07b259fc64.tar.gz
IVGCVSW-4455 Add an Activate and Deactivate control packet to the protocol
* Add Activate/Deactivate command handlers * Add IReportStructure, INotifyBackends single function interfaces * Add overrided mechanism to report structure in Runtime.cpp * Add overrided mechanism to notify backends in ProfilingService.cpp * Add optional IReportStructure argument to ProfilingService constructor for use in ActivateTimelineReportingCommandHandler * Refactoring and tidying up indentation * Removal of unused code in ProfilingUtils.cpp and ProfilingService.cpp * Added GatordMock end to end test * Fixed an issue with SendCounterPacket sending duplicate packets * Fixed an issue with DirectoryCaptureCommandHandler handling of Optional Signed-off-by: Keith Davis <keith.davis@arm.com> Signed-off-by: Finn Williams <Finn.Williams@arm.com> Change-Id: I5ef1b74171459bfc649861dedf99921d22c9e63f
Diffstat (limited to 'tests')
-rw-r--r--tests/profiling/gatordmock/GatordMockMain.cpp44
-rw-r--r--tests/profiling/gatordmock/GatordMockService.cpp27
-rw-r--r--tests/profiling/gatordmock/GatordMockService.hpp75
-rw-r--r--tests/profiling/gatordmock/tests/GatordMockTests.cpp228
4 files changed, 231 insertions, 143 deletions
diff --git a/tests/profiling/gatordmock/GatordMockMain.cpp b/tests/profiling/gatordmock/GatordMockMain.cpp
index e19461f6cb..029c58f5e8 100644
--- a/tests/profiling/gatordmock/GatordMockMain.cpp
+++ b/tests/profiling/gatordmock/GatordMockMain.cpp
@@ -3,16 +3,10 @@
// SPDX-License-Identifier: MIT
//
-#include "PacketVersionResolver.hpp"
#include "CommandFileParser.hpp"
#include "CommandLineProcessor.hpp"
-#include "DirectoryCaptureCommandHandler.hpp"
#include "GatordMockService.hpp"
-#include "PeriodicCounterCaptureCommandHandler.hpp"
-#include "PeriodicCounterSelectionResponseHandler.hpp"
#include <TimelineDecoder.hpp>
-#include <TimelineDirectoryCaptureCommandHandler.hpp>
-#include <TimelineCaptureCommandHandler.hpp>
#include <iostream>
#include <string>
@@ -32,38 +26,7 @@ void exit_capture(int signum)
bool CreateMockService(armnnUtils::Sockets::Socket clientConnection, std::string commandFile, bool isEchoEnabled)
{
- profiling::PacketVersionResolver packetVersionResolver;
- // Create the Command Handler Registry
- profiling::CommandHandlerRegistry registry;
-
- timelinedecoder::TimelineDecoder timelineDecoder;
- timelineDecoder.SetDefaultCallbacks();
-
- // This functor will receive back the selection response packet.
- PeriodicCounterSelectionResponseHandler periodicCounterSelectionResponseHandler(
- 0, 4, packetVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue());
- // This functor will receive the counter data.
- PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(
- 3, 0, packetVersionResolver.ResolvePacketVersion(3, 0).GetEncodedValue());
-
- profiling::DirectoryCaptureCommandHandler directoryCaptureCommandHandler(
- 0, 2, packetVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue(), false);
-
- timelinedecoder::TimelineCaptureCommandHandler timelineCaptureCommandHandler(
- 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder);
-
- timelinedecoder::TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
- 1, 0, packetVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(),
- timelineCaptureCommandHandler, false);
-
- // Register different derived functors
- registry.RegisterFunctor(&periodicCounterSelectionResponseHandler);
- registry.RegisterFunctor(&counterCaptureCommandHandler);
- registry.RegisterFunctor(&directoryCaptureCommandHandler);
- registry.RegisterFunctor(&timelineDirectoryCaptureCommandHandler);
- registry.RegisterFunctor(&timelineCaptureCommandHandler);
-
- GatordMockService mockService(clientConnection, registry, isEchoEnabled);
+ GatordMockService mockService(clientConnection, isEchoEnabled);
// Send receive the strweam metadata and send connection ack.
if (!mockService.WaitForStreamMetaData())
@@ -82,11 +45,6 @@ bool CreateMockService(armnnUtils::Sockets::Socket clientConnection, std::string
// Once we've finished processing the file wait for the receiving thread to close.
mockService.WaitForReceivingThread();
- if(isEchoEnabled)
- {
- timelineDecoder.print();
- }
-
return EXIT_SUCCESS;
}
diff --git a/tests/profiling/gatordmock/GatordMockService.cpp b/tests/profiling/gatordmock/GatordMockService.cpp
index a3f732cb55..3e19c25b6c 100644
--- a/tests/profiling/gatordmock/GatordMockService.cpp
+++ b/tests/profiling/gatordmock/GatordMockService.cpp
@@ -131,10 +131,30 @@ void GatordMockService::SendRequestCounterDir()
{
std::cout << "Sending connection acknowledgement." << std::endl;
}
- // The connection ack packet is an empty data packet with packetId == 1.
+ // The request counter directory packet is an empty data packet with packetId == 3.
SendPacket(0, 3, nullptr, 0);
}
+void GatordMockService::SendActivateTimelinePacket()
+{
+ if (m_EchoPackets)
+ {
+ std::cout << "Sending activate timeline packet." << std::endl;
+ }
+ // The activate timeline packet is an empty data packet with packetId == 6.
+ SendPacket(0, 6, nullptr, 0);
+}
+
+void GatordMockService::SendDeactivateTimelinePacket()
+{
+ if (m_EchoPackets)
+ {
+ std::cout << "Sending deactivate timeline packet." << std::endl;
+ }
+ // The deactivate timeline packet is an empty data packet with packetId == 7.
+ SendPacket(0, 7, nullptr, 0);
+}
+
bool GatordMockService::LaunchReceivingThread()
{
if (m_EchoPackets)
@@ -165,6 +185,11 @@ void GatordMockService::WaitForReceivingThread()
// Wait for the receiving thread to complete operations
m_ListeningThread.join();
}
+
+ if(m_EchoPackets)
+ {
+ m_TimelineDecoder.print();
+ }
}
void GatordMockService::SendPeriodicCounterSelectionList(uint32_t period, std::vector<uint16_t> counters)
diff --git a/tests/profiling/gatordmock/GatordMockService.hpp b/tests/profiling/gatordmock/GatordMockService.hpp
index c00685fff2..2ff93c9de6 100644
--- a/tests/profiling/gatordmock/GatordMockService.hpp
+++ b/tests/profiling/gatordmock/GatordMockService.hpp
@@ -13,6 +13,15 @@
#include <string>
#include <thread>
+#include <TimelineDecoder.hpp>
+#include <DirectoryCaptureCommandHandler.hpp>
+#include <TimelineCaptureCommandHandler.hpp>
+#include <TimelineDirectoryCaptureCommandHandler.hpp>
+#include "PeriodicCounterCaptureCommandHandler.hpp"
+#include "StreamMetadataCommandHandler.hpp"
+
+#include "PacketVersionResolver.hpp"
+
namespace armnn
{
@@ -39,15 +48,33 @@ class GatordMockService
public:
/// @param registry reference to a command handler registry.
/// @param echoPackets if true the raw packets will be printed to stdout.
- GatordMockService(armnnUtils::Sockets::Socket clientConnection,
- armnn::profiling::CommandHandlerRegistry& registry,
- bool echoPackets)
+ GatordMockService(armnnUtils::Sockets::Socket clientConnection, bool echoPackets)
: m_ClientConnection(clientConnection)
- , m_HandlerRegistry(registry)
+ , m_PacketsReceivedCount(0)
, m_EchoPackets(echoPackets)
, m_CloseReceivingThread(false)
+ , m_PacketVersionResolver()
+ , m_HandlerRegistry()
+ , m_TimelineDecoder()
+ , m_StreamMetadataCommandHandler(
+ 0, 0, m_PacketVersionResolver.ResolvePacketVersion(0, 0).GetEncodedValue(), true)
+ , m_CounterCaptureCommandHandler(
+ 0, 4, m_PacketVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue(), true)
+ , m_DirectoryCaptureCommandHandler(
+ 0, 2, m_PacketVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue(), true)
+ , m_TimelineCaptureCommandHandler(
+ 1, 1, m_PacketVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), m_TimelineDecoder)
+ , m_TimelineDirectoryCaptureCommandHandler(
+ 1, 0, m_PacketVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(),
+ m_TimelineCaptureCommandHandler, true)
{
- m_PacketsReceivedCount.store(0, std::memory_order_relaxed);
+ m_TimelineDecoder.SetDefaultCallbacks();
+
+ m_HandlerRegistry.RegisterFunctor(&m_StreamMetadataCommandHandler);
+ m_HandlerRegistry.RegisterFunctor(&m_CounterCaptureCommandHandler);
+ m_HandlerRegistry.RegisterFunctor(&m_DirectoryCaptureCommandHandler);
+ m_HandlerRegistry.RegisterFunctor(&m_TimelineDirectoryCaptureCommandHandler);
+ m_HandlerRegistry.RegisterFunctor(&m_TimelineCaptureCommandHandler);
}
~GatordMockService()
@@ -74,6 +101,12 @@ public:
/// Send a request counter directory packet back to the client.
void SendRequestCounterDir();
+ /// Send a activate timeline packet back to the client.
+ void SendActivateTimelinePacket();
+
+ /// Send a deactivate timeline packet back to the client.
+ void SendDeactivateTimelinePacket();
+
/// Start the thread that will receive all packets and print them nicely to stdout.
bool LaunchReceivingThread();
@@ -115,6 +148,22 @@ public:
return m_StreamMetaDataPid;
}
+ profiling::DirectoryCaptureCommandHandler& GetDirectoryCaptureCommandHandler()
+ {
+ return m_DirectoryCaptureCommandHandler;
+ }
+
+ timelinedecoder::TimelineDecoder& GetTimelineDecoder()
+ {
+ return m_TimelineDecoder;
+ }
+
+ timelinedecoder::TimelineDirectoryCaptureCommandHandler& GetTimelineDirectoryCaptureCommandHandler()
+ {
+ return m_TimelineDirectoryCaptureCommandHandler;
+ }
+
+
private:
void ReceiveLoop(GatordMockService& mockService);
@@ -141,18 +190,30 @@ private:
static const uint32_t PIPE_MAGIC = 0x45495434;
- std::atomic<uint32_t> m_PacketsReceivedCount;
TargetEndianness m_Endianness;
uint32_t m_StreamMetaDataVersion;
uint32_t m_StreamMetaDataMaxDataLen;
uint32_t m_StreamMetaDataPid;
armnnUtils::Sockets::Socket m_ClientConnection;
- armnn::profiling::CommandHandlerRegistry& m_HandlerRegistry;
+ std::atomic<uint32_t> m_PacketsReceivedCount;
bool m_EchoPackets;
std::thread m_ListeningThread;
std::atomic<bool> m_CloseReceivingThread;
+
+ profiling::PacketVersionResolver m_PacketVersionResolver;
+ profiling::CommandHandlerRegistry m_HandlerRegistry;
+
+ timelinedecoder::TimelineDecoder m_TimelineDecoder;
+
+ gatordmock::StreamMetadataCommandHandler m_StreamMetadataCommandHandler;
+ gatordmock::PeriodicCounterCaptureCommandHandler m_CounterCaptureCommandHandler;
+
+ profiling::DirectoryCaptureCommandHandler m_DirectoryCaptureCommandHandler;
+
+ timelinedecoder::TimelineCaptureCommandHandler m_TimelineCaptureCommandHandler;
+ timelinedecoder::TimelineDirectoryCaptureCommandHandler m_TimelineDirectoryCaptureCommandHandler;
};
} // namespace gatordmock
diff --git a/tests/profiling/gatordmock/tests/GatordMockTests.cpp b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
index 7d938bd404..7417946844 100644
--- a/tests/profiling/gatordmock/tests/GatordMockTests.cpp
+++ b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
@@ -9,12 +9,14 @@
#include <LabelsAndEventClasses.hpp>
#include <PeriodicCounterCaptureCommandHandler.hpp>
#include <ProfilingService.hpp>
-#include <StreamMetadataCommandHandler.hpp>
#include <TimelinePacketWriterFactory.hpp>
#include <TimelineDirectoryCaptureCommandHandler.hpp>
#include <TimelineDecoder.hpp>
+#include <Runtime.hpp>
+#include "../../src/backends/backendsCommon/test/MockBackend.hpp"
+
#include <boost/cast.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test_suite.hpp>
@@ -104,6 +106,19 @@ BOOST_AUTO_TEST_CASE(CounterCaptureHandlingTest)
}
}
+void WaitFor(std::function<bool()> predicate, std::string errorMsg, uint32_t timeout = 2000, uint32_t sleepTime = 50)
+{
+ uint32_t timeSlept = 0;
+ while (!predicate())
+ {
+ if (timeSlept >= timeout)
+ {
+ BOOST_FAIL("Timeout: " + errorMsg);
+ }
+ std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
+ timeSlept += sleepTime;
+ }
+}
void CheckTimelineDirectory(timelinedecoder::TimelineDirectoryCaptureCommandHandler& commandHandler)
{
@@ -211,43 +226,6 @@ BOOST_AUTO_TEST_CASE(GatorDMockEndToEnd)
// The purpose of this test is to setup both sides of the profiling service and get to the point of receiving
// performance data.
- //These variables are used to wait for the profiling service
- uint32_t timeout = 2000;
- uint32_t sleepTime = 50;
- uint32_t timeSlept = 0;
-
- profiling::PacketVersionResolver packetVersionResolver;
-
- // Create the Command Handler Registry
- profiling::CommandHandlerRegistry registry;
-
- timelinedecoder::TimelineDecoder timelineDecoder;
- timelineDecoder.SetDefaultCallbacks();
-
- // Update with derived functors
- gatordmock::StreamMetadataCommandHandler streamMetadataCommandHandler(
- 0, 0, packetVersionResolver.ResolvePacketVersion(0, 0).GetEncodedValue(), true);
-
- gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(
- 0, 4, packetVersionResolver.ResolvePacketVersion(0, 4).GetEncodedValue(), true);
-
- profiling::DirectoryCaptureCommandHandler directoryCaptureCommandHandler(
- 0, 2, packetVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue(), true);
-
- timelinedecoder::TimelineCaptureCommandHandler timelineCaptureCommandHandler(
- 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder);
-
- timelinedecoder::TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
- 1, 0, packetVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(),
- timelineCaptureCommandHandler, true);
-
- // Register different derived functors
- registry.RegisterFunctor(&streamMetadataCommandHandler);
- registry.RegisterFunctor(&counterCaptureCommandHandler);
- registry.RegisterFunctor(&directoryCaptureCommandHandler);
- registry.RegisterFunctor(&timelineDirectoryCaptureCommandHandler);
- registry.RegisterFunctor(&timelineCaptureCommandHandler);
-
// Setup the mock service to bind to the UDS.
std::string udsNamespace = "gatord_namespace";
@@ -279,18 +257,15 @@ BOOST_AUTO_TEST_CASE(GatorDMockEndToEnd)
BOOST_FAIL("Failed to connect client");
}
- gatordmock::GatordMockService mockService(clientSocket, registry, false);
+ gatordmock::GatordMockService mockService(clientSocket, false);
+
+ timelinedecoder::TimelineDecoder& timelineDecoder = mockService.GetTimelineDecoder();
+ profiling::DirectoryCaptureCommandHandler& directoryCaptureCommandHandler =
+ mockService.GetDirectoryCaptureCommandHandler();
// Give the profiling service sending thread time start executing and send the stream metadata.
- while (profilingService.GetCurrentState() != profiling::ProfilingState::WaitingForAck)
- {
- if (timeSlept >= timeout)
- {
- BOOST_FAIL("Timeout: Profiling service did not switch to WaitingForAck state");
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
- timeSlept += sleepTime;
- }
+ WaitFor([&](){return profilingService.GetCurrentState() == profiling::ProfilingState::WaitingForAck;},
+ "Profiling service did not switch to WaitingForAck state");
profilingService.Update();
// Read the stream metadata on the mock side.
@@ -300,55 +275,21 @@ BOOST_AUTO_TEST_CASE(GatorDMockEndToEnd)
}
// Send Ack from GatorD
mockService.SendConnectionAck();
+ // And start to listen for packets
+ mockService.LaunchReceivingThread();
- timeSlept = 0;
- while (profilingService.GetCurrentState() != profiling::ProfilingState::Active)
- {
- if (timeSlept >= timeout)
- {
- BOOST_FAIL("Timeout: Profiling service did not switch to Active state");
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
- timeSlept += sleepTime;
- }
+ WaitFor([&](){return profilingService.GetCurrentState() == profiling::ProfilingState::Active;},
+ "Profiling service did not switch to Active state");
- mockService.LaunchReceivingThread();
// As part of the default startup of the profiling service a counter directory packet will be sent.
- timeSlept = 0;
- while (!directoryCaptureCommandHandler.ParsedCounterDirectory())
- {
- if (timeSlept >= timeout)
- {
- BOOST_FAIL("Timeout: MockGatord did not receive counter directory packet");
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
- timeSlept += sleepTime;
- }
+ WaitFor([&](){return directoryCaptureCommandHandler.ParsedCounterDirectory();},
+ "MockGatord did not receive counter directory packet");
- // As part of the default startup of the profiling service a counter directory packet will be sent.
- timeSlept = 0;
- while (!directoryCaptureCommandHandler.ParsedCounterDirectory())
- {
- if (timeSlept >= timeout)
- {
- BOOST_FAIL("Timeout: MockGatord did not receive counter directory packet");
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
- timeSlept += sleepTime;
- }
+ // Following that we will receive a collection of well known timeline labels and event classes
+ WaitFor([&](){return timelineDecoder.GetModel().m_EventClasses.size() >= 2;},
+ "MockGatord did not receive well known timeline labels and event classes");
- timeSlept = 0;
- while (timelineDecoder.GetModel().m_EventClasses.size() < 2)
- {
- if (timeSlept >= timeout)
- {
- BOOST_FAIL("Timeout: MockGatord did not receive well known timeline labels");
- }
- std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
- timeSlept += sleepTime;
- }
-
- CheckTimelineDirectory(timelineDirectoryCaptureCommandHandler);
+ CheckTimelineDirectory(mockService.GetTimelineDirectoryCaptureCommandHandler());
// Verify the commonly used timeline packets sent when the profiling service enters the active state
CheckTimelinePackets(timelineDecoder);
@@ -439,4 +380,107 @@ BOOST_AUTO_TEST_CASE(GatorDMockEndToEnd)
// PeriodicCounterCapture data received. These are yet to be integrated.
}
+BOOST_AUTO_TEST_CASE(GatorDMockTimeLineActivation)
+{
+ armnn::MockBackendInitialiser initialiser;
+ // Setup the mock service to bind to the UDS.
+ std::string udsNamespace = "gatord_namespace";
+
+ armnnUtils::Sockets::Initialize();
+ armnnUtils::Sockets::Socket listeningSocket = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
+
+ if (!gatordmock::GatordMockService::OpenListeningSocket(listeningSocket, udsNamespace))
+ {
+ BOOST_FAIL("Failed to open Listening Socket");
+ }
+
+ armnn::IRuntime::CreationOptions options;
+ options.m_ProfilingOptions.m_EnableProfiling = true;
+ armnn::Runtime runtime(options);
+
+ armnnUtils::Sockets::Socket clientConnection;
+ clientConnection = armnnUtils::Sockets::Accept(listeningSocket, nullptr, nullptr, SOCK_CLOEXEC);
+ gatordmock::GatordMockService mockService(clientConnection, false);
+
+ // Read the stream metadata on the mock side.
+ if (!mockService.WaitForStreamMetaData())
+ {
+ BOOST_FAIL("Failed to receive StreamMetaData");
+ }
+
+ armnn::MockBackendProfilingService mockProfilingService = armnn::MockBackendProfilingService::Instance();
+ armnn::MockBackendProfilingContext *mockBackEndProfilingContext = mockProfilingService.GetContext();
+
+ // Send Ack from GatorD
+ mockService.SendConnectionAck();
+ // And start to listen for packets
+ mockService.LaunchReceivingThread();
+
+ // Build and optimize a simple network while we wait
+ INetworkPtr net(INetwork::Create());
+
+ IConnectableLayer* input = net->AddInputLayer(0, "input");
+
+ NormalizationDescriptor descriptor;
+ IConnectableLayer* normalize = net->AddNormalizationLayer(descriptor, "normalization");
+
+ IConnectableLayer* output = net->AddOutputLayer(0, "output");
+
+ input->GetOutputSlot(0).Connect(normalize->GetInputSlot(0));
+ normalize->GetOutputSlot(0).Connect(output->GetInputSlot(0));
+
+ input->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
+ normalize->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 4, 4 }, DataType::Float32));
+
+ std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
+ IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime.GetDeviceSpec());
+
+ WaitFor([&](){return mockService.GetDirectoryCaptureCommandHandler().ParsedCounterDirectory();},
+ "MockGatord did not receive counter directory packet");
+
+ timelinedecoder::TimelineDecoder& timelineDecoder = mockService.GetTimelineDecoder();
+
+ WaitFor([&](){return timelineDecoder.GetModel().m_EventClasses.size() >= 2;},
+ "MockGatord did not receive well known timeline labels");
+
+ // Packets we expect from SendWellKnownLabelsAndEventClassesTest
+ BOOST_CHECK(timelineDecoder.GetModel().m_Entities.size() == 0);
+ BOOST_CHECK(timelineDecoder.GetModel().m_EventClasses.size() == 2);
+ BOOST_CHECK(timelineDecoder.GetModel().m_Labels.size() == 10);
+ BOOST_CHECK(timelineDecoder.GetModel().m_Relationships.size() == 0);
+ BOOST_CHECK(timelineDecoder.GetModel().m_Events.size() == 0);
+
+ mockService.SendDeactivateTimelinePacket();
+
+ WaitFor([&](){return !mockBackEndProfilingContext->TimelineReportingEnabled();},
+ "Timeline packets were not deactivated");
+
+ // Load the network into runtime now that timeline reporting is disabled
+ armnn::NetworkId netId;
+ runtime.LoadNetwork(netId, std::move(optNet));
+
+ // Now activate timeline packets
+ mockService.SendActivateTimelinePacket();
+
+ WaitFor([&](){return mockBackEndProfilingContext->TimelineReportingEnabled();},
+ "Timeline packets were not activated");
+
+ // Once timeline packets have been reactivated the ActivateTimelineReportingCommandHandler will resend the
+ // SendWellKnownLabelsAndEventClasses and then send the structure of any loaded networks
+ WaitFor([&](){return timelineDecoder.GetModel().m_Labels.size() >= 24;},
+ "MockGatord did not receive well known timeline labels");
+
+ // Packets we expect from SendWellKnownLabelsAndEventClassesTest * 2 and the loaded model
+ BOOST_CHECK(timelineDecoder.GetModel().m_Entities.size() == 5);
+ BOOST_CHECK(timelineDecoder.GetModel().m_EventClasses.size() == 4);
+ BOOST_CHECK(timelineDecoder.GetModel().m_Labels.size() == 24);
+ BOOST_CHECK(timelineDecoder.GetModel().m_Relationships.size() == 28);
+ BOOST_CHECK(timelineDecoder.GetModel().m_Events.size() == 0);
+
+ mockService.WaitForReceivingThread();
+ armnnUtils::Sockets::Close(listeningSocket);
+
+ GetProfilingService(&runtime).Disconnect();
+}
+
BOOST_AUTO_TEST_SUITE_END()