aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Flynn <jim.flynn@arm.com>2020-07-20 16:57:44 +0100
committerJim Flynn <jim.flynn@arm.com>2020-07-29 15:35:15 +0100
commitbbfe603e5ae42317a2b67d713d00882bea341c88 (patch)
tree8d8a78d6836384fb92fb9741c865443624dfec68 /src
parenta9c2ce123a6a5a68728d040a0323c482bbe46903 (diff)
downloadarmnn-bbfe603e5ae42317a2b67d713d00882bea341c88.tar.gz
IVGCVSW-5166 Pull out the common and server side code into standalone libraries
Change-Id: I180f84c493a9b2be4b93b25d312ebdd9e71b1735 Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src')
-rw-r--r--src/armnn/Logging.cpp4
-rw-r--r--src/armnn/test/UnitTests.cpp4
-rw-r--r--src/armnn/test/UnitTests.hpp2
-rw-r--r--src/armnnUtils/Processes.cpp2
-rw-r--r--src/armnnUtils/Threads.cpp2
-rw-r--r--src/armnnUtils/WindowsWrapper.hpp17
-rw-r--r--src/backends/backendsCommon/test/BackendProfilingTests.cpp8
-rw-r--r--src/profiling/ActivateTimelineReportingCommandHandler.cpp4
-rw-r--r--src/profiling/ActivateTimelineReportingCommandHandler.hpp10
-rw-r--r--src/profiling/CommandHandler.cpp27
-rw-r--r--src/profiling/CommandHandler.hpp15
-rw-r--r--src/profiling/CommandHandlerFunctor.cpp31
-rw-r--r--src/profiling/CommandHandlerFunctor.hpp45
-rw-r--r--src/profiling/CommandHandlerKey.cpp77
-rw-r--r--src/profiling/CommandHandlerKey.hpp41
-rw-r--r--src/profiling/CommandHandlerRegistry.cpp63
-rw-r--r--src/profiling/CommandHandlerRegistry.hpp49
-rw-r--r--src/profiling/ConnectionAcknowledgedCommandHandler.cpp2
-rw-r--r--src/profiling/ConnectionAcknowledgedCommandHandler.hpp9
-rw-r--r--src/profiling/CounterDirectory.cpp19
-rw-r--r--src/profiling/CounterDirectory.hpp12
-rw-r--r--src/profiling/DeactivateTimelineReportingCommandHandler.cpp4
-rw-r--r--src/profiling/DeactivateTimelineReportingCommandHandler.hpp11
-rw-r--r--src/profiling/DirectoryCaptureCommandHandler.cpp7
-rw-r--r--src/profiling/DirectoryCaptureCommandHandler.hpp11
-rw-r--r--src/profiling/EncodeVersion.hpp83
-rw-r--r--src/profiling/FileOnlyProfilingConnection.cpp32
-rw-r--r--src/profiling/FileOnlyProfilingConnection.hpp19
-rw-r--r--src/profiling/IProfilingConnection.hpp5
-rw-r--r--src/profiling/PacketVersionResolver.cpp73
-rw-r--r--src/profiling/PacketVersionResolver.hpp50
-rw-r--r--src/profiling/PerJobCounterSelectionCommandHandler.cpp15
-rw-r--r--src/profiling/PerJobCounterSelectionCommandHandler.hpp11
-rw-r--r--src/profiling/PeriodicCounterSelectionCommandHandler.cpp6
-rw-r--r--src/profiling/PeriodicCounterSelectionCommandHandler.hpp14
-rw-r--r--src/profiling/ProfilingConnectionDumpToFileDecorator.cpp8
-rw-r--r--src/profiling/ProfilingConnectionDumpToFileDecorator.hpp6
-rw-r--r--src/profiling/ProfilingConnectionFactory.cpp2
-rw-r--r--src/profiling/ProfilingConnectionFactory.hpp2
-rw-r--r--src/profiling/ProfilingService.cpp2
-rw-r--r--src/profiling/ProfilingService.hpp34
-rw-r--r--src/profiling/ProfilingUtils.cpp227
-rw-r--r--src/profiling/ProfilingUtils.hpp120
-rw-r--r--src/profiling/RequestCounterDirectoryCommandHandler.cpp2
-rw-r--r--src/profiling/RequestCounterDirectoryCommandHandler.hpp9
-rw-r--r--src/profiling/SendCounterPacket.cpp45
-rw-r--r--src/profiling/SendThread.cpp7
-rw-r--r--src/profiling/SocketProfilingConnection.cpp51
-rw-r--r--src/profiling/SocketProfilingConnection.hpp6
-rw-r--r--src/profiling/test/BufferTests.cpp10
-rw-r--r--src/profiling/test/PrintPacketHeaderHandler.cpp5
-rw-r--r--src/profiling/test/PrintPacketHeaderHandler.hpp7
-rw-r--r--src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp12
-rw-r--r--src/profiling/test/ProfilingMocks.hpp6
-rw-r--r--src/profiling/test/ProfilingTests.cpp361
-rw-r--r--src/profiling/test/ProfilingTests.hpp22
-rw-r--r--src/profiling/test/RequestCountersPacketHandler.cpp10
-rw-r--r--src/profiling/test/RequestCountersPacketHandler.hpp7
-rw-r--r--src/profiling/test/SendCounterPacketTests.cpp32
-rw-r--r--src/profiling/test/SendTimelinePacketTests.cpp28
-rw-r--r--src/profiling/test/TestTimelinePacketHandler.cpp35
-rw-r--r--src/profiling/test/TestTimelinePacketHandler.hpp21
-rw-r--r--src/profiling/test/TimelineModel.cpp54
-rw-r--r--src/profiling/test/TimelineModel.hpp34
-rw-r--r--src/profiling/test/TimelinePacketTests.cpp10
-rw-r--r--src/timelineDecoder/CMakeLists.txt26
-rw-r--r--src/timelineDecoder/JSONTimelineDecoder.cpp1
-rw-r--r--src/timelineDecoder/JSONTimelineDecoder.hpp4
-rw-r--r--src/timelineDecoder/TimelineCaptureCommandHandler.cpp164
-rw-r--r--src/timelineDecoder/TimelineCaptureCommandHandler.hpp65
-rw-r--r--src/timelineDecoder/TimelineDecoder.cpp323
-rw-r--r--src/timelineDecoder/TimelineDecoder.hpp70
-rw-r--r--src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp118
-rw-r--r--src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp52
-rw-r--r--src/timelineDecoder/tests/JSONTimelineDecoderTests.cpp348
-rw-r--r--src/timelineDecoder/tests/TimelineTests.cpp369
76 files changed, 787 insertions, 2712 deletions
diff --git a/src/armnn/Logging.cpp b/src/armnn/Logging.cpp
index 6db4afaf49..8b46a77b79 100644
--- a/src/armnn/Logging.cpp
+++ b/src/armnn/Logging.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -9,7 +9,7 @@
#include <armnn/utility/Assert.hpp>
#if defined(_MSC_VER)
-#include <WindowsWrapper.hpp>
+#include <commons/include/WindowsWrapper.hpp>
#endif
#if defined(__ANDROID__)
diff --git a/src/armnn/test/UnitTests.cpp b/src/armnn/test/UnitTests.cpp
index 300eddf6e3..5d9211e44f 100644
--- a/src/armnn/test/UnitTests.cpp
+++ b/src/armnn/test/UnitTests.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#define BOOST_TEST_MODULE UnitTests
@@ -24,7 +24,7 @@ BOOST_GLOBAL_FIXTURE(ConfigureLoggingFixture);
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/tee.hpp>
#include <iostream>
-#include <WindowsWrapper.hpp>
+#include <commons/include/WindowsWrapper.hpp>
using namespace boost::iostreams;
using namespace std;
diff --git a/src/armnn/test/UnitTests.hpp b/src/armnn/test/UnitTests.hpp
index f7c49a5c2a..2d9c1583d2 100644
--- a/src/armnn/test/UnitTests.hpp
+++ b/src/armnn/test/UnitTests.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
diff --git a/src/armnnUtils/Processes.cpp b/src/armnnUtils/Processes.cpp
index 41b035b887..eb68dd9dff 100644
--- a/src/armnnUtils/Processes.cpp
+++ b/src/armnnUtils/Processes.cpp
@@ -8,7 +8,7 @@
#if defined(__unix__) || defined(__APPLE__)
#include <unistd.h>
#elif defined(_MSC_VER)
-#include "WindowsWrapper.hpp"
+#include <commons/include/WindowsWrapper.hpp>
#endif
namespace armnnUtils
diff --git a/src/armnnUtils/Threads.cpp b/src/armnnUtils/Threads.cpp
index 0ca1adf0c3..3ee8174d01 100644
--- a/src/armnnUtils/Threads.cpp
+++ b/src/armnnUtils/Threads.cpp
@@ -10,7 +10,7 @@
#include <sys/syscall.h>
#define gettid() syscall(SYS_gettid)
#elif defined(_MSC_VER)
-#include "WindowsWrapper.hpp"
+#include <commons/include/WindowsWrapper.hpp>
#elif defined(__APPLE__)
#include "AvailabilityMacros.h"
#include <sys/syscall.h>
diff --git a/src/armnnUtils/WindowsWrapper.hpp b/src/armnnUtils/WindowsWrapper.hpp
deleted file mode 100644
index 7f02cb1a16..0000000000
--- a/src/armnnUtils/WindowsWrapper.hpp
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// Copyright © 2020 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-// This header brings in the Win32 API header, with some small modifications applied to prevent clashes with our code.
-
-#if defined(_MSC_VER)
-
-#define NOMINMAX // Prevent definition of min/max macros that interfere with std::min/max
-#define WIN32_LEAN_AND_MEAN
-#include <Windows.h>
-// Windows.h defines some names that we don't need and interfere with some of our definition
-#undef TIME_MS // Instrument.hpp
-#undef CreateEvent // ITimelineDecoder.hpp
-
-#endif
diff --git a/src/backends/backendsCommon/test/BackendProfilingTests.cpp b/src/backends/backendsCommon/test/BackendProfilingTests.cpp
index 306c0240df..8434536ca0 100644
--- a/src/backends/backendsCommon/test/BackendProfilingTests.cpp
+++ b/src/backends/backendsCommon/test/BackendProfilingTests.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -93,7 +93,7 @@ private:
std::vector<Timestamp> m_timestamps;
};
-Packet PacketWriter(uint32_t period, std::vector<uint16_t> countervalues)
+arm::pipe::Packet PacketWriter(uint32_t period, std::vector<uint16_t> countervalues)
{
const uint32_t packetId = 0x40000;
uint32_t offset = 0;
@@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE(BackendProfilingCounterRegisterMockBackendTest)
BOOST_AUTO_TEST_CASE(TestBackendCounters)
{
Holder holder;
- PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
ProfilingStateMachine stateMachine;
ReadCounterVals readCounterVals;
CounterIdMap counterIdMap;
@@ -387,7 +387,7 @@ BOOST_AUTO_TEST_CASE(TestBackendCounterLogging)
};
Holder holder;
- PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
ProfilingStateMachine stateMachine;
ReadCounterVals readCounterVals;
StreamRedirector redirect(std::cout, ss.rdbuf());
diff --git a/src/profiling/ActivateTimelineReportingCommandHandler.cpp b/src/profiling/ActivateTimelineReportingCommandHandler.cpp
index d762efc277..614417c6de 100644
--- a/src/profiling/ActivateTimelineReportingCommandHandler.cpp
+++ b/src/profiling/ActivateTimelineReportingCommandHandler.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -15,7 +15,7 @@ namespace armnn
namespace profiling
{
-void ActivateTimelineReportingCommandHandler::operator()(const Packet& packet)
+void ActivateTimelineReportingCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
diff --git a/src/profiling/ActivateTimelineReportingCommandHandler.hpp b/src/profiling/ActivateTimelineReportingCommandHandler.hpp
index ff0e840170..a40115084b 100644
--- a/src/profiling/ActivateTimelineReportingCommandHandler.hpp
+++ b/src/profiling/ActivateTimelineReportingCommandHandler.hpp
@@ -1,11 +1,10 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include "CommandHandlerFunctor.hpp"
#include "ProfilingStateMachine.hpp"
#include "SendTimelinePacket.hpp"
#include "IReportStructure.hpp"
@@ -13,7 +12,8 @@
#include "armnn/Optional.hpp"
-#include <Packet.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
namespace armnn
@@ -22,7 +22,7 @@ namespace armnn
namespace profiling
{
-class ActivateTimelineReportingCommandHandler : public CommandHandlerFunctor
+class ActivateTimelineReportingCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
ActivateTimelineReportingCommandHandler(uint32_t familyId,
@@ -41,7 +41,7 @@ public:
m_ReportStructure(reportStructure)
{}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
SendTimelinePacket& m_SendTimelinePacket;
diff --git a/src/profiling/CommandHandler.cpp b/src/profiling/CommandHandler.cpp
index cae7037327..9f536445e9 100644
--- a/src/profiling/CommandHandler.cpp
+++ b/src/profiling/CommandHandler.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -47,7 +47,7 @@ void CommandHandler::HandleCommands(IProfilingConnection& profilingConnection)
{
try
{
- Packet packet = profilingConnection.ReadPacket(m_Timeout.load());
+ arm::pipe::Packet packet = profilingConnection.ReadPacket(m_Timeout.load());
if (packet.IsEmpty())
{
@@ -55,12 +55,12 @@ void CommandHandler::HandleCommands(IProfilingConnection& profilingConnection)
continue;
}
- Version version = m_PacketVersionResolver.ResolvePacketVersion(packet.GetPacketFamily(),
- packet.GetPacketId());
+ arm::pipe::Version version = m_PacketVersionResolver.ResolvePacketVersion(packet.GetPacketFamily(),
+ packet.GetPacketId());
- CommandHandlerFunctor* commandHandlerFunctor =
- m_CommandHandlerRegistry.GetFunctor(packet.GetPacketFamily(),
- packet.GetPacketId(),
+ arm::pipe::CommandHandlerFunctor* commandHandlerFunctor =
+ m_CommandHandlerRegistry.GetFunctor(packet.GetPacketFamily(),
+ packet.GetPacketId(),
version.GetEncodedValue());
ARMNN_ASSERT(commandHandlerFunctor);
commandHandlerFunctor->operator()(packet);
@@ -72,6 +72,19 @@ void CommandHandler::HandleCommands(IProfilingConnection& profilingConnection)
m_KeepRunning.store(false);
}
}
+ catch (const arm::pipe::ProfilingException& e)
+ {
+ // Log the error and continue
+ ARMNN_LOG(warning) << "An error has occurred when handling a command: " << e.what();
+ // Did we get here because the socket failed?
+ if ( !profilingConnection.IsOpen() )
+ {
+ // We're going to stop processing commands.
+ // This will leave the thread idle. There is no mechanism to restart the profiling service when the
+ // connection is lost.
+ m_KeepRunning.store(false);
+ }
+ }
catch (const Exception& e)
{
// Log the error and continue
diff --git a/src/profiling/CommandHandler.hpp b/src/profiling/CommandHandler.hpp
index 4bf820c5db..b2c9725a34 100644
--- a/src/profiling/CommandHandler.hpp
+++ b/src/profiling/CommandHandler.hpp
@@ -1,13 +1,14 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include "CommandHandlerRegistry.hpp"
#include "IProfilingConnection.hpp"
-#include "PacketVersionResolver.hpp"
+#include <common/include/PacketVersionResolver.hpp>
+
+#include <common/include/CommandHandlerRegistry.hpp>
#include <atomic>
#include <thread>
@@ -23,8 +24,8 @@ class CommandHandler
public:
CommandHandler(uint32_t timeout,
bool stopAfterTimeout,
- CommandHandlerRegistry& commandHandlerRegistry,
- PacketVersionResolver& packetVersionResolver)
+ arm::pipe::CommandHandlerRegistry& commandHandlerRegistry,
+ arm::pipe::PacketVersionResolver& packetVersionResolver)
: m_Timeout(timeout),
m_StopAfterTimeout(stopAfterTimeout),
m_IsRunning(false),
@@ -51,8 +52,8 @@ private:
std::atomic<bool> m_KeepRunning;
std::thread m_CommandThread;
- CommandHandlerRegistry& m_CommandHandlerRegistry;
- PacketVersionResolver& m_PacketVersionResolver;
+ arm::pipe::CommandHandlerRegistry& m_CommandHandlerRegistry;
+ arm::pipe::PacketVersionResolver& m_PacketVersionResolver;
};
} // namespace profiling
diff --git a/src/profiling/CommandHandlerFunctor.cpp b/src/profiling/CommandHandlerFunctor.cpp
deleted file mode 100644
index 7f836cba2f..0000000000
--- a/src/profiling/CommandHandlerFunctor.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "CommandHandlerFunctor.hpp"
-
-namespace armnn
-{
-
-namespace profiling
-{
-
-uint32_t CommandHandlerFunctor::GetFamilyId() const
-{
- return m_FamilyId;
-}
-
-uint32_t CommandHandlerFunctor::GetPacketId() const
-{
- return m_PacketId;
-}
-
-uint32_t CommandHandlerFunctor::GetVersion() const
-{
- return m_Version;
-}
-
-} // namespace profiling
-
-} // namespace armnn
diff --git a/src/profiling/CommandHandlerFunctor.hpp b/src/profiling/CommandHandlerFunctor.hpp
deleted file mode 100644
index 885a2f34b5..0000000000
--- a/src/profiling/CommandHandlerFunctor.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <Packet.hpp>
-
-#include <armnn/utility/IgnoreUnused.hpp>
-
-#include <cstdint>
-
-namespace armnn
-{
-
-namespace profiling
-{
-
-class CommandHandlerFunctor
-{
-public:
- CommandHandlerFunctor(uint32_t familyId, uint32_t packetId, uint32_t version)
- : m_FamilyId(familyId),
- m_PacketId(packetId)
- , m_Version(version)
- {}
-
- uint32_t GetFamilyId() const;
- uint32_t GetPacketId() const;
- uint32_t GetVersion() const;
-
- virtual void operator()(const Packet& packet) = 0;
-
- virtual ~CommandHandlerFunctor() {}
-
-private:
- uint32_t m_FamilyId;
- uint32_t m_PacketId;
- uint32_t m_Version;
-};
-
-} // namespace profiling
-
-} // namespace armnn
diff --git a/src/profiling/CommandHandlerKey.cpp b/src/profiling/CommandHandlerKey.cpp
deleted file mode 100644
index 4d7e11a7e0..0000000000
--- a/src/profiling/CommandHandlerKey.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "CommandHandlerKey.hpp"
-
-namespace armnn
-{
-
-namespace profiling
-{
-
-uint32_t CommandHandlerKey::GetFamilyId() const
-{
- return m_FamilyId;
-}
-
-uint32_t CommandHandlerKey::GetPacketId() const
-{
- return m_PacketId;
-}
-
-uint32_t CommandHandlerKey::GetVersion() const
-{
- return m_Version;
-}
-
-bool CommandHandlerKey::operator<(const CommandHandlerKey& rhs) const
-{
- bool result = true;
- if (m_FamilyId == rhs.m_FamilyId)
- {
- if (m_PacketId == rhs.m_PacketId)
- {
- result = m_Version < rhs.m_Version;
- }
- else if (m_PacketId > rhs.m_PacketId)
- {
- result = false;
- }
- }
- else if (m_FamilyId > rhs.m_FamilyId)
- {
- result = false;
- }
- return result;
-}
-
-bool CommandHandlerKey::operator>(const CommandHandlerKey& rhs) const
-{
- return rhs < *this;
-}
-
-bool CommandHandlerKey::operator<=(const CommandHandlerKey& rhs) const
-{
- return !(*this > rhs);
-}
-
-bool CommandHandlerKey::operator>=(const CommandHandlerKey& rhs) const
-{
- return !(*this < rhs);
-}
-
-bool CommandHandlerKey::operator==(const CommandHandlerKey& rhs) const
-{
- return m_FamilyId == rhs.m_FamilyId && m_PacketId == rhs.m_PacketId && m_Version == rhs.m_Version;
-}
-
-bool CommandHandlerKey::operator!=(const CommandHandlerKey& rhs) const
-{
- return !(*this == rhs);
-}
-
-} // namespace profiling
-
-} // namespace armnn
diff --git a/src/profiling/CommandHandlerKey.hpp b/src/profiling/CommandHandlerKey.hpp
deleted file mode 100644
index 247f67925b..0000000000
--- a/src/profiling/CommandHandlerKey.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <cstdint>
-
-namespace armnn
-{
-
-namespace profiling
-{
-
-class CommandHandlerKey
-{
-public:
- CommandHandlerKey(uint32_t familyId, uint32_t packetId, uint32_t version)
- : m_FamilyId(familyId), m_PacketId(packetId), m_Version(version) {};
-
- uint32_t GetFamilyId() const;
- uint32_t GetPacketId() const;
- uint32_t GetVersion() const;
-
- bool operator< (const CommandHandlerKey& rhs) const;
- bool operator> (const CommandHandlerKey& rhs) const;
- bool operator<=(const CommandHandlerKey& rhs) const;
- bool operator>=(const CommandHandlerKey& rhs) const;
- bool operator==(const CommandHandlerKey& rhs) const;
- bool operator!=(const CommandHandlerKey& rhs) const;
-
-private:
- uint32_t m_FamilyId;
- uint32_t m_PacketId;
- uint32_t m_Version;
-};
-
-} // namespace profiling
-
-} // namespace armnn
diff --git a/src/profiling/CommandHandlerRegistry.cpp b/src/profiling/CommandHandlerRegistry.cpp
deleted file mode 100644
index c2fef7a597..0000000000
--- a/src/profiling/CommandHandlerRegistry.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "CommandHandlerRegistry.hpp"
-
-#include <armnn/utility/Assert.hpp>
-
-#include <boost/format.hpp>
-
-namespace armnn
-{
-
-namespace profiling
-{
-
-void CommandHandlerRegistry::RegisterFunctor(CommandHandlerFunctor* functor,
- uint32_t familyId,
- uint32_t packetId,
- uint32_t version)
-{
- ARMNN_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
-
- CommandHandlerKey key(familyId, packetId, version);
- registry[key] = functor;
-}
-
-void CommandHandlerRegistry::RegisterFunctor(CommandHandlerFunctor* functor)
-{
- ARMNN_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
-
- RegisterFunctor(functor, functor->GetFamilyId(), functor->GetPacketId(), functor->GetVersion());
-}
-
-CommandHandlerFunctor* CommandHandlerRegistry::GetFunctor(uint32_t familyId,uint32_t packetId, uint32_t version) const
-{
- CommandHandlerKey key(familyId, packetId, version);
-
- // Check that the requested key exists
- if (registry.find(key) == registry.end())
- {
- throw armnn::InvalidArgumentException(
- boost::str(boost::format("Functor with requested PacketId=%1% and Version=%2% does not exist")
- % packetId
- % version));
- }
-
- CommandHandlerFunctor* commandHandlerFunctor = registry.at(key);
- if (commandHandlerFunctor == nullptr)
- {
- throw RuntimeException(
- boost::str(boost::format("Invalid functor registered for PacketId=%1% and Version=%2%")
- % packetId
- % version));
- }
-
- return commandHandlerFunctor;
-}
-
-} // namespace profiling
-
-} // namespace armnn
diff --git a/src/profiling/CommandHandlerRegistry.hpp b/src/profiling/CommandHandlerRegistry.hpp
deleted file mode 100644
index 43419deea4..0000000000
--- a/src/profiling/CommandHandlerRegistry.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include "CommandHandlerFunctor.hpp"
-#include "CommandHandlerKey.hpp"
-
-#include <boost/functional/hash.hpp>
-
-#include <unordered_map>
-
-namespace armnn
-{
-
-namespace profiling
-{
-
-struct CommandHandlerHash
-{
- std::size_t operator() (const CommandHandlerKey& commandHandlerKey) const
- {
- std::size_t seed = 0;
- boost::hash_combine(seed, commandHandlerKey.GetPacketId());
- boost::hash_combine(seed, commandHandlerKey.GetVersion());
- return seed;
- }
-};
-
-class CommandHandlerRegistry
-{
-public:
- CommandHandlerRegistry() = default;
-
- void RegisterFunctor(CommandHandlerFunctor* functor, uint32_t familyId, uint32_t packetId, uint32_t version);
-
- void RegisterFunctor(CommandHandlerFunctor* functor);
-
- CommandHandlerFunctor* GetFunctor(uint32_t familyId, uint32_t packetId, uint32_t version) const;
-
-private:
- std::unordered_map<CommandHandlerKey, CommandHandlerFunctor*, CommandHandlerHash> registry;
-};
-
-} // namespace profiling
-
-} // namespace armnn
diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.cpp b/src/profiling/ConnectionAcknowledgedCommandHandler.cpp
index ce2a36f9fb..7fa3785a43 100644
--- a/src/profiling/ConnectionAcknowledgedCommandHandler.cpp
+++ b/src/profiling/ConnectionAcknowledgedCommandHandler.cpp
@@ -16,7 +16,7 @@ namespace armnn
namespace profiling
{
-void ConnectionAcknowledgedCommandHandler::operator()(const Packet& packet)
+void ConnectionAcknowledgedCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
switch (currentState)
diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp
index f65b23f457..0906f7f9f3 100644
--- a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp
+++ b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp
@@ -6,20 +6,21 @@
#pragma once
#include <armnn/backends/profiling/IBackendProfilingContext.hpp>
-#include "CommandHandlerFunctor.hpp"
#include "IProfilingServiceStatus.hpp"
#include "ISendCounterPacket.hpp"
#include "armnn/profiling/ISendTimelinePacket.hpp"
-#include <Packet.hpp>
#include "ProfilingStateMachine.hpp"
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
+
namespace armnn
{
namespace profiling
{
-class ConnectionAcknowledgedCommandHandler final : public CommandHandlerFunctor
+class ConnectionAcknowledgedCommandHandler final : public arm::pipe::CommandHandlerFunctor
{
typedef const std::unordered_map<BackendId, std::shared_ptr<armnn::profiling::IBackendProfilingContext>>&
@@ -44,7 +45,7 @@ public:
, m_BackendProfilingContext(backendProfilingContexts)
{}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
void setTimelineEnabled(bool timelineEnabled)
{
diff --git a/src/profiling/CounterDirectory.cpp b/src/profiling/CounterDirectory.cpp
index ae1c49796c..e6356b82bd 100644
--- a/src/profiling/CounterDirectory.cpp
+++ b/src/profiling/CounterDirectory.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -7,10 +7,11 @@
#include "ProfilingUtils.hpp"
#include <armnn/Exceptions.hpp>
-#include <armnn/Conversion.hpp>
#include <armnn/utility/Assert.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
+#include <common/include/SwTrace.hpp>
+
#include <boost/format.hpp>
namespace armnn
@@ -23,7 +24,7 @@ const Category* CounterDirectory::RegisterCategory(const std::string& categoryNa
{
// Check that the given category name is valid
if (categoryName.empty() ||
- !IsValidSwTraceString<SwTraceNameCharPolicy>(categoryName))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(categoryName))
{
throw InvalidArgumentException("Trying to register a category with an invalid name");
}
@@ -56,7 +57,7 @@ const Device* CounterDirectory::RegisterDevice(const std::string& deviceName,
{
// Check that the given device name is valid
if (deviceName.empty() ||
- !IsValidSwTraceString<SwTraceCharPolicy>(deviceName))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>(deviceName))
{
throw InvalidArgumentException("Trying to register a device with an invalid name");
}
@@ -118,7 +119,7 @@ const CounterSet* CounterDirectory::RegisterCounterSet(const std::string& counte
{
// Check that the given counter set name is valid
if (counterSetName.empty() ||
- !IsValidSwTraceString<SwTraceNameCharPolicy>(counterSetName))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(counterSetName))
{
throw InvalidArgumentException("Trying to register a counter set with an invalid name");
}
@@ -196,7 +197,7 @@ const Counter* CounterDirectory::RegisterCounter(const BackendId& backendId,
// Check that the given parent category name is valid
if (parentCategoryName.empty() ||
- !IsValidSwTraceString<SwTraceNameCharPolicy>(parentCategoryName))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(parentCategoryName))
{
throw InvalidArgumentException("Trying to register a counter with an invalid parent category name");
}
@@ -221,21 +222,21 @@ const Counter* CounterDirectory::RegisterCounter(const BackendId& backendId,
// Check that the given name is valid
if (name.empty() ||
- !IsValidSwTraceString<SwTraceCharPolicy>(name))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>(name))
{
throw InvalidArgumentException("Trying to register a counter with an invalid name");
}
// Check that the given description is valid
if (description.empty() ||
- !IsValidSwTraceString<SwTraceCharPolicy>(description))
+ !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>(description))
{
throw InvalidArgumentException("Trying to register a counter with an invalid description");
}
// Check that the given units are valid
if (units.has_value()
- && !IsValidSwTraceString<SwTraceNameCharPolicy>(units.value()))
+ && !arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(units.value()))
{
throw InvalidArgumentException("Trying to register a counter with a invalid units");
}
diff --git a/src/profiling/CounterDirectory.hpp b/src/profiling/CounterDirectory.hpp
index 6a73a76a0d..a6e788ee1f 100644
--- a/src/profiling/CounterDirectory.hpp
+++ b/src/profiling/CounterDirectory.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2017 Arm Ltd. All rights reserved.
+// Copyright © 2017 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -12,7 +12,7 @@
#include <unordered_set>
#include <unordered_map>
-#include <boost/numeric/conversion/cast.hpp>
+#include <armnn/utility/NumericCast.hpp>
namespace armnn
{
@@ -48,10 +48,10 @@ public:
const Optional<uint16_t>& counterSetUid = EmptyOptional()) override;
// Getters for counts
- uint16_t GetCategoryCount() const override { return boost::numeric_cast<uint16_t>(m_Categories.size()); }
- uint16_t GetDeviceCount() const override { return boost::numeric_cast<uint16_t>(m_Devices.size()); }
- uint16_t GetCounterSetCount() const override { return boost::numeric_cast<uint16_t>(m_CounterSets.size()); }
- uint16_t GetCounterCount() const override { return boost::numeric_cast<uint16_t>(m_Counters.size()); }
+ uint16_t GetCategoryCount() const override { return armnn::numeric_cast<uint16_t>(m_Categories.size()); }
+ uint16_t GetDeviceCount() const override { return armnn::numeric_cast<uint16_t>(m_Devices.size()); }
+ uint16_t GetCounterSetCount() const override { return armnn::numeric_cast<uint16_t>(m_CounterSets.size()); }
+ uint16_t GetCounterCount() const override { return armnn::numeric_cast<uint16_t>(m_Counters.size()); }
// Getters for collections
const Categories& GetCategories() const override { return m_Categories; }
diff --git a/src/profiling/DeactivateTimelineReportingCommandHandler.cpp b/src/profiling/DeactivateTimelineReportingCommandHandler.cpp
index dbfb053b3d..bdee83b1c0 100644
--- a/src/profiling/DeactivateTimelineReportingCommandHandler.cpp
+++ b/src/profiling/DeactivateTimelineReportingCommandHandler.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -15,7 +15,7 @@ namespace armnn
namespace profiling
{
-void DeactivateTimelineReportingCommandHandler::operator()(const Packet& packet)
+void DeactivateTimelineReportingCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
diff --git a/src/profiling/DeactivateTimelineReportingCommandHandler.hpp b/src/profiling/DeactivateTimelineReportingCommandHandler.hpp
index e9d2180699..822e92c425 100644
--- a/src/profiling/DeactivateTimelineReportingCommandHandler.hpp
+++ b/src/profiling/DeactivateTimelineReportingCommandHandler.hpp
@@ -1,22 +1,23 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include "CommandHandlerFunctor.hpp"
-#include <Packet.hpp>
#include "ProfilingStateMachine.hpp"
#include "INotifyBackends.hpp"
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
+
namespace armnn
{
namespace profiling
{
-class DeactivateTimelineReportingCommandHandler : public CommandHandlerFunctor
+class DeactivateTimelineReportingCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
@@ -32,7 +33,7 @@ public:
, m_BackendNotifier(notifyBackends)
{}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
std::atomic<bool>& m_TimelineReporting;
diff --git a/src/profiling/DirectoryCaptureCommandHandler.cpp b/src/profiling/DirectoryCaptureCommandHandler.cpp
index e20f5402c6..60463a10c3 100644
--- a/src/profiling/DirectoryCaptureCommandHandler.cpp
+++ b/src/profiling/DirectoryCaptureCommandHandler.cpp
@@ -1,7 +1,8 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
+
#include "DirectoryCaptureCommandHandler.hpp"
#include <armnn/BackendId.hpp>
@@ -20,7 +21,7 @@ namespace profiling
uint32_t uint16_t_size = sizeof(uint16_t);
uint32_t uint32_t_size = sizeof(uint32_t);
-void DirectoryCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
+void DirectoryCaptureCommandHandler::ParseData(const arm::pipe::Packet& packet)
{
uint16_t categoryRecordCount;
uint16_t counterSetRecordCount;
@@ -296,7 +297,7 @@ std::vector<CounterDirectoryEventRecord> DirectoryCaptureCommandHandler::ReadEve
return eventRecords;
}
-void DirectoryCaptureCommandHandler::operator()(const profiling::Packet& packet)
+void DirectoryCaptureCommandHandler::operator()(const arm::pipe::Packet& packet)
{
if (!m_QuietOperation) // Are we supposed to print to stdout?
{
diff --git a/src/profiling/DirectoryCaptureCommandHandler.hpp b/src/profiling/DirectoryCaptureCommandHandler.hpp
index 6b25714168..90ae1d400d 100644
--- a/src/profiling/DirectoryCaptureCommandHandler.hpp
+++ b/src/profiling/DirectoryCaptureCommandHandler.hpp
@@ -1,13 +1,14 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include "CommandHandlerFunctor.hpp"
#include "CounterDirectory.hpp"
+#include <common/include/CommandHandlerFunctor.hpp>
+
#include <atomic>
namespace armnn
@@ -30,7 +31,7 @@ struct CounterDirectoryEventRecord
uint16_t m_MaxCounterUid;
};
-class DirectoryCaptureCommandHandler : public profiling::CommandHandlerFunctor
+class DirectoryCaptureCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
@@ -40,7 +41,7 @@ public:
, m_AlreadyParsed(false)
{}
- void operator()(const armnn::profiling::Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
const ICounterDirectory& GetCounterDirectory() const;
@@ -61,7 +62,7 @@ public:
}
private:
- void ParseData(const armnn::profiling::Packet& packet);
+ void ParseData(const arm::pipe::Packet& packet);
void ReadCategoryRecords(const unsigned char* data, uint32_t offset, std::vector<uint32_t> categoryOffsets);
diff --git a/src/profiling/EncodeVersion.hpp b/src/profiling/EncodeVersion.hpp
deleted file mode 100644
index f66f7278a5..0000000000
--- a/src/profiling/EncodeVersion.hpp
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include <cstdint>
-#include <string>
-#include <ostream>
-#include <sstream>
-
-namespace armnn
-{
-
-namespace profiling
-{
-
-constexpr inline uint32_t EncodeVersion(uint32_t major, uint32_t minor, uint32_t patch)
-{
- return (major << 22) | (minor << 12) | patch;
-}
-
-// Encodes a semantic version https://semver.org/ into a 32 bit integer in the following fashion
-//
-// bits 22:31 major: Unsigned 10-bit integer. Major component of the schema version number.
-// bits 12:21 minor: Unsigned 10-bit integer. Minor component of the schema version number.
-// bits 0:11 patch: Unsigned 12-bit integer. Patch component of the schema version number.
-//
-class Version
-{
-public:
- Version(uint32_t encodedValue)
- {
- m_Major = (encodedValue >> 22) & 1023;
- m_Minor = (encodedValue >> 12) & 1023;
- m_Patch = encodedValue & 4095;
- }
-
- Version(uint32_t major, uint32_t minor, uint32_t patch) :
- m_Major(major),
- m_Minor(minor),
- m_Patch(patch)
- {}
-
- uint32_t GetEncodedValue()
- {
- return EncodeVersion(m_Major, m_Minor, m_Patch);
- }
-
- uint32_t GetMajor() { return m_Major; }
- uint32_t GetMinor() { return m_Minor; }
- uint32_t GetPatch() { return m_Patch; }
-
- bool operator==(const Version& other) const
- {
- return m_Major == other.m_Major && m_Minor == other.m_Minor && m_Patch == other.m_Patch;
- }
-
- std::string ToString() const
- {
- constexpr char separator = '.';
-
- std::stringstream stringStream;
- stringStream << m_Major << separator << m_Minor << separator << m_Patch;
-
- return stringStream.str();
- }
-
-private:
- uint32_t m_Major;
- uint32_t m_Minor;
- uint32_t m_Patch;
-};
-
-inline std::ostream& operator<<(std::ostream& os, const Version& version)
-{
- os << version.ToString();
- return os;
-}
-
-} // namespace profiling
-
-} // namespace armnn
diff --git a/src/profiling/FileOnlyProfilingConnection.cpp b/src/profiling/FileOnlyProfilingConnection.cpp
index 1e26aaa472..24f2cc7ede 100644
--- a/src/profiling/FileOnlyProfilingConnection.cpp
+++ b/src/profiling/FileOnlyProfilingConnection.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -28,30 +28,30 @@ std::vector<uint32_t> StreamMetaDataProcessor::GetHeadersAccepted()
return headers;
}
-void StreamMetaDataProcessor::HandlePacket(const Packet& packet)
+void StreamMetaDataProcessor::HandlePacket(const arm::pipe::Packet& packet)
{
if (packet.GetHeader() != m_MetaDataPacketHeader)
{
- throw armnnProfiling::ProfilingException("StreamMetaDataProcessor can only handle Stream Meta Data Packets");
+ throw arm::pipe::ProfilingException("StreamMetaDataProcessor can only handle Stream Meta Data Packets");
}
// determine the endianness of the protocol
TargetEndianness endianness;
- if (ToUint32(packet.GetData(),TargetEndianness::BeWire) == armnnProfiling::PIPE_MAGIC)
+ if (ToUint32(packet.GetData(),TargetEndianness::BeWire) == arm::pipe::PIPE_MAGIC)
{
endianness = TargetEndianness::BeWire;
}
- else if (ToUint32(packet.GetData(), TargetEndianness::LeWire) == armnnProfiling::PIPE_MAGIC)
+ else if (ToUint32(packet.GetData(), TargetEndianness::LeWire) == arm::pipe::PIPE_MAGIC)
{
endianness = TargetEndianness::LeWire;
}
else
{
- throw armnnProfiling::ProfilingException("Protocol read error. Unable to read PIPE_MAGIC value.");
+ throw arm::pipe::ProfilingException("Protocol read error. Unable to read the PIPE_MAGIC value.");
}
m_FileOnlyProfilingConnection->SetEndianess(endianness);
// send back the acknowledgement
std::unique_ptr<unsigned char[]> uniqueNullPtr = nullptr;
- Packet returnPacket(0x10000, 0, uniqueNullPtr);
+ arm::pipe::Packet returnPacket(0x10000, 0, uniqueNullPtr);
m_FileOnlyProfilingConnection->ReturnPacket(returnPacket);
}
@@ -110,12 +110,12 @@ void FileOnlyProfilingConnection::Close()
bool FileOnlyProfilingConnection::WritePacket(const unsigned char* buffer, uint32_t length)
{
ARMNN_ASSERT(buffer);
- Packet packet = ReceivePacket(buffer, length);
+ arm::pipe::Packet packet = ReceivePacket(buffer, length);
ForwardPacketToHandlers(packet);
return true;
}
-void FileOnlyProfilingConnection::ReturnPacket(Packet& packet)
+void FileOnlyProfilingConnection::ReturnPacket(arm::pipe::Packet& packet)
{
{
std::lock_guard<std::mutex> lck(m_PacketAvailableMutex);
@@ -124,7 +124,7 @@ void FileOnlyProfilingConnection::ReturnPacket(Packet& packet)
m_ConditionPacketAvailable.notify_one();
}
-Packet FileOnlyProfilingConnection::ReadPacket(uint32_t timeout)
+arm::pipe::Packet FileOnlyProfilingConnection::ReadPacket(uint32_t timeout)
{
std::unique_lock<std::mutex> lck(m_PacketAvailableMutex);
@@ -134,11 +134,11 @@ Packet FileOnlyProfilingConnection::ReadPacket(uint32_t timeout)
std::chrono::milliseconds(timeout),
[&]{return !m_PacketQueue.empty();}))
{
- Packet empty;
+ arm::pipe::Packet empty;
return empty;
}
- Packet returnedPacket = std::move(m_PacketQueue.front());
+ arm::pipe::Packet returnedPacket = std::move(m_PacketQueue.front());
m_PacketQueue.pop();
return returnedPacket;
}
@@ -199,7 +199,7 @@ void FileOnlyProfilingConnection::StartProcessingThread()
m_LocalHandlersThread = std::thread(&FileOnlyProfilingConnection::ServiceLocalHandlers, this);
}
-void FileOnlyProfilingConnection::ForwardPacketToHandlers(Packet& packet)
+void FileOnlyProfilingConnection::ForwardPacketToHandlers(arm::pipe::Packet& packet)
{
if (m_PacketHandlers.empty())
{
@@ -224,7 +224,7 @@ void FileOnlyProfilingConnection::ServiceLocalHandlers()
{
do
{
- Packet returnedPacket;
+ arm::pipe::Packet returnedPacket;
bool readPacket = false;
{ // only lock while we are taking the packet off the incoming list
std::unique_lock<std::mutex> lck(m_ReadableMutex);
@@ -273,7 +273,7 @@ void FileOnlyProfilingConnection::ClearReadableList()
}
}
-void FileOnlyProfilingConnection::DispatchPacketToHandlers(const Packet& packet)
+void FileOnlyProfilingConnection::DispatchPacketToHandlers(const arm::pipe::Packet& packet)
{
for (auto& delegate : m_UniversalHandlers)
{
@@ -288,7 +288,7 @@ void FileOnlyProfilingConnection::DispatchPacketToHandlers(const Packet& packet)
{
delegate->HandlePacket(packet);
}
- catch (const armnnProfiling::ProfilingException& ex)
+ catch (const arm::pipe::ProfilingException& ex)
{
Fail(ex.what());
}
diff --git a/src/profiling/FileOnlyProfilingConnection.hpp b/src/profiling/FileOnlyProfilingConnection.hpp
index b19b983ebc..8bde0abdea 100644
--- a/src/profiling/FileOnlyProfilingConnection.hpp
+++ b/src/profiling/FileOnlyProfilingConnection.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -8,10 +8,11 @@
#include <armnn/profiling/ILocalPacketHandler.hpp>
#include "DirectoryCaptureCommandHandler.hpp"
#include "IProfilingConnection.hpp"
-#include <Packet.hpp>
#include "ProfilingUtils.hpp"
#include "Runtime.hpp"
+#include <common/include/Packet.hpp>
+
#include <atomic>
#include <condition_variable>
#include <fstream>
@@ -37,7 +38,7 @@ public:
std::vector<uint32_t> GetHeadersAccepted() override;
- void HandlePacket(const Packet& packet) override;
+ void HandlePacket(const arm::pipe::Packet& packet) override;
private:
FileOnlyProfilingConnection* m_FileOnlyProfilingConnection;
@@ -82,28 +83,28 @@ public:
bool WritePacket(const unsigned char* buffer, uint32_t length) override;
// Sending a packet back to ArmNN.
- Packet ReadPacket(uint32_t timeout) override;
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override;
void SetEndianess(const TargetEndianness& endianness) override //IInternalProfilingConnection
{
m_Endianness = endianness;
}
- void ReturnPacket(Packet& packet) override; //IInternalProfilingConnection
+ void ReturnPacket(arm::pipe::Packet& packet) override; //IInternalProfilingConnection
private:
void AddLocalPacketHandler(ILocalPacketHandlerSharedPtr localPacketHandler);
void StartProcessingThread();
void ClearReadableList();
- void DispatchPacketToHandlers(const Packet& packet);
+ void DispatchPacketToHandlers(const arm::pipe::Packet& packet);
void Fail(const std::string& errorMessage);
- void ForwardPacketToHandlers(Packet& packet);
+ void ForwardPacketToHandlers(arm::pipe::Packet& packet);
void ServiceLocalHandlers();
Runtime::CreationOptions::ExternalProfilingOptions m_Options;
- std::queue<Packet> m_PacketQueue;
+ std::queue<arm::pipe::Packet> m_PacketQueue;
TargetEndianness m_Endianness;
std::mutex m_PacketAvailableMutex;
@@ -114,7 +115,7 @@ private:
std::vector<ILocalPacketHandlerSharedPtr> m_UniversalHandlers;
// List of readable packets for the local packet handlers
- std::queue<Packet> m_ReadableList;
+ std::queue<arm::pipe::Packet> m_ReadableList;
// Mutex and condition variable for the readable packet list
std::mutex m_ReadableMutex;
std::condition_variable m_ConditionPacketReadable;
diff --git a/src/profiling/IProfilingConnection.hpp b/src/profiling/IProfilingConnection.hpp
index cf45a43ef3..7ed714c1a3 100644
--- a/src/profiling/IProfilingConnection.hpp
+++ b/src/profiling/IProfilingConnection.hpp
@@ -5,9 +5,10 @@
#pragma once
-#include <Packet.hpp>
#include <armnn/profiling/ILocalPacketHandler.hpp>
+#include <common/include/Packet.hpp>
+
#include <cstdint>
namespace armnn
@@ -27,7 +28,7 @@ public:
virtual bool WritePacket(const unsigned char* buffer, uint32_t length) = 0;
- virtual Packet ReadPacket(uint32_t timeout) = 0;
+ virtual arm::pipe::Packet ReadPacket(uint32_t timeout) = 0;
};
} // namespace profiling
diff --git a/src/profiling/PacketVersionResolver.cpp b/src/profiling/PacketVersionResolver.cpp
deleted file mode 100644
index 689abbb082..0000000000
--- a/src/profiling/PacketVersionResolver.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "PacketVersionResolver.hpp"
-
-#include <armnn/utility/IgnoreUnused.hpp>
-
-namespace armnn
-{
-
-namespace profiling
-{
-
-bool PacketKey::operator<(const PacketKey& rhs) const
-{
- bool result = true;
- if (m_FamilyId == rhs.m_FamilyId)
- {
- result = m_PacketId < rhs.m_PacketId;
- }
- else if (m_FamilyId > rhs.m_FamilyId)
- {
- result = false;
- }
- return result;
-}
-
-bool PacketKey::operator>(const PacketKey& rhs) const
-{
- return rhs < *this;
-}
-
-bool PacketKey::operator<=(const PacketKey& rhs) const
-{
- return !(*this > rhs);
-}
-
-bool PacketKey::operator>=(const PacketKey& rhs) const
-{
- return !(*this < rhs);
-}
-
-bool PacketKey::operator==(const PacketKey& rhs) const
-{
- return m_FamilyId == rhs.m_FamilyId && m_PacketId == rhs.m_PacketId;
-}
-
-bool PacketKey::operator!=(const PacketKey& rhs) const
-{
- return !(*this == rhs);
-}
-
-Version PacketVersionResolver::ResolvePacketVersion(uint32_t familyId, uint32_t packetId) const
-{
- const PacketKey packetKey(familyId, packetId);
-
- if( packetKey == ActivateTimeLinePacket )
- {
- return Version(1, 1, 0);
- }
- if( packetKey == DeactivateTimeLinePacket )
- {
- return Version(1, 1, 0);
- }
-
- return Version(1, 0, 0);
-}
-
-} // namespace profiling
-
-} // namespace armnn
diff --git a/src/profiling/PacketVersionResolver.hpp b/src/profiling/PacketVersionResolver.hpp
deleted file mode 100644
index 3112f5eac0..0000000000
--- a/src/profiling/PacketVersionResolver.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// Copyright © 2017 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include "EncodeVersion.hpp"
-
-namespace armnn
-{
-
-namespace profiling
-{
-
-class PacketKey final
-{
-public:
- PacketKey(uint32_t familyId, uint32_t packetId) : m_FamilyId(familyId), m_PacketId(packetId) {}
-
- uint32_t GetFamilyId() { return m_FamilyId; }
- uint32_t GetPacketId() { return m_PacketId; }
-
- bool operator< (const PacketKey& rhs) const;
- bool operator> (const PacketKey& rhs) const;
- bool operator<=(const PacketKey& rhs) const;
- bool operator>=(const PacketKey& rhs) const;
- bool operator==(const PacketKey& rhs) const;
- bool operator!=(const PacketKey& rhs) const;
-
-private:
- uint32_t m_FamilyId;
- uint32_t m_PacketId;
-};
-
-static const PacketKey ActivateTimeLinePacket(0 , 6);
-static const PacketKey DeactivateTimeLinePacket(0 , 7);
-
-class PacketVersionResolver final
-{
-public:
- PacketVersionResolver() = default;
- ~PacketVersionResolver() = default;
-
- Version ResolvePacketVersion(uint32_t familyId, uint32_t packetId) const;
-};
-
-} // namespace profiling
-
-} // namespace armnn
diff --git a/src/profiling/PerJobCounterSelectionCommandHandler.cpp b/src/profiling/PerJobCounterSelectionCommandHandler.cpp
index 8892e1457d..fea8ee3e5b 100644
--- a/src/profiling/PerJobCounterSelectionCommandHandler.cpp
+++ b/src/profiling/PerJobCounterSelectionCommandHandler.cpp
@@ -1,9 +1,10 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "PerJobCounterSelectionCommandHandler.hpp"
+#include <armnn/Exceptions.hpp>
#include <boost/format.hpp>
@@ -13,7 +14,7 @@ namespace armnn
namespace profiling
{
-void PerJobCounterSelectionCommandHandler::operator()(const Packet& packet)
+void PerJobCounterSelectionCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
switch (currentState)
@@ -21,9 +22,9 @@ void PerJobCounterSelectionCommandHandler::operator()(const Packet& packet)
case ProfilingState::Uninitialised:
case ProfilingState::NotConnected:
case ProfilingState::WaitingForAck:
- throw RuntimeException(boost::str(boost::format("Per-Job Counter Selection Command Handler invoked while in "
- "an wrong state: %1%")
- % GetProfilingStateName(currentState)));
+ throw armnn::RuntimeException(boost::str(boost::format(
+ "Per-Job Counter Selection Command Handler invoked while in an incorrect state: %1%")
+ % GetProfilingStateName(currentState)));
case ProfilingState::Active:
// Process the packet
if (!(packet.GetPacketFamily() == 0u && packet.GetPacketId() == 5u))
@@ -38,8 +39,8 @@ void PerJobCounterSelectionCommandHandler::operator()(const Packet& packet)
break;
default:
- throw RuntimeException(boost::str(boost::format("Unknown profiling service state: %1%")
- % static_cast<int>(currentState)));
+ throw armnn::RuntimeException(boost::str(boost::format("Unknown profiling service state: %1%")
+ % static_cast<int>(currentState)));
}
}
diff --git a/src/profiling/PerJobCounterSelectionCommandHandler.hpp b/src/profiling/PerJobCounterSelectionCommandHandler.hpp
index daf10c6d95..eef8421900 100644
--- a/src/profiling/PerJobCounterSelectionCommandHandler.hpp
+++ b/src/profiling/PerJobCounterSelectionCommandHandler.hpp
@@ -1,21 +1,22 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
-#include <Packet.hpp>
-#include "CommandHandlerFunctor.hpp"
#include "ProfilingStateMachine.hpp"
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
+
namespace armnn
{
namespace profiling
{
-class PerJobCounterSelectionCommandHandler : public CommandHandlerFunctor
+class PerJobCounterSelectionCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
@@ -27,7 +28,7 @@ public:
, m_StateMachine(profilingStateMachine)
{}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
const ProfilingStateMachine& m_StateMachine;
diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
index bd4fa0691c..1b10643fca 100644
--- a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
+++ b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -18,7 +18,7 @@ namespace armnn
namespace profiling
{
-void PeriodicCounterSelectionCommandHandler::ParseData(const Packet& packet, CaptureData& captureData)
+void PeriodicCounterSelectionCommandHandler::ParseData(const arm::pipe::Packet& packet, CaptureData& captureData)
{
std::vector<uint16_t> counterIds;
uint32_t sizeOfUint32 = boost::numeric_cast<uint32_t>(sizeof(uint32_t));
@@ -56,7 +56,7 @@ void PeriodicCounterSelectionCommandHandler::ParseData(const Packet& packet, Cap
captureData.SetCounterIds(counterIds);
}
-void PeriodicCounterSelectionCommandHandler::operator()(const Packet& packet)
+void PeriodicCounterSelectionCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
switch (currentState)
diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
index ac08cc58ec..ec67391b9c 100644
--- a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
+++ b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
@@ -1,13 +1,11 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include "CounterIdMap.hpp"
-#include <Packet.hpp>
-#include "CommandHandlerFunctor.hpp"
#include "Holder.hpp"
#include "ProfilingStateMachine.hpp"
#include "SendCounterPacket.hpp"
@@ -18,8 +16,10 @@
#include "armnn/Logging.hpp"
#include "armnn/BackendRegistry.hpp"
-#include <set>
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
+#include <set>
namespace armnn
{
@@ -28,7 +28,7 @@ namespace profiling
{
-class PeriodicCounterSelectionCommandHandler : public CommandHandlerFunctor
+class PeriodicCounterSelectionCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
@@ -60,7 +60,7 @@ public:
}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
@@ -90,7 +90,7 @@ private:
<< errorMsg.value();
}
}
- void ParseData(const Packet& packet, CaptureData& captureData);
+ void ParseData(const arm::pipe::Packet& packet, CaptureData& captureData);
std::set<armnn::BackendId> ProcessBackendCounterIds(const uint32_t capturePeriod,
const std::set<uint16_t> newCounterIds,
const std::set<uint16_t> unusedCounterIds);
diff --git a/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp b/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp
index d61911b54e..5768566178 100644
--- a/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp
+++ b/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -61,9 +61,9 @@ bool ProfilingConnectionDumpToFileDecorator::WritePacket(const unsigned char* bu
return success;
}
-Packet ProfilingConnectionDumpToFileDecorator::ReadPacket(uint32_t timeout)
+arm::pipe::Packet ProfilingConnectionDumpToFileDecorator::ReadPacket(uint32_t timeout)
{
- Packet packet = m_Connection->ReadPacket(timeout);
+ arm::pipe::Packet packet = m_Connection->ReadPacket(timeout);
if (!m_Options.m_IncomingCaptureFile.empty())
{
DumpIncomingToFile(packet);
@@ -90,7 +90,7 @@ bool ProfilingConnectionDumpToFileDecorator::OpenOutgoingDumpFile()
/// to write the data into the specified file.
/// @param packet data packet to write
/// @return nothing
-void ProfilingConnectionDumpToFileDecorator::DumpIncomingToFile(const Packet& packet)
+void ProfilingConnectionDumpToFileDecorator::DumpIncomingToFile(const arm::pipe::Packet& packet)
{
bool success = true;
if (!m_IncomingDumpFileStream.is_open())
diff --git a/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp b/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp
index 545c57f728..aedb28571e 100644
--- a/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp
+++ b/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -38,14 +38,14 @@ public:
bool WritePacket(const unsigned char* buffer, uint32_t length) override;
- Packet ReadPacket(uint32_t timeout) override;
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override;
private:
bool OpenIncomingDumpFile();
bool OpenOutgoingDumpFile();
- void DumpIncomingToFile(const Packet& packet);
+ void DumpIncomingToFile(const arm::pipe::Packet& packet);
bool DumpOutgoingToFile(const unsigned char* buffer, uint32_t length);
diff --git a/src/profiling/ProfilingConnectionFactory.cpp b/src/profiling/ProfilingConnectionFactory.cpp
index 7849b7e21e..96f7ed4b06 100644
--- a/src/profiling/ProfilingConnectionFactory.cpp
+++ b/src/profiling/ProfilingConnectionFactory.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
diff --git a/src/profiling/ProfilingConnectionFactory.hpp b/src/profiling/ProfilingConnectionFactory.hpp
index c6d4c6faf0..fa8b32f703 100644
--- a/src/profiling/ProfilingConnectionFactory.hpp
+++ b/src/profiling/ProfilingConnectionFactory.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
index 8532c3efad..b673993846 100644
--- a/src/profiling/ProfilingService.cpp
+++ b/src/profiling/ProfilingService.cpp
@@ -148,7 +148,7 @@ void ProfilingService::Update()
ARMNN_LOG(warning) << "An error has occurred when creating the profiling connection: "
<< e.what();
}
- catch (const armnnProfiling::SocketConnectionException& e)
+ catch (const arm::pipe::SocketConnectionException& e)
{
ARMNN_LOG(warning) << "An error has occurred when creating the profiling connection ["
<< e.what() << "] on socket [" << e.GetSocketFd() << "].";
diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp
index 247b945813..1bc7c59808 100644
--- a/src/profiling/ProfilingService.hpp
+++ b/src/profiling/ProfilingService.hpp
@@ -31,6 +31,8 @@
#include "INotifyBackends.hpp"
#include <armnn/backends/profiling/IBackendProfilingContext.hpp>
+#include <list>
+
namespace armnn
{
@@ -236,22 +238,22 @@ private:
void CheckCounterUid(uint16_t counterUid) const;
// Profiling service components
- ExternalProfilingOptions m_Options;
- std::atomic<bool> m_TimelineReporting;
- CounterDirectory m_CounterDirectory;
- CounterIdMap m_CounterIdMap;
- IProfilingConnectionFactoryPtr m_ProfilingConnectionFactory;
- IProfilingConnectionPtr m_ProfilingConnection;
- ProfilingStateMachine m_StateMachine;
- CounterIndices m_CounterIndex;
- CounterValues m_CounterValues;
- CommandHandlerRegistry m_CommandHandlerRegistry;
- PacketVersionResolver m_PacketVersionResolver;
- CommandHandler m_CommandHandler;
- BufferManager m_BufferManager;
- SendCounterPacket m_SendCounterPacket;
- SendThread m_SendThread;
- SendTimelinePacket m_SendTimelinePacket;
+ ExternalProfilingOptions m_Options;
+ std::atomic<bool> m_TimelineReporting;
+ CounterDirectory m_CounterDirectory;
+ CounterIdMap m_CounterIdMap;
+ IProfilingConnectionFactoryPtr m_ProfilingConnectionFactory;
+ IProfilingConnectionPtr m_ProfilingConnection;
+ ProfilingStateMachine m_StateMachine;
+ CounterIndices m_CounterIndex;
+ CounterValues m_CounterValues;
+ arm::pipe::CommandHandlerRegistry m_CommandHandlerRegistry;
+ arm::pipe::PacketVersionResolver m_PacketVersionResolver;
+ CommandHandler m_CommandHandler;
+ BufferManager m_BufferManager;
+ SendCounterPacket m_SendCounterPacket;
+ SendThread m_SendThread;
+ SendTimelinePacket m_SendTimelinePacket;
Holder m_Holder;
diff --git a/src/profiling/ProfilingUtils.cpp b/src/profiling/ProfilingUtils.cpp
index 8c43a8cd3a..4767f3e746 100644
--- a/src/profiling/ProfilingUtils.cpp
+++ b/src/profiling/ProfilingUtils.cpp
@@ -5,7 +5,9 @@
#include "ProfilingUtils.hpp"
-#include "common/include/ProfilingException.hpp"
+#include <common/include/CommonProfilingUtils.hpp>
+#include <common/include/ProfilingException.hpp>
+#include <common/include/SwTrace.hpp>
#include <armnn/Version.hpp>
@@ -139,52 +141,27 @@ void WriteUint8(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint8
void WriteBytes(unsigned char* buffer, unsigned int offset, const void* value, unsigned int valueSize)
{
- ARMNN_ASSERT(buffer);
- ARMNN_ASSERT(value);
-
- for (unsigned int i = 0; i < valueSize; i++, offset++)
- {
- buffer[offset] = *(reinterpret_cast<const unsigned char*>(value) + i);
- }
+ arm::pipe::WriteBytes(buffer, offset, value, valueSize);
}
void WriteUint64(unsigned char* buffer, unsigned int offset, uint64_t value)
{
- ARMNN_ASSERT(buffer);
-
- buffer[offset] = static_cast<unsigned char>(value & 0xFF);
- buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
- buffer[offset + 2] = static_cast<unsigned char>((value >> 16) & 0xFF);
- buffer[offset + 3] = static_cast<unsigned char>((value >> 24) & 0xFF);
- buffer[offset + 4] = static_cast<unsigned char>((value >> 32) & 0xFF);
- buffer[offset + 5] = static_cast<unsigned char>((value >> 40) & 0xFF);
- buffer[offset + 6] = static_cast<unsigned char>((value >> 48) & 0xFF);
- buffer[offset + 7] = static_cast<unsigned char>((value >> 56) & 0xFF);
+ arm::pipe::WriteUint64(buffer, offset, value);
}
void WriteUint32(unsigned char* buffer, unsigned int offset, uint32_t value)
{
- ARMNN_ASSERT(buffer);
-
- buffer[offset] = static_cast<unsigned char>(value & 0xFF);
- buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
- buffer[offset + 2] = static_cast<unsigned char>((value >> 16) & 0xFF);
- buffer[offset + 3] = static_cast<unsigned char>((value >> 24) & 0xFF);
+ arm::pipe::WriteUint32(buffer, offset, value);
}
void WriteUint16(unsigned char* buffer, unsigned int offset, uint16_t value)
{
- ARMNN_ASSERT(buffer);
-
- buffer[offset] = static_cast<unsigned char>(value & 0xFF);
- buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
+ arm::pipe::WriteUint16(buffer, offset, value);
}
void WriteUint8(unsigned char* buffer, unsigned int offset, uint8_t value)
{
- ARMNN_ASSERT(buffer);
-
- buffer[offset] = static_cast<unsigned char>(value);
+ arm::pipe::WriteUint8(buffer, offset, value);
}
void ReadBytes(const IPacketBufferPtr& packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
@@ -224,59 +201,27 @@ uint8_t ReadUint8(const IPacketBufferPtr& packetBuffer, unsigned int offset)
void ReadBytes(const unsigned char* buffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
{
- ARMNN_ASSERT(buffer);
- ARMNN_ASSERT(outValue);
-
- for (unsigned int i = 0; i < valueSize; i++, offset++)
- {
- outValue[i] = static_cast<uint8_t>(buffer[offset]);
- }
+ arm::pipe::ReadBytes(buffer, offset, valueSize, outValue);
}
uint64_t ReadUint64(const unsigned char* buffer, unsigned int offset)
{
- ARMNN_ASSERT(buffer);
-
- uint64_t value = 0;
- value = static_cast<uint64_t>(buffer[offset]);
- value |= static_cast<uint64_t>(buffer[offset + 1]) << 8;
- value |= static_cast<uint64_t>(buffer[offset + 2]) << 16;
- value |= static_cast<uint64_t>(buffer[offset + 3]) << 24;
- value |= static_cast<uint64_t>(buffer[offset + 4]) << 32;
- value |= static_cast<uint64_t>(buffer[offset + 5]) << 40;
- value |= static_cast<uint64_t>(buffer[offset + 6]) << 48;
- value |= static_cast<uint64_t>(buffer[offset + 7]) << 56;
-
- return value;
+ return arm::pipe::ReadUint64(buffer, offset);
}
uint32_t ReadUint32(const unsigned char* buffer, unsigned int offset)
{
- ARMNN_ASSERT(buffer);
-
- uint32_t value = 0;
- value = static_cast<uint32_t>(buffer[offset]);
- value |= static_cast<uint32_t>(buffer[offset + 1]) << 8;
- value |= static_cast<uint32_t>(buffer[offset + 2]) << 16;
- value |= static_cast<uint32_t>(buffer[offset + 3]) << 24;
- return value;
+ return arm::pipe::ReadUint32(buffer, offset);
}
uint16_t ReadUint16(const unsigned char* buffer, unsigned int offset)
{
- ARMNN_ASSERT(buffer);
-
- uint32_t value = 0;
- value = static_cast<uint32_t>(buffer[offset]);
- value |= static_cast<uint32_t>(buffer[offset + 1]) << 8;
- return static_cast<uint16_t>(value);
+ return arm::pipe::ReadUint16(buffer, offset);
}
uint8_t ReadUint8(const unsigned char* buffer, unsigned int offset)
{
- ARMNN_ASSERT(buffer);
-
- return buffer[offset];
+ return arm::pipe::ReadUint8(buffer, offset);
}
std::string GetSoftwareInfo()
@@ -303,113 +248,6 @@ std::string GetProcessName()
return name;
}
-// Calculate the actual length an SwString will be including the terminating null character
-// padding to bring it to the next uint32_t boundary but minus the leading uint32_t encoding
-// the size to allow the offset to be correctly updated when decoding a binary packet.
-uint32_t CalculateSizeOfPaddedSwString(const std::string& str)
-{
- std::vector<uint32_t> swTraceString;
- StringToSwTraceString<SwTraceCharPolicy>(str, swTraceString);
- unsigned int uint32_t_size = sizeof(uint32_t);
- uint32_t size = (boost::numeric_cast<uint32_t>(swTraceString.size()) - 1) * uint32_t_size;
- return size;
-}
-
-// Read TimelineMessageDirectoryPacket from given IPacketBuffer and offset
-SwTraceMessage ReadSwTraceMessage(const unsigned char* packetBuffer,
- unsigned int& offset,
- const unsigned int& packetLength)
-{
- ARMNN_ASSERT(packetBuffer);
-
- unsigned int uint32_t_size = sizeof(uint32_t);
-
- SwTraceMessage swTraceMessage;
-
- // Read the decl_id
- uint32_t readDeclId = ReadUint32(packetBuffer, offset);
- swTraceMessage.m_Id = readDeclId;
-
- // SWTrace "namestring" format
- // length of the string (first 4 bytes) + string + null terminator
-
- // Check the decl_name
- offset += uint32_t_size;
- uint32_t swTraceDeclNameLength = ReadUint32(packetBuffer, offset);
-
- if (swTraceDeclNameLength == 0 || swTraceDeclNameLength > packetLength)
- {
- throw RuntimeException("Error swTraceDeclNameLength is an invalid size", CHECK_LOCATION());
- }
-
- offset += uint32_t_size;
- std::vector<unsigned char> swTraceStringBuffer(swTraceDeclNameLength - 1);
- std::memcpy(swTraceStringBuffer.data(),
- packetBuffer + offset, swTraceStringBuffer.size());
-
- swTraceMessage.m_Name.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end()); // name
-
- // Check the ui_name
- offset += CalculateSizeOfPaddedSwString(swTraceMessage.m_Name);
- uint32_t swTraceUINameLength = ReadUint32(packetBuffer, offset);
-
- if (swTraceUINameLength == 0 || swTraceUINameLength > packetLength)
- {
- throw RuntimeException("Error swTraceUINameLength is an invalid size", CHECK_LOCATION());
- }
-
- offset += uint32_t_size;
- swTraceStringBuffer.resize(swTraceUINameLength - 1);
- std::memcpy(swTraceStringBuffer.data(),
- packetBuffer + offset, swTraceStringBuffer.size());
-
- swTraceMessage.m_UiName.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end()); // ui_name
-
- // Check arg_types
- offset += CalculateSizeOfPaddedSwString(swTraceMessage.m_UiName);
- uint32_t swTraceArgTypesLength = ReadUint32(packetBuffer, offset);
-
- if (swTraceArgTypesLength == 0 || swTraceArgTypesLength > packetLength)
- {
- throw RuntimeException("Error swTraceArgTypesLength is an invalid size", CHECK_LOCATION());
- }
-
- offset += uint32_t_size;
- swTraceStringBuffer.resize(swTraceArgTypesLength - 1);
- std::memcpy(swTraceStringBuffer.data(),
- packetBuffer + offset, swTraceStringBuffer.size());
-
- swTraceMessage.m_ArgTypes.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end()); // arg_types
-
- std::string swTraceString(swTraceStringBuffer.begin(), swTraceStringBuffer.end());
-
- // Check arg_names
- offset += CalculateSizeOfPaddedSwString(swTraceString);
- uint32_t swTraceArgNamesLength = ReadUint32(packetBuffer, offset);
-
- if (swTraceArgNamesLength == 0 || swTraceArgNamesLength > packetLength)
- {
- throw RuntimeException("Error swTraceArgNamesLength is an invalid size", CHECK_LOCATION());
- }
-
- offset += uint32_t_size;
- swTraceStringBuffer.resize(swTraceArgNamesLength - 1);
- std::memcpy(swTraceStringBuffer.data(),
- packetBuffer + offset, swTraceStringBuffer.size());
-
- swTraceString.assign(swTraceStringBuffer.begin(), swTraceStringBuffer.end());
- std::stringstream stringStream(swTraceString);
- std::string argName;
- while (std::getline(stringStream, argName, ','))
- {
- swTraceMessage.m_ArgNames.push_back(argName);
- }
-
- offset += CalculateSizeOfPaddedSwString(swTraceString);
-
- return swTraceMessage;
-}
-
/// Creates a timeline packet header
///
/// \params
@@ -493,7 +331,7 @@ TimelinePacketStatus WriteTimelineLabelBinaryPacket(uint64_t profilingGuid,
// Convert the label into a SWTrace string
std::vector<uint32_t> swTraceLabel;
- bool result = StringToSwTraceString<SwTraceCharPolicy>(label, swTraceLabel);
+ bool result = arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceLabel);
if (!result)
{
return TimelinePacketStatus::Error;
@@ -712,10 +550,14 @@ TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
swTraceBuffer.push_back(declId);
bool result = true;
- result &= ConvertDirectoryComponent<SwTraceNameCharPolicy>(directoryComponent[1], swTraceBuffer); // decl_name
- result &= ConvertDirectoryComponent<SwTraceCharPolicy> (directoryComponent[2], swTraceBuffer); // ui_name
- result &= ConvertDirectoryComponent<SwTraceTypeCharPolicy>(directoryComponent[3], swTraceBuffer); // arg_types
- result &= ConvertDirectoryComponent<SwTraceCharPolicy> (directoryComponent[4], swTraceBuffer); // arg_names
+ result &= arm::pipe::ConvertDirectoryComponent<arm::pipe::SwTraceNameCharPolicy>(
+ directoryComponent[1], swTraceBuffer); // decl_name
+ result &= arm::pipe::ConvertDirectoryComponent<arm::pipe::SwTraceCharPolicy> (
+ directoryComponent[2], swTraceBuffer); // ui_name
+ result &= arm::pipe::ConvertDirectoryComponent<arm::pipe::SwTraceTypeCharPolicy>(
+ directoryComponent[3], swTraceBuffer); // arg_types
+ result &= arm::pipe::ConvertDirectoryComponent<arm::pipe::SwTraceCharPolicy> (
+ directoryComponent[4], swTraceBuffer); // arg_names
if (!result)
{
return TimelinePacketStatus::Error;
@@ -884,22 +726,7 @@ TimelinePacketStatus WriteTimelineEventBinary(uint64_t timestamp,
std::string CentreAlignFormatting(const std::string& stringToPass, const int spacingWidth)
{
- std::stringstream outputStream, centrePadding;
- int padding = spacingWidth - static_cast<int>(stringToPass.size());
-
- for (int i = 0; i < padding / 2; ++i)
- {
- centrePadding << " ";
- }
-
- outputStream << centrePadding.str() << stringToPass << centrePadding.str();
-
- if (padding > 0 && padding %2 != 0)
- {
- outputStream << " ";
- }
-
- return outputStream.str();
+ return arm::pipe::CentreAlignFormatting(stringToPass, spacingWidth);
}
void PrintDeviceDetails(const std::pair<const unsigned short, std::unique_ptr<Device>>& devicePair)
@@ -1088,15 +915,15 @@ uint64_t GetTimestamp()
return static_cast<uint64_t>(timestamp.count());
}
-Packet ReceivePacket(const unsigned char* buffer, uint32_t length)
+arm::pipe::Packet ReceivePacket(const unsigned char* buffer, uint32_t length)
{
if (buffer == nullptr)
{
- throw armnnProfiling::ProfilingException("data buffer is nullptr");
+ throw arm::pipe::ProfilingException("data buffer is nullptr");
}
if (length < 8)
{
- throw armnnProfiling::ProfilingException("length of data buffer is less than 8");
+ throw arm::pipe::ProfilingException("length of data buffer is less than 8");
}
uint32_t metadataIdentifier = 0;
@@ -1112,7 +939,7 @@ Packet ReceivePacket(const unsigned char* buffer, uint32_t length)
std::memcpy(packetData.get(), buffer + 8u, dataLength);
}
- return Packet(metadataIdentifier, dataLength, packetData);
+ return arm::pipe::Packet(metadataIdentifier, dataLength, packetData);
}
} // namespace profiling
diff --git a/src/profiling/ProfilingUtils.hpp b/src/profiling/ProfilingUtils.hpp
index 833b73d963..79fa6c7bb0 100644
--- a/src/profiling/ProfilingUtils.hpp
+++ b/src/profiling/ProfilingUtils.hpp
@@ -11,7 +11,7 @@
#include "ICounterDirectory.hpp"
#include "IPacketBuffer.hpp"
-#include <Packet.hpp>
+#include <common/include/Packet.hpp>
#include <boost/numeric/conversion/cast.hpp>
@@ -30,118 +30,6 @@ namespace profiling
constexpr unsigned int ThreadIdSize = sizeof(int); // Is platform dependent
-struct SwTraceHeader
-{
- uint8_t m_StreamVersion;
- uint8_t m_PointerBytes;
- uint8_t m_ThreadIdBytes;
-};
-
-struct SwTraceMessage
-{
- uint32_t m_Id;
- std::string m_Name;
- std::string m_UiName;
- std::vector<char> m_ArgTypes;
- std::vector<std::string> m_ArgNames;
-};
-
-struct SwTraceCharPolicy
-{
- static bool IsValidChar(unsigned char c)
- {
- // Check that the given character has ASCII 7-bit encoding
- return c < 128;
- }
-};
-
-struct SwTraceNameCharPolicy
-{
- static bool IsValidChar(unsigned char c)
- {
- // Check that the given character has ASCII 7-bit encoding, alpha-numeric and underscore only
- return c < 128 && (std::isalnum(c) || c == '_');
- }
-};
-
-struct SwTraceTypeCharPolicy
-{
- static bool IsValidChar(unsigned char c)
- {
- // Check that the given character is among the allowed ones
- switch (c)
- {
- case '@':
- case 't':
- case 'i':
- case 'I':
- case 'l':
- case 'L':
- case 'F':
- case 'p':
- case 's':
- return true; // Valid char
- default:
- return false; // Invalid char
- }
- }
-};
-
-template <typename SwTracePolicy>
-bool IsValidSwTraceString(const std::string& s)
-{
- // Check that all the characters in the given string conform to the given policy
- return std::all_of(s.begin(), s.end(), [](unsigned char c) { return SwTracePolicy::IsValidChar(c); });
-}
-
-template <typename SwTracePolicy>
-bool StringToSwTraceString(const std::string& s, std::vector<uint32_t>& outputBuffer)
-{
- // Converts the given string to an SWTrace "string" (i.e. a string of "chars"), and writes it into
- // the given buffer including the null-terminator. It also pads it to the next uint32_t if necessary
-
- // Clear the output buffer
- outputBuffer.clear();
-
- // Check that the given string is a valid SWTrace "string" (i.e. a string of "chars")
- if (!IsValidSwTraceString<SwTracePolicy>(s))
- {
- return false;
- }
-
- // Prepare the output buffer
- size_t s_size = s.size() + 1; // The size of the string (in chars) plus the null-terminator
- size_t uint32_t_size = sizeof(uint32_t);
- // Output buffer size = StringLength (32 bit) + amount of complete 32bit words that fit into the string
- // + an additional 32bit word if there are remaining chars to complete the string
- // (The rest of the 32bit word is then filled with the NULL terminator)
- size_t outBufferSize = 1 + (s_size / uint32_t_size) + (s_size % uint32_t_size != 0 ? 1 : 0);
- outputBuffer.resize(outBufferSize, '\0');
-
- // Write the SWTrace string to the output buffer
- outputBuffer[0] = boost::numeric_cast<uint32_t>(s_size);
- std::memcpy(outputBuffer.data() + 1, s.data(), s_size);
-
- return true;
-}
-
-template <typename SwTracePolicy,
- typename SwTraceBuffer = std::vector<uint32_t>>
-bool ConvertDirectoryComponent(const std::string& directoryComponent, SwTraceBuffer& swTraceBuffer)
-{
- // Convert the directory component using the given policy
- SwTraceBuffer tempSwTraceBuffer;
- bool result = StringToSwTraceString<SwTracePolicy>(directoryComponent, tempSwTraceBuffer);
- if (!result)
- {
- return false;
- }
-
- swTraceBuffer.insert(swTraceBuffer.end(), tempSwTraceBuffer.begin(), tempSwTraceBuffer.end());
-
- return true;
-}
-
uint16_t GetNextUid(bool peekOnly = false);
std::vector<uint16_t> GetNextCounterUids(uint16_t firstUid, uint16_t cores);
@@ -212,10 +100,6 @@ enum class TimelinePacketStatus
BufferExhaustion
};
-uint32_t CalculateSizeOfPaddedSwString(const std::string& str);
-
-SwTraceMessage ReadSwTraceMessage(const unsigned char*, unsigned int&, const unsigned int& packetLength);
-
TimelinePacketStatus WriteTimelineLabelBinaryPacket(uint64_t profilingGuid,
const std::string& label,
unsigned char* buffer,
@@ -264,7 +148,7 @@ class BufferExhaustion : public armnn::Exception
uint64_t GetTimestamp();
-Packet ReceivePacket(const unsigned char* buffer, uint32_t length);
+arm::pipe::Packet ReceivePacket(const unsigned char* buffer, uint32_t length);
} // namespace profiling
diff --git a/src/profiling/RequestCounterDirectoryCommandHandler.cpp b/src/profiling/RequestCounterDirectoryCommandHandler.cpp
index 5521a25f20..8f78ae63f0 100644
--- a/src/profiling/RequestCounterDirectoryCommandHandler.cpp
+++ b/src/profiling/RequestCounterDirectoryCommandHandler.cpp
@@ -13,7 +13,7 @@ namespace armnn
namespace profiling
{
-void RequestCounterDirectoryCommandHandler::operator()(const Packet& packet)
+void RequestCounterDirectoryCommandHandler::operator()(const arm::pipe::Packet& packet)
{
ProfilingState currentState = m_StateMachine.GetCurrentState();
switch (currentState)
diff --git a/src/profiling/RequestCounterDirectoryCommandHandler.hpp b/src/profiling/RequestCounterDirectoryCommandHandler.hpp
index d8ce881ffb..18577b2851 100644
--- a/src/profiling/RequestCounterDirectoryCommandHandler.hpp
+++ b/src/profiling/RequestCounterDirectoryCommandHandler.hpp
@@ -5,19 +5,20 @@
#pragma once
-#include "CommandHandlerFunctor.hpp"
#include "ISendCounterPacket.hpp"
#include "armnn/profiling/ISendTimelinePacket.hpp"
-#include <Packet.hpp>
#include "ProfilingStateMachine.hpp"
+#include <common/include/CommandHandlerFunctor.hpp>
+#include <common/include/Packet.hpp>
+
namespace armnn
{
namespace profiling
{
-class RequestCounterDirectoryCommandHandler : public CommandHandlerFunctor
+class RequestCounterDirectoryCommandHandler : public arm::pipe::CommandHandlerFunctor
{
public:
@@ -35,7 +36,7 @@ public:
, m_StateMachine(profilingStateMachine)
{}
- void operator()(const Packet& packet) override;
+ void operator()(const arm::pipe::Packet& packet) override;
private:
const ICounterDirectory& m_CounterDirectory;
diff --git a/src/profiling/SendCounterPacket.cpp b/src/profiling/SendCounterPacket.cpp
index 2182ce6d39..79123f0c5e 100644
--- a/src/profiling/SendCounterPacket.cpp
+++ b/src/profiling/SendCounterPacket.cpp
@@ -4,13 +4,14 @@
//
#include "SendCounterPacket.hpp"
-#include "EncodeVersion.hpp"
+#include <common/include/EncodeVersion.hpp>
#include <armnn/Exceptions.hpp>
#include <armnn/Conversion.hpp>
#include <Processes.hpp>
#include <armnn/utility/Assert.hpp>
#include <common/include/Constants.hpp>
+#include <common/include/SwTrace.hpp>
#include <boost/format.hpp>
#include <boost/numeric/conversion/cast.hpp>
@@ -61,19 +62,19 @@ void SendCounterPacket::SendStreamMetaDataPacket()
// Timeline Message Directory (packet_family = 1, packet_class = 0, packet_type = 0) Version 1.0.0
// Timeline Message (packet_family = 1, packet_class = 0, packet_type = 1) Version 1.0.0
std::vector<std::pair<uint32_t, uint32_t>> packetVersions;
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 1), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 2), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 3), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 4), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 5), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 6), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 7), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 1), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 1), EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 2), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 3), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 4), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 5), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 6), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 7), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 1), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
uint32_t numberOfVersions = numeric_cast<uint32_t>(packetVersions.size());
uint32_t packetVersionSize = numeric_cast<uint32_t>(numberOfVersions * 2 * sizeUint32);
@@ -104,9 +105,9 @@ void SendCounterPacket::SendStreamMetaDataPacket()
// Packet body
offset += sizeUint32;
- WriteUint32(writeBuffer, offset, armnnProfiling::PIPE_MAGIC); // pipe_magic
+ WriteUint32(writeBuffer, offset, arm::pipe::PIPE_MAGIC); // pipe_magic
offset += sizeUint32;
- WriteUint32(writeBuffer, offset, EncodeVersion(1, 0, 0)); // stream_metadata_version
+ WriteUint32(writeBuffer, offset, arm::pipe::EncodeVersion(1, 0, 0)); // stream_metadata_version
offset += sizeUint32;
WriteUint32(writeBuffer, offset, MAX_METADATA_PACKET_LENGTH); // max_data_length
offset += sizeUint32;
@@ -213,7 +214,7 @@ bool SendCounterPacket::CreateCategoryRecord(const CategoryPtr& category,
// Convert the device name into a SWTrace namestring
std::vector<uint32_t> categoryNameBuffer;
- if (!StringToSwTraceString<SwTraceNameCharPolicy>(categoryName, categoryNameBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(categoryName, categoryNameBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the name of category (%1%) to an SWTrace namestring")
% categoryName);
@@ -318,7 +319,7 @@ bool SendCounterPacket::CreateDeviceRecord(const DevicePtr& device,
// Convert the device name into a SWTrace string
std::vector<uint32_t> deviceNameBuffer;
- if (!StringToSwTraceString<SwTraceCharPolicy>(deviceName, deviceNameBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(deviceName, deviceNameBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the name of device %1% (%2%) to an SWTrace string")
% deviceUid
@@ -368,7 +369,7 @@ bool SendCounterPacket::CreateCounterSetRecord(const CounterSetPtr& counterSet,
// Convert the device name into a SWTrace namestring
std::vector<uint32_t> counterSetNameBuffer;
- if (!StringToSwTraceString<SwTraceNameCharPolicy>(counterSet->m_Name, counterSetNameBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(counterSet->m_Name, counterSetNameBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the name of counter set %1% (%2%) to "
"an SWTrace namestring")
@@ -465,7 +466,7 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter,
// Convert the counter name into a SWTrace string
std::vector<uint32_t> counterNameBuffer;
- if (!StringToSwTraceString<SwTraceCharPolicy>(counterName, counterNameBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(counterName, counterNameBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the name of counter %1% (name: %2%) "
"to an SWTrace string")
@@ -482,7 +483,7 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter,
// Convert the counter description into a SWTrace string
std::vector<uint32_t> counterDescriptionBuffer;
- if (!StringToSwTraceString<SwTraceCharPolicy>(counterDescription, counterDescriptionBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(counterDescription, counterDescriptionBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the description of counter %1% (description: %2%) "
"to an SWTrace string")
@@ -507,7 +508,7 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter,
if (includeUnits)
{
// Convert the counter units into a SWTrace namestring
- if (!StringToSwTraceString<SwTraceNameCharPolicy>(counterUnits, counterUnitsBuffer))
+ if (!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(counterUnits, counterUnitsBuffer))
{
errorMessage = boost::str(boost::format("Cannot convert the units of counter %1% (units: %2%) "
"to an SWTrace string")
diff --git a/src/profiling/SendThread.cpp b/src/profiling/SendThread.cpp
index 5962f2fc5d..86e6c05a02 100644
--- a/src/profiling/SendThread.cpp
+++ b/src/profiling/SendThread.cpp
@@ -1,10 +1,9 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "SendThread.hpp"
-#include "EncodeVersion.hpp"
#include "ProfilingUtils.hpp"
#include <armnn/Exceptions.hpp>
@@ -25,7 +24,9 @@ namespace profiling
using boost::numeric_cast;
SendThread::SendThread(armnn::profiling::ProfilingStateMachine& profilingStateMachine,
- armnn::profiling::IBufferManager& buffer, armnn::profiling::ISendCounterPacket& sendCounterPacket, int timeout)
+ armnn::profiling::IBufferManager& buffer,
+ armnn::profiling::ISendCounterPacket& sendCounterPacket,
+ int timeout)
: m_StateMachine(profilingStateMachine)
, m_BufferManager(buffer)
, m_SendCounterPacket(sendCounterPacket)
diff --git a/src/profiling/SocketProfilingConnection.cpp b/src/profiling/SocketProfilingConnection.cpp
index c231045b10..9de425b62c 100644
--- a/src/profiling/SocketProfilingConnection.cpp
+++ b/src/profiling/SocketProfilingConnection.cpp
@@ -11,7 +11,6 @@
#include <fcntl.h>
#include <string>
-using namespace armnnUtils;
namespace armnn
{
@@ -20,13 +19,13 @@ namespace profiling
SocketProfilingConnection::SocketProfilingConnection()
{
- Sockets::Initialize();
+ arm::pipe::Initialize();
memset(m_Socket, 0, sizeof(m_Socket));
// Note: we're using Linux specific SOCK_CLOEXEC flag.
m_Socket[0].fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (m_Socket[0].fd == -1)
{
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Socket construction failed: ") + strerror(errno),
m_Socket[0].fd,
errno);
@@ -41,7 +40,7 @@ SocketProfilingConnection::SocketProfilingConnection()
if (0 != connect(m_Socket[0].fd, reinterpret_cast<const sockaddr*>(&server), sizeof(sockaddr_un)))
{
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Cannot connect to stream socket: ") + strerror(errno),
m_Socket[0].fd,
errno);
@@ -51,10 +50,10 @@ SocketProfilingConnection::SocketProfilingConnection()
m_Socket[0].events = POLLIN;
// Make the socket non blocking.
- if (!Sockets::SetNonBlocking(m_Socket[0].fd))
+ if (!arm::pipe::SetNonBlocking(m_Socket[0].fd))
{
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Failed to set socket as non blocking: ") + strerror(errno),
m_Socket[0].fd,
errno);
@@ -68,9 +67,9 @@ bool SocketProfilingConnection::IsOpen() const
void SocketProfilingConnection::Close()
{
- if (Sockets::Close(m_Socket[0].fd) != 0)
+ if (arm::pipe::Close(m_Socket[0].fd) != 0)
{
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Cannot close stream socket: ") + strerror(errno),
m_Socket[0].fd,
errno);
@@ -86,14 +85,14 @@ bool SocketProfilingConnection::WritePacket(const unsigned char* buffer, uint32_
return false;
}
- return Sockets::Write(m_Socket[0].fd, buffer, length) != -1;
+ return arm::pipe::Write(m_Socket[0].fd, buffer, length) != -1;
}
-Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
+arm::pipe::Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
{
// Is there currently at least a header worth of data waiting to be read?
int bytes_available = 0;
- Sockets::Ioctl(m_Socket[0].fd, FIONREAD, &bytes_available);
+ arm::pipe::Ioctl(m_Socket[0].fd, FIONREAD, &bytes_available);
if (bytes_available >= 8)
{
// Yes there is. Read it:
@@ -101,18 +100,18 @@ Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
}
// Poll for data on the socket or until timeout occurs
- int pollResult = Sockets::Poll(&m_Socket[0], 1, static_cast<int>(timeout));
+ int pollResult = arm::pipe::Poll(&m_Socket[0], 1, static_cast<int>(timeout));
switch (pollResult)
{
case -1: // Error
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Error occured while reading from socket: ") + strerror(errno),
m_Socket[0].fd,
errno);
case 0: // Timeout
- throw TimeoutException("SocketProfilingConnection: Timeout while reading from socket");
+ throw arm::pipe::TimeoutException("SocketProfilingConnection: Timeout while reading from socket");
default: // Normal poll return but it could still contain an error signal
// Check if the socket reported an error
@@ -122,13 +121,13 @@ Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
{
// This is an unrecoverable error.
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Error occured while polling receiving socket: POLLNVAL."),
m_Socket[0].fd);
}
if (m_Socket[0].revents == POLLERR)
{
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string(
"SocketProfilingConnection: Error occured while polling receiving socket: POLLERR: ")
+ strerror(errno),
@@ -139,7 +138,7 @@ Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
{
// This is an unrecoverable error.
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Connection closed by remote client: POLLHUP."),
m_Socket[0].fd);
}
@@ -158,30 +157,30 @@ Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
}
}
-Packet SocketProfilingConnection::ReceivePacket()
+arm::pipe::Packet SocketProfilingConnection::ReceivePacket()
{
char header[8] = {};
- long receiveResult = Sockets::Read(m_Socket[0].fd, &header, sizeof(header));
+ long receiveResult = arm::pipe::Read(m_Socket[0].fd, &header, sizeof(header));
// We expect 8 as the result here. 0 means EOF, socket is closed. -1 means there been some other kind of error.
switch( receiveResult )
{
case 0:
// Socket has closed.
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Remote socket has closed the connection."),
m_Socket[0].fd);
case -1:
// There's been a socket error. We will presume it's unrecoverable.
Close();
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Error occured while reading the packet: ") + strerror(errno),
m_Socket[0].fd,
errno);
default:
if (receiveResult < 8)
{
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string(
"SocketProfilingConnection: The received packet did not contains a valid PIPE header."),
m_Socket[0].fd);
@@ -201,10 +200,10 @@ Packet SocketProfilingConnection::ReceivePacket()
if (dataLength > 0)
{
packetData = std::make_unique<unsigned char[]>(dataLength);
- long receivedLength = Sockets::Read(m_Socket[0].fd, packetData.get(), dataLength);
+ long receivedLength = arm::pipe::Read(m_Socket[0].fd, packetData.get(), dataLength);
if (receivedLength < 0)
{
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Error occured while reading the packet: ") + strerror(errno),
m_Socket[0].fd,
errno);
@@ -212,13 +211,13 @@ Packet SocketProfilingConnection::ReceivePacket()
if (dataLength != static_cast<uint32_t>(receivedLength))
{
// What do we do here if we can't read in a full packet?
- throw armnnProfiling::SocketConnectionException(
+ throw arm::pipe::SocketConnectionException(
std::string("SocketProfilingConnection: Invalid PIPE packet."),
m_Socket[0].fd);
}
}
- return Packet(metadataIdentifier, dataLength, packetData);
+ return arm::pipe::Packet(metadataIdentifier, dataLength, packetData);
}
} // namespace profiling
diff --git a/src/profiling/SocketProfilingConnection.hpp b/src/profiling/SocketProfilingConnection.hpp
index a646c03d9c..8d9cb20935 100644
--- a/src/profiling/SocketProfilingConnection.hpp
+++ b/src/profiling/SocketProfilingConnection.hpp
@@ -22,12 +22,12 @@ public:
bool IsOpen() const final;
void Close() final;
bool WritePacket(const unsigned char* buffer, uint32_t length) final;
- Packet ReadPacket(uint32_t timeout) final;
+ arm::pipe::Packet ReadPacket(uint32_t timeout) final;
private:
// Read a full packet from the socket.
- Packet ReceivePacket();
+ arm::pipe::Packet ReceivePacket();
#ifndef __APPLE__
// To indicate we want to use an abstract UDS ensure the first character of the address is 0.
@@ -36,7 +36,7 @@ private:
// MACOSX does not support abstract UDS
const char* m_GatorNamespace = "/tmp/gatord_namespace";
#endif
- armnnUtils::Sockets::PollFd m_Socket[1]{};
+ arm::pipe::PollFd m_Socket[1]{};
};
} // namespace profiling
diff --git a/src/profiling/test/BufferTests.cpp b/src/profiling/test/BufferTests.cpp
index 804335138d..7a92ee19e5 100644
--- a/src/profiling/test/BufferTests.cpp
+++ b/src/profiling/test/BufferTests.cpp
@@ -7,6 +7,8 @@
#include "PacketBuffer.hpp"
#include "ProfilingUtils.hpp"
+#include <common/include/SwTrace.hpp>
+
#include <armnn/Exceptions.hpp>
#include <boost/test/unit_test.hpp>
@@ -380,8 +382,8 @@ BOOST_AUTO_TEST_CASE(ReadSwTraceMessageExceptionTest0)
unsigned int uint32_t_size = sizeof(uint32_t);
unsigned int offset = uint32_t_size;
- BOOST_CHECK_THROW(ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()),
- armnn::RuntimeException);
+ BOOST_CHECK_THROW(arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()),
+ arm::pipe::ProfilingException);
}
@@ -402,8 +404,8 @@ BOOST_AUTO_TEST_CASE(ReadSwTraceMessageExceptionTest1)
unsigned int uint32_t_size = sizeof(uint32_t);
unsigned int offset = uint32_t_size;
- BOOST_CHECK_THROW(ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()),
- armnn::RuntimeException);
+ BOOST_CHECK_THROW(arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()),
+ arm::pipe::ProfilingException);
}
diff --git a/src/profiling/test/PrintPacketHeaderHandler.cpp b/src/profiling/test/PrintPacketHeaderHandler.cpp
index 24095d8250..f85a7b1fcb 100644
--- a/src/profiling/test/PrintPacketHeaderHandler.cpp
+++ b/src/profiling/test/PrintPacketHeaderHandler.cpp
@@ -1,11 +1,12 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "PrintPacketHeaderHandler.hpp"
#include <iostream>
+#include <sstream>
namespace armnn
{
@@ -18,7 +19,7 @@ std::vector<uint32_t> PrintPacketHeaderHandler::GetHeadersAccepted()
return std::vector<uint32_t>();
}
-void PrintPacketHeaderHandler::HandlePacket(const Packet& packet)
+void PrintPacketHeaderHandler::HandlePacket(const arm::pipe::Packet& packet)
{
std::stringstream ss;
ss << "Handler Received Outgoing Packet [" << packet.GetPacketFamily() << ":" << packet.GetPacketId() << "]";
diff --git a/src/profiling/test/PrintPacketHeaderHandler.hpp b/src/profiling/test/PrintPacketHeaderHandler.hpp
index 6564f3cea5..397da0b8ea 100644
--- a/src/profiling/test/PrintPacketHeaderHandler.hpp
+++ b/src/profiling/test/PrintPacketHeaderHandler.hpp
@@ -1,12 +1,13 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include <armnn/profiling/ILocalPacketHandler.hpp>
-#include <Packet.hpp>
+
+#include <common/include/Packet.hpp>
namespace armnn
{
@@ -18,7 +19,7 @@ class PrintPacketHeaderHandler : public ILocalPacketHandler
{
virtual std::vector<uint32_t> GetHeadersAccepted();
- virtual void HandlePacket(const Packet& packet);
+ virtual void HandlePacket(const arm::pipe::Packet& packet);
};
} // namespace profiling
diff --git a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
index 6784ddabcb..d6700bc41a 100644
--- a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
+++ b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2019 Arm Ltd. All rights reserved.
+// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -32,7 +32,7 @@ public:
{
// populate packet data and construct packet
std::memcpy(m_PacketData.get(), g_DataPtr, g_DataLength);
- m_Packet = std::make_unique<Packet>(0u, g_DataLength, m_PacketData);
+ m_Packet = std::make_unique<arm::pipe::Packet>(0u, g_DataLength, m_PacketData);
}
~DummyProfilingConnection() = default;
@@ -54,7 +54,7 @@ public:
return true;
}
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
armnn::IgnoreUnused(timeout);
return std::move(*m_Packet);
@@ -63,7 +63,7 @@ public:
private:
bool m_Open;
std::unique_ptr<unsigned char[]> m_PacketData;
- std::unique_ptr<Packet> m_Packet;
+ std::unique_ptr<arm::pipe::Packet> m_Packet;
};
std::vector<char> ReadDumpFile(const std::string& dumpFileName)
@@ -105,8 +105,8 @@ BOOST_AUTO_TEST_CASE(DumpIncomingValidFile)
ProfilingConnectionDumpToFileDecorator decorator(std::make_unique<DummyProfilingConnection>(), options, false);
// NOTE: unique_ptr is needed here because operator=() is deleted for Packet
- std::unique_ptr<Packet> packet;
- BOOST_CHECK_NO_THROW(packet = std::make_unique<Packet>(decorator.ReadPacket(0)));
+ std::unique_ptr<arm::pipe::Packet> packet;
+ BOOST_CHECK_NO_THROW(packet = std::make_unique<arm::pipe::Packet>(decorator.ReadPacket(0)));
decorator.Close();
diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp
index e4f71f932c..8bcf27a8d1 100644
--- a/src/profiling/test/ProfilingMocks.hpp
+++ b/src/profiling/test/ProfilingMocks.hpp
@@ -121,7 +121,7 @@ public:
}
}
- bool WritePacket(Packet&& packet)
+ bool WritePacket(arm::pipe::Packet&& packet)
{
std::lock_guard<std::mutex> lock(m_Mutex);
@@ -129,7 +129,7 @@ public:
return true;
}
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
IgnoreUnused(timeout);
@@ -156,7 +156,7 @@ public:
private:
bool m_IsOpen;
std::vector<std::pair<PacketType, uint32_t>> m_WrittenData;
- Packet m_Packet;
+ arm::pipe::Packet m_Packet;
mutable std::mutex m_Mutex;
};
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp
index bc16bb952b..f616442df0 100644
--- a/src/profiling/test/ProfilingTests.cpp
+++ b/src/profiling/test/ProfilingTests.cpp
@@ -7,18 +7,15 @@
#include "ProfilingTestUtils.hpp"
#include <backends/BackendProfiling.hpp>
+#include <common/include/EncodeVersion.hpp>
+#include <common/include/PacketVersionResolver.hpp>
+#include <common/include/SwTrace.hpp>
#include <CommandHandler.hpp>
-#include <CommandHandlerKey.hpp>
-#include <CommandHandlerRegistry.hpp>
-#include <common/include/SocketConnectionException.hpp>
#include <ConnectionAcknowledgedCommandHandler.hpp>
#include <CounterDirectory.hpp>
#include <CounterIdMap.hpp>
-#include <EncodeVersion.hpp>
#include <Holder.hpp>
#include <ICounterValues.hpp>
-#include <Packet.hpp>
-#include <PacketVersionResolver.hpp>
#include <PeriodicCounterCapture.hpp>
#include <PeriodicCounterSelectionCommandHandler.hpp>
#include <ProfilingStateMachine.hpp>
@@ -37,6 +34,11 @@
#include <armnn/Utils.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
+#include <common/include/CommandHandlerKey.hpp>
+#include <common/include/CommandHandlerRegistry.hpp>
+#include <common/include/SocketConnectionException.hpp>
+#include <common/include/Packet.hpp>
+
#include <boost/numeric/conversion/cast.hpp>
#include <cstdint>
@@ -54,16 +56,16 @@ BOOST_AUTO_TEST_SUITE(ExternalProfiling)
BOOST_AUTO_TEST_CASE(CheckCommandHandlerKeyComparisons)
{
- CommandHandlerKey testKey1_0(1, 1, 1);
- CommandHandlerKey testKey1_1(1, 1, 1);
- CommandHandlerKey testKey1_2(1, 2, 1);
+ arm::pipe::CommandHandlerKey testKey1_0(1, 1, 1);
+ arm::pipe::CommandHandlerKey testKey1_1(1, 1, 1);
+ arm::pipe::CommandHandlerKey testKey1_2(1, 2, 1);
- CommandHandlerKey testKey0(0, 1, 1);
- CommandHandlerKey testKey1(0, 1, 1);
- CommandHandlerKey testKey2(0, 1, 1);
- CommandHandlerKey testKey3(0, 0, 0);
- CommandHandlerKey testKey4(0, 2, 2);
- CommandHandlerKey testKey5(0, 0, 2);
+ arm::pipe::CommandHandlerKey testKey0(0, 1, 1);
+ arm::pipe::CommandHandlerKey testKey1(0, 1, 1);
+ arm::pipe::CommandHandlerKey testKey2(0, 1, 1);
+ arm::pipe::CommandHandlerKey testKey3(0, 0, 0);
+ arm::pipe::CommandHandlerKey testKey4(0, 2, 2);
+ arm::pipe::CommandHandlerKey testKey5(0, 0, 2);
BOOST_CHECK(testKey1_0 > testKey0);
BOOST_CHECK(testKey1_0 == testKey1_1);
@@ -88,30 +90,32 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandlerKeyComparisons)
BOOST_CHECK(testKey1.GetPacketId() == 1);
BOOST_CHECK(testKey1.GetVersion() == 1);
- std::vector<CommandHandlerKey> vect = { CommandHandlerKey(0, 0, 1), CommandHandlerKey(0, 2, 0),
- CommandHandlerKey(0, 1, 0), CommandHandlerKey(0, 2, 1),
- CommandHandlerKey(0, 1, 1), CommandHandlerKey(0, 0, 1),
- CommandHandlerKey(0, 2, 0), CommandHandlerKey(0, 0, 0) };
+ std::vector<arm::pipe::CommandHandlerKey> vect = {
+ arm::pipe::CommandHandlerKey(0, 0, 1), arm::pipe::CommandHandlerKey(0, 2, 0),
+ arm::pipe::CommandHandlerKey(0, 1, 0), arm::pipe::CommandHandlerKey(0, 2, 1),
+ arm::pipe::CommandHandlerKey(0, 1, 1), arm::pipe::CommandHandlerKey(0, 0, 1),
+ arm::pipe::CommandHandlerKey(0, 2, 0), arm::pipe::CommandHandlerKey(0, 0, 0) };
std::sort(vect.begin(), vect.end());
- std::vector<CommandHandlerKey> expectedVect = { CommandHandlerKey(0, 0, 0), CommandHandlerKey(0, 0, 1),
- CommandHandlerKey(0, 0, 1), CommandHandlerKey(0, 1, 0),
- CommandHandlerKey(0, 1, 1), CommandHandlerKey(0, 2, 0),
- CommandHandlerKey(0, 2, 0), CommandHandlerKey(0, 2, 1) };
+ std::vector<arm::pipe::CommandHandlerKey> expectedVect = {
+ arm::pipe::CommandHandlerKey(0, 0, 0), arm::pipe::CommandHandlerKey(0, 0, 1),
+ arm::pipe::CommandHandlerKey(0, 0, 1), arm::pipe::CommandHandlerKey(0, 1, 0),
+ arm::pipe::CommandHandlerKey(0, 1, 1), arm::pipe::CommandHandlerKey(0, 2, 0),
+ arm::pipe::CommandHandlerKey(0, 2, 0), arm::pipe::CommandHandlerKey(0, 2, 1) };
BOOST_CHECK(vect == expectedVect);
}
BOOST_AUTO_TEST_CASE(CheckPacketKeyComparisons)
{
- PacketKey key0(0, 0);
- PacketKey key1(0, 0);
- PacketKey key2(0, 1);
- PacketKey key3(0, 2);
- PacketKey key4(1, 0);
- PacketKey key5(1, 0);
- PacketKey key6(1, 1);
+ arm::pipe::PacketKey key0(0, 0);
+ arm::pipe::PacketKey key1(0, 0);
+ arm::pipe::PacketKey key2(0, 1);
+ arm::pipe::PacketKey key3(0, 2);
+ arm::pipe::PacketKey key4(1, 0);
+ arm::pipe::PacketKey key5(1, 0);
+ arm::pipe::PacketKey key6(1, 1);
BOOST_CHECK(!(key0 < key1));
BOOST_CHECK(!(key0 > key1));
@@ -130,7 +134,7 @@ BOOST_AUTO_TEST_CASE(CheckPacketKeyComparisons)
BOOST_AUTO_TEST_CASE(CheckCommandHandler)
{
- PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
ProfilingStateMachine profilingStateMachine;
TestProfilingConnectionBase testProfilingConnectionBase;
@@ -147,7 +151,7 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandler)
sendCounterPacket, sendTimelinePacket,
profilingStateMachine,
mockProfilingServiceStatus);
- CommandHandlerRegistry commandHandlerRegistry;
+ arm::pipe::CommandHandlerRegistry commandHandlerRegistry;
commandHandlerRegistry.RegisterFunctor(&connectionAcknowledgedCommandHandler);
@@ -260,31 +264,31 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandler)
BOOST_AUTO_TEST_CASE(CheckEncodeVersion)
{
- Version version1(12);
+ arm::pipe::Version version1(12);
BOOST_CHECK(version1.GetMajor() == 0);
BOOST_CHECK(version1.GetMinor() == 0);
BOOST_CHECK(version1.GetPatch() == 12);
- Version version2(4108);
+ arm::pipe::Version version2(4108);
BOOST_CHECK(version2.GetMajor() == 0);
BOOST_CHECK(version2.GetMinor() == 1);
BOOST_CHECK(version2.GetPatch() == 12);
- Version version3(4198412);
+ arm::pipe::Version version3(4198412);
BOOST_CHECK(version3.GetMajor() == 1);
BOOST_CHECK(version3.GetMinor() == 1);
BOOST_CHECK(version3.GetPatch() == 12);
- Version version4(0);
+ arm::pipe::Version version4(0);
BOOST_CHECK(version4.GetMajor() == 0);
BOOST_CHECK(version4.GetMinor() == 0);
BOOST_CHECK(version4.GetPatch() == 0);
- Version version5(1, 0, 0);
+ arm::pipe::Version version5(1, 0, 0);
BOOST_CHECK(version5.GetEncodedValue() == 4194304);
}
@@ -295,7 +299,7 @@ BOOST_AUTO_TEST_CASE(CheckPacketClass)
std::unique_ptr<unsigned char[]> packetData1 = std::make_unique<unsigned char[]>(0);
std::unique_ptr<unsigned char[]> nullPacketData;
- Packet packetTest0(472580096, length, packetData0);
+ arm::pipe::Packet packetTest0(472580096, length, packetData0);
BOOST_CHECK(packetTest0.GetHeader() == 472580096);
BOOST_CHECK(packetTest0.GetPacketFamily() == 7);
@@ -304,15 +308,15 @@ BOOST_AUTO_TEST_CASE(CheckPacketClass)
BOOST_CHECK(packetTest0.GetPacketType() == 3);
BOOST_CHECK(packetTest0.GetPacketClass() == 5);
- BOOST_CHECK_THROW(Packet packetTest1(472580096, 0, packetData1), armnn::Exception);
- BOOST_CHECK_NO_THROW(Packet packetTest2(472580096, 0, nullPacketData));
+ BOOST_CHECK_THROW(arm::pipe::Packet packetTest1(472580096, 0, packetData1), arm::pipe::InvalidArgumentException);
+ BOOST_CHECK_NO_THROW(arm::pipe::Packet packetTest2(472580096, 0, nullPacketData));
- Packet packetTest3(472580096, 0, nullPacketData);
+ arm::pipe::Packet packetTest3(472580096, 0, nullPacketData);
BOOST_CHECK(packetTest3.GetLength() == 0);
BOOST_CHECK(packetTest3.GetData() == nullptr);
const unsigned char* packetTest0Data = packetTest0.GetData();
- Packet packetTest4(std::move(packetTest0));
+ arm::pipe::Packet packetTest4(std::move(packetTest0));
BOOST_CHECK(packetTest0.GetData() == nullptr);
BOOST_CHECK(packetTest4.GetData() == packetTest0Data);
@@ -334,12 +338,15 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandlerFunctor)
TestFunctorB testFunctorB(8, 963, version);
TestFunctorC testFunctorC(5, 983, version);
- CommandHandlerKey keyA(testFunctorA.GetFamilyId(), testFunctorA.GetPacketId(), testFunctorA.GetVersion());
- CommandHandlerKey keyB(testFunctorB.GetFamilyId(), testFunctorB.GetPacketId(), testFunctorB.GetVersion());
- CommandHandlerKey keyC(testFunctorC.GetFamilyId(), testFunctorC.GetPacketId(), testFunctorC.GetVersion());
+ arm::pipe::CommandHandlerKey keyA(
+ testFunctorA.GetFamilyId(), testFunctorA.GetPacketId(), testFunctorA.GetVersion());
+ arm::pipe::CommandHandlerKey keyB(
+ testFunctorB.GetFamilyId(), testFunctorB.GetPacketId(), testFunctorB.GetVersion());
+ arm::pipe::CommandHandlerKey keyC(
+ testFunctorC.GetFamilyId(), testFunctorC.GetPacketId(), testFunctorC.GetVersion());
// Create the unwrapped map to simulate the Command Handler Registry
- std::map<CommandHandlerKey, CommandHandlerFunctor*> registry;
+ std::map<arm::pipe::CommandHandlerKey, arm::pipe::CommandHandlerFunctor*> registry;
registry.insert(std::make_pair(keyB, &testFunctorB));
registry.insert(std::make_pair(keyA, &testFunctorA));
@@ -357,22 +364,25 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandlerFunctor)
std::unique_ptr<unsigned char[]> packetDataB;
std::unique_ptr<unsigned char[]> packetDataC;
- Packet packetA(500000000, 0, packetDataA);
- Packet packetB(600000000, 0, packetDataB);
- Packet packetC(400000000, 0, packetDataC);
+ arm::pipe::Packet packetA(500000000, 0, packetDataA);
+ arm::pipe::Packet packetB(600000000, 0, packetDataB);
+ arm::pipe::Packet packetC(400000000, 0, packetDataC);
// Check the correct operator of derived class is called
- registry.at(CommandHandlerKey(packetA.GetPacketFamily(), packetA.GetPacketId(), version))->operator()(packetA);
+ registry.at(arm::pipe::CommandHandlerKey(
+ packetA.GetPacketFamily(), packetA.GetPacketId(), version))->operator()(packetA);
BOOST_CHECK(testFunctorA.GetCount() == 1);
BOOST_CHECK(testFunctorB.GetCount() == 0);
BOOST_CHECK(testFunctorC.GetCount() == 0);
- registry.at(CommandHandlerKey(packetB.GetPacketFamily(), packetB.GetPacketId(), version))->operator()(packetB);
+ registry.at(arm::pipe::CommandHandlerKey(
+ packetB.GetPacketFamily(), packetB.GetPacketId(), version))->operator()(packetB);
BOOST_CHECK(testFunctorA.GetCount() == 1);
BOOST_CHECK(testFunctorB.GetCount() == 1);
BOOST_CHECK(testFunctorC.GetCount() == 0);
- registry.at(CommandHandlerKey(packetC.GetPacketFamily(), packetC.GetPacketId(), version))->operator()(packetC);
+ registry.at(arm::pipe::CommandHandlerKey(
+ packetC.GetPacketFamily(), packetC.GetPacketId(), version))->operator()(packetC);
BOOST_CHECK(testFunctorA.GetCount() == 1);
BOOST_CHECK(testFunctorB.GetCount() == 1);
BOOST_CHECK(testFunctorC.GetCount() == 1);
@@ -388,7 +398,7 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandlerRegistry)
TestFunctorC testFunctorC(5, 983, version);
// Create the Command Handler Registry
- CommandHandlerRegistry registry;
+ arm::pipe::CommandHandlerRegistry registry;
// Register multiple different derived classes
registry.RegisterFunctor(&testFunctorA);
@@ -399,9 +409,9 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandlerRegistry)
std::unique_ptr<unsigned char[]> packetDataB;
std::unique_ptr<unsigned char[]> packetDataC;
- Packet packetA(500000000, 0, packetDataA);
- Packet packetB(600000000, 0, packetDataB);
- Packet packetC(400000000, 0, packetDataC);
+ arm::pipe::Packet packetA(500000000, 0, packetDataA);
+ arm::pipe::Packet packetB(600000000, 0, packetDataB);
+ arm::pipe::Packet packetC(400000000, 0, packetDataC);
// Check the correct operator of derived class is called
registry.GetFunctor(packetA.GetPacketFamily(), packetA.GetPacketId(), version)->operator()(packetA);
@@ -427,7 +437,7 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandlerRegistry)
BOOST_CHECK(testFunctorC.GetCount() == 2);
// Check that non-existent key returns nullptr for its functor
- BOOST_CHECK_THROW(registry.GetFunctor(0, 0, 0), armnn::Exception);
+ BOOST_CHECK_THROW(registry.GetFunctor(0, 0, 0), arm::pipe::ProfilingException);
}
BOOST_AUTO_TEST_CASE(CheckPacketVersionResolver)
@@ -439,9 +449,9 @@ BOOST_AUTO_TEST_CASE(CheckPacketVersionResolver)
std::numeric_limits<uint32_t>::max());
// NOTE: Expected version is always 1.0.0, regardless of packetId
- const Version expectedVersion(1, 0, 0);
+ const arm::pipe::Version expectedVersion(1, 0, 0);
- PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
constexpr unsigned int numTests = 10u;
@@ -449,7 +459,7 @@ BOOST_AUTO_TEST_CASE(CheckPacketVersionResolver)
{
const uint32_t familyId = distribution(generator);
const uint32_t packetId = distribution(generator);
- Version resolvedVersion = packetVersionResolver.ResolvePacketVersion(familyId, packetId);
+ arm::pipe::Version resolvedVersion = packetVersionResolver.ResolvePacketVersion(familyId, packetId);
BOOST_TEST(resolvedVersion == expectedVersion);
}
@@ -1407,16 +1417,16 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter)
// Register a counter with a valid parent category name and not associated with a device
const Counter* counterWoDevice = nullptr;
BOOST_CHECK_NO_THROW(counterWoDevice = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID,
- 26,
- categoryName,
- 0,
- 1,
- 123.45f,
- "valid name 3",
- "valid description",
- armnn::EmptyOptional(),// Units
- armnn::EmptyOptional(),// Number of cores
- 0)); // Device UID
+ 26,
+ categoryName,
+ 0,
+ 1,
+ 123.45f,
+ "valid name 3",
+ "valid description",
+ armnn::EmptyOptional(),// Units
+ armnn::EmptyOptional(),// Number of cores
+ 0)); // Device UID
BOOST_CHECK(counterDirectory.GetCounterCount() == 3);
BOOST_CHECK(counterWoDevice);
BOOST_CHECK(counterWoDevice->m_Uid > counter->m_Uid);
@@ -1468,9 +1478,9 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter)
123.45f,
"valid name 5",
std::string("valid description"),
- armnn::EmptyOptional(), // Units
- armnn::EmptyOptional(), // Number of cores
- device->m_Uid)); // Device UID
+ armnn::EmptyOptional(), // Units
+ armnn::EmptyOptional(), // Number of cores
+ device->m_Uid)); // Device UID
BOOST_CHECK(counterDirectory.GetCounterCount() == 4);
BOOST_CHECK(counterWDevice);
BOOST_CHECK(counterWDevice->m_Uid > counter->m_Uid);
@@ -1499,7 +1509,7 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter)
armnn::EmptyOptional(),// Units
armnn::EmptyOptional(),// No of cores
armnn::EmptyOptional(),// Device UID
- 0)); // CounterSet UID
+ 0)); // CounterSet UID
BOOST_CHECK(counterDirectory.GetCounterCount() == 5);
BOOST_CHECK(counterWoCounterSet);
BOOST_CHECK(counterWoCounterSet->m_Uid > counter->m_Uid);
@@ -1615,18 +1625,19 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter)
const Counter* counterWMultiCoreDeviceWParentCategory = nullptr;
uint16_t numberOfCourse = multiCoreDeviceWParentCategory->m_Cores;
BOOST_CHECK_NO_THROW(counterWMultiCoreDeviceWParentCategory =
- counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID,
- 100,
- categoryName,
- 0,
- 1,
- 123.45f,
- "valid name 10",
- "valid description",
- armnn::EmptyOptional(), // Units
- numberOfCourse, // Number of cores
- armnn::EmptyOptional(), // Device UID
- armnn::EmptyOptional()));// Counter set UID
+ counterDirectory.RegisterCounter(
+ armnn::profiling::BACKEND_ID,
+ 100,
+ categoryName,
+ 0,
+ 1,
+ 123.45f,
+ "valid name 10",
+ "valid description",
+ armnn::EmptyOptional(), // Units
+ numberOfCourse, // Number of cores
+ armnn::EmptyOptional(), // Device UID
+ armnn::EmptyOptional()));// Counter set UID
BOOST_CHECK(counterDirectory.GetCounterCount() == 26);
BOOST_CHECK(counterWMultiCoreDeviceWParentCategory);
BOOST_CHECK(counterWMultiCoreDeviceWParentCategory->m_Uid > counter->m_Uid);
@@ -1718,10 +1729,10 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter)
BOOST_CHECK_NO_THROW(anotherCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, 24,
anotherCategoryName, 1, 0, .00043f,
"valid name", "valid description",
- armnn::EmptyOptional(), // Units
- armnn::EmptyOptional(), // Number of cores
- device->m_Uid, // Device UID
- counterSet->m_Uid)); // Counter set UID
+ armnn::EmptyOptional(), // Units
+ armnn::EmptyOptional(), // Number of cores
+ device->m_Uid, // Device UID
+ counterSet->m_Uid)); // Counter set UID
BOOST_CHECK(counterDirectory.GetCounterCount() == 29);
BOOST_CHECK(anotherCounter);
BOOST_CHECK(anotherCounter->m_MaxCounterUid == anotherCounter->m_Uid);
@@ -1804,7 +1815,7 @@ BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData)
offset += sizeOfUint16;
WriteUint16(data1, offset, 5000);
- Packet packetA(packetId, dataLength1, uniqueData1);
+ arm::pipe::Packet packetA(packetId, dataLength1, uniqueData1);
PeriodicCounterSelectionCommandHandler commandHandler(familyId, packetId, version, backendProfilingContext,
counterIdMap, holder, 10000u, captureThread,
@@ -1859,7 +1870,7 @@ BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData)
WriteUint32(reinterpret_cast<unsigned char*>(uniqueData2.get()), 0, period2);
- Packet packetB(packetId, dataLength2, uniqueData2);
+ arm::pipe::Packet packetB(packetId, dataLength2, uniqueData2);
commandHandler(packetB);
@@ -1911,7 +1922,7 @@ BOOST_AUTO_TEST_CASE(CheckTimelineActivationAndDeactivation)
std::atomic<bool> m_timelineReporting;
};
- PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
BufferManager bufferManager(512);
SendTimelinePacket sendTimelinePacket(bufferManager);
@@ -1936,7 +1947,7 @@ BOOST_AUTO_TEST_CASE(CheckTimelineActivationAndDeactivation)
uint32_t packetHeader1 = ConstructHeader(packetFamily1, packetId1);
// Create the ActivateTimelineReportingPacket
- Packet ActivateTimelineReportingPacket(packetHeader1); // Length == 0
+ arm::pipe::Packet ActivateTimelineReportingPacket(packetHeader1); // Length == 0
BOOST_CHECK_THROW(
activateTimelineReportingCommandHandler.operator()(ActivateTimelineReportingPacket), armnn::Exception);
@@ -1968,7 +1979,7 @@ BOOST_AUTO_TEST_CASE(CheckTimelineActivationAndDeactivation)
uint32_t packetHeader2 = ConstructHeader(packetFamily2, packetId2);
// Create the DeactivateTimelineReportingPacket
- Packet deactivateTimelineReportingPacket(packetHeader2); // Length == 0
+ arm::pipe::Packet deactivateTimelineReportingPacket(packetHeader2); // Length == 0
stateMachine.Reset();
BOOST_CHECK_THROW(
@@ -2036,7 +2047,7 @@ BOOST_AUTO_TEST_CASE(CheckConnectionAcknowledged)
offset += sizeOfUint16;
WriteUint16(data1, offset, 5000);
- Packet packetA(connectionPacketId, dataLength1, uniqueData1);
+ arm::pipe::Packet packetA(connectionPacketId, dataLength1, uniqueData1);
ProfilingStateMachine profilingState(ProfilingState::Uninitialised);
BOOST_CHECK(profilingState.GetCurrentState() == ProfilingState::Uninitialised);
@@ -2076,7 +2087,7 @@ BOOST_AUTO_TEST_CASE(CheckConnectionAcknowledged)
// command handler received different packet
const uint32_t differentPacketId = 0x40000;
- Packet packetB(differentPacketId, dataLength1, uniqueData1);
+ arm::pipe::Packet packetB(differentPacketId, dataLength1, uniqueData1);
profilingState.TransitionToState(ProfilingState::NotConnected);
profilingState.TransitionToState(ProfilingState::WaitingForAck);
ConnectionAcknowledgedCommandHandler differentCommandHandler(packetFamilyId,
@@ -2093,7 +2104,7 @@ BOOST_AUTO_TEST_CASE(CheckConnectionAcknowledged)
BOOST_AUTO_TEST_CASE(CheckSocketConnectionException)
{
// Check that creating a SocketProfilingConnection armnnProfiling in an exception as the Gator UDS doesn't exist.
- BOOST_CHECK_THROW(new SocketProfilingConnection(), armnnProfiling::SocketConnectionException);
+ BOOST_CHECK_THROW(new SocketProfilingConnection(), arm::pipe::SocketConnectionException);
}
BOOST_AUTO_TEST_CASE(CheckSocketConnectionException2)
@@ -2102,7 +2113,7 @@ BOOST_AUTO_TEST_CASE(CheckSocketConnectionException2)
{
new SocketProfilingConnection();
}
- catch (const armnnProfiling::SocketConnectionException& ex)
+ catch (const arm::pipe::SocketConnectionException& ex)
{
BOOST_CHECK(ex.GetSocketFd() == 0);
BOOST_CHECK(ex.GetErrorNo() == 111);
@@ -2116,13 +2127,13 @@ BOOST_AUTO_TEST_CASE(SwTraceIsValidCharTest)
// Only ASCII 7-bit encoding supported
for (unsigned char c = 0; c < 128; c++)
{
- BOOST_CHECK(SwTraceCharPolicy::IsValidChar(c));
+ BOOST_CHECK(arm::pipe::SwTraceCharPolicy::IsValidChar(c));
}
// Not ASCII
for (unsigned char c = 255; c >= 128; c++)
{
- BOOST_CHECK(!SwTraceCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceCharPolicy::IsValidChar(c));
}
}
@@ -2132,81 +2143,81 @@ BOOST_AUTO_TEST_CASE(SwTraceIsValidNameCharTest)
const unsigned char validChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
for (unsigned char i = 0; i < sizeof(validChars) / sizeof(validChars[0]) - 1; i++)
{
- BOOST_CHECK(SwTraceNameCharPolicy::IsValidChar(validChars[i]));
+ BOOST_CHECK(arm::pipe::SwTraceNameCharPolicy::IsValidChar(validChars[i]));
}
// Non alpha-numeric chars
for (unsigned char c = 0; c < 48; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
for (unsigned char c = 58; c < 65; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
for (unsigned char c = 91; c < 95; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
for (unsigned char c = 96; c < 97; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
for (unsigned char c = 123; c < 128; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
// Not ASCII
for (unsigned char c = 255; c >= 128; c++)
{
- BOOST_CHECK(!SwTraceNameCharPolicy::IsValidChar(c));
+ BOOST_CHECK(!arm::pipe::SwTraceNameCharPolicy::IsValidChar(c));
}
}
BOOST_AUTO_TEST_CASE(IsValidSwTraceStringTest)
{
// Valid SWTrace strings
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>(""));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("_"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("0123"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("valid_string"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("VALID_string_456"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>(" "));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("valid string"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("!$%"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceCharPolicy>("valid|\\~string#123"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>(""));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("_"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("0123"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("valid_string"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("VALID_string_456"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>(" "));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("valid string"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("!$%"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("valid|\\~string#123"));
// Invalid SWTrace strings
- BOOST_CHECK(!IsValidSwTraceString<SwTraceCharPolicy>("€£"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceCharPolicy>("invalid‡string"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceCharPolicy>("12Ž34"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("€£"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("invalid‡string"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceCharPolicy>("12Ž34"));
}
BOOST_AUTO_TEST_CASE(IsValidSwTraceNameStringTest)
{
// Valid SWTrace name strings
- BOOST_CHECK(IsValidSwTraceString<SwTraceNameCharPolicy>(""));
- BOOST_CHECK(IsValidSwTraceString<SwTraceNameCharPolicy>("_"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceNameCharPolicy>("0123"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceNameCharPolicy>("valid_string"));
- BOOST_CHECK(IsValidSwTraceString<SwTraceNameCharPolicy>("VALID_string_456"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(""));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("_"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("0123"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("valid_string"));
+ BOOST_CHECK(arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("VALID_string_456"));
// Invalid SWTrace name strings
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>(" "));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("invalid string"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("!$%"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("invalid|\\~string#123"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("€£"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("invalid‡string"));
- BOOST_CHECK(!IsValidSwTraceString<SwTraceNameCharPolicy>("12Ž34"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>(" "));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid string"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("!$%"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid|\\~string#123"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("€£"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid‡string"));
+ BOOST_CHECK(!arm::pipe::IsValidSwTraceString<arm::pipe::SwTraceNameCharPolicy>("12Ž34"));
}
template <typename SwTracePolicy>
void StringToSwTraceStringTestHelper(const std::string& testString, std::vector<uint32_t> buffer, size_t expectedSize)
{
// Convert the test string to a SWTrace string
- BOOST_CHECK(StringToSwTraceString<SwTracePolicy>(testString, buffer));
+ BOOST_CHECK(arm::pipe::StringToSwTraceString<SwTracePolicy>(testString, buffer));
// The buffer must contain at least the length of the string
BOOST_CHECK(!buffer.empty());
@@ -2230,22 +2241,22 @@ BOOST_AUTO_TEST_CASE(StringToSwTraceStringTest)
std::vector<uint32_t> buffer;
// Valid SWTrace strings (expected size in words)
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("_", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("0123", buffer, 3);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("valid_string", buffer, 5);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("VALID_string_456", buffer, 6);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>(" ", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("valid string", buffer, 5);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("!$%", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceCharPolicy>("valid|\\~string#123", buffer, 6);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("_", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("0123", buffer, 3);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("valid_string", buffer, 5);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("VALID_string_456", buffer, 6);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>(" ", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("valid string", buffer, 5);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("!$%", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceCharPolicy>("valid|\\~string#123", buffer, 6);
// Invalid SWTrace strings
- BOOST_CHECK(!StringToSwTraceString<SwTraceCharPolicy>("€£", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>("€£", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceCharPolicy>("invalid‡string", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>("invalid‡string", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceCharPolicy>("12Ž34", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>("12Ž34", buffer));
BOOST_CHECK(buffer.empty());
}
@@ -2254,26 +2265,26 @@ BOOST_AUTO_TEST_CASE(StringToSwTraceNameStringTest)
std::vector<uint32_t> buffer;
// Valid SWTrace namestrings (expected size in words)
- StringToSwTraceStringTestHelper<SwTraceNameCharPolicy>("", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceNameCharPolicy>("_", buffer, 2);
- StringToSwTraceStringTestHelper<SwTraceNameCharPolicy>("0123", buffer, 3);
- StringToSwTraceStringTestHelper<SwTraceNameCharPolicy>("valid_string", buffer, 5);
- StringToSwTraceStringTestHelper<SwTraceNameCharPolicy>("VALID_string_456", buffer, 6);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceNameCharPolicy>("", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceNameCharPolicy>("_", buffer, 2);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceNameCharPolicy>("0123", buffer, 3);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceNameCharPolicy>("valid_string", buffer, 5);
+ StringToSwTraceStringTestHelper<arm::pipe::SwTraceNameCharPolicy>("VALID_string_456", buffer, 6);
// Invalid SWTrace namestrings
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>(" ", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>(" ", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("invalid string", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid string", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("!$%", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("!$%", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("invalid|\\~string#123", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid|\\~string#123", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("€£", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("€£", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("invalid‡string", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("invalid‡string", buffer));
BOOST_CHECK(buffer.empty());
- BOOST_CHECK(!StringToSwTraceString<SwTraceNameCharPolicy>("12Ž34", buffer));
+ BOOST_CHECK(!arm::pipe::StringToSwTraceString<arm::pipe::SwTraceNameCharPolicy>("12Ž34", buffer));
BOOST_CHECK(buffer.empty());
}
@@ -2414,7 +2425,7 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest1)
const uint32_t wrongPacketId = 47;
const uint32_t wrongHeader = (wrongPacketId & 0x000003FF) << 16;
- Packet wrongPacket(wrongHeader);
+ arm::pipe::Packet wrongPacket(wrongHeader);
profilingStateMachine.TransitionToState(ProfilingState::Uninitialised);
BOOST_CHECK_THROW(commandHandler(wrongPacket), armnn::RuntimeException); // Wrong profiling state
@@ -2427,7 +2438,7 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest1)
const uint32_t rightHeader = (packetId & 0x000003FF) << 16;
- Packet rightPacket(rightHeader);
+ arm::pipe::Packet rightPacket(rightHeader);
BOOST_CHECK_NO_THROW(commandHandler(rightPacket)); // Right packet
@@ -2473,7 +2484,7 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest2)
RequestCounterDirectoryCommandHandler commandHandler(familyId, packetId, version, counterDirectory,
sendCounterPacket, sendTimelinePacket, profilingStateMachine);
const uint32_t header = (packetId & 0x000003FF) << 16;
- const Packet packet(header);
+ const arm::pipe::Packet packet(header);
const Device* device = counterDirectory.RegisterDevice("deviceA", 1);
BOOST_CHECK(device != nullptr);
@@ -2587,7 +2598,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodConnectionAcknowledgedPacket)
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Connection Acknowledged Packet
- Packet connectionAcknowledgedPacket(header);
+ arm::pipe::Packet connectionAcknowledgedPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(connectionAcknowledgedPacket));
@@ -2643,7 +2654,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodRequestCounterDirectoryPacket)
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Request Counter Directory packet
- Packet requestCounterDirectoryPacket(header);
+ arm::pipe::Packet requestCounterDirectoryPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(requestCounterDirectoryPacket));
@@ -2720,8 +2731,9 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceBadPeriodicCounterSelectionPacketInval
WriteUint16(data.get(), 6, counterUidB);
// Create the Periodic Counter Selection packet
- Packet periodicCounterSelectionPacket(header, length, data); // Length > 0, this will start the Period Counter
- // Capture thread
+ // Length > 0, this will start the Period Counter Capture thread
+ arm::pipe::Packet periodicCounterSelectionPacket(header, length, data);
+
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
@@ -2783,7 +2795,8 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketNoCo
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Periodic Counter Selection packet
- Packet periodicCounterSelectionPacket(header); // Length == 0, this will disable the collection of counters
+ // Length == 0, this will disable the collection of counters
+ arm::pipe::Packet periodicCounterSelectionPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
@@ -2861,8 +2874,8 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketSing
WriteUint16(data.get(), 4, counterUid);
// Create the Periodic Counter Selection packet
- Packet periodicCounterSelectionPacket(header, length, data); // Length > 0, this will start the Period Counter
- // Capture thread
+ // Length > 0, this will start the Period Counter Capture thread
+ arm::pipe::Packet periodicCounterSelectionPacket(header, length, data);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
@@ -2940,8 +2953,8 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketMult
WriteUint16(data.get(), 6, counterUidB);
// Create the Periodic Counter Selection packet
- Packet periodicCounterSelectionPacket(header, length, data); // Length > 0, this will start the Period Counter
- // Capture thread
+ // Length > 0, this will start the Period Counter Capture thread
+ arm::pipe::Packet periodicCounterSelectionPacket(header, length, data);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
@@ -3061,7 +3074,8 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPerJobCounterSelectionPacket)
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Per-Job Counter Selection packet
- Packet periodicCounterSelectionPacket(header); // Length == 0, this will disable the collection of counters
+ // Length == 0, this will disable the collection of counters
+ arm::pipe::Packet periodicCounterSelectionPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
@@ -3218,7 +3232,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceBadConnectionAcknowledgedPacket)
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Connection Acknowledged Packet
- Packet connectionAcknowledgedPacket(header);
+ arm::pipe::Packet connectionAcknowledgedPacket(header);
// Write an invalid "Connection Acknowledged" packet into the mock profiling connection, to simulate an invalid
// reply from an external profiling service
mockProfilingConnection->WritePacket(std::move(connectionAcknowledgedPacket));
@@ -3282,7 +3296,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceBadRequestCounterDirectoryPacket)
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Request Counter Directory packet
- Packet requestCounterDirectoryPacket(header);
+ arm::pipe::Packet requestCounterDirectoryPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(requestCounterDirectoryPacket));
@@ -3347,7 +3361,8 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceBadPeriodicCounterSelectionPacket)
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
// Create the Periodic Counter Selection packet
- Packet periodicCounterSelectionPacket(header); // Length == 0, this will disable the collection of counters
+ // Length == 0, this will disable the collection of counters
+ arm::pipe::Packet periodicCounterSelectionPacket(header);
// Write the packet to the mock profiling connection
mockProfilingConnection->WritePacket(std::move(periodicCounterSelectionPacket));
diff --git a/src/profiling/test/ProfilingTests.hpp b/src/profiling/test/ProfilingTests.hpp
index c350fd2860..f96a1c89ab 100644
--- a/src/profiling/test/ProfilingTests.hpp
+++ b/src/profiling/test/ProfilingTests.hpp
@@ -10,10 +10,12 @@
#include <armnn/Logging.hpp>
#include <armnn/utility/PolymorphicDowncast.hpp>
-#include <CommandHandlerFunctor.hpp>
#include <IProfilingConnection.hpp>
#include <ProfilingService.hpp>
+#include <common/include/CommandHandlerFunctor.hpp>
+
+
#include <boost/test/unit_test.hpp>
#include <chrono>
@@ -82,14 +84,14 @@ public:
return false;
}
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
// First time we're called return a connection ack packet. After that always timeout.
if (m_FirstCall)
{
m_FirstCall = false;
// Return connection acknowledged packet
- return Packet(65536);
+ return arm::pipe::Packet(65536);
}
else
{
@@ -108,7 +110,7 @@ public:
: m_ReadRequests(0)
{}
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
// Return connection acknowledged packet after three timeouts
if (m_ReadRequests % 3 == 0)
@@ -118,7 +120,7 @@ public:
throw armnn::TimeoutException("Simulate a timeout error\n");
}
- return Packet(65536);
+ return arm::pipe::Packet(65536);
}
int ReadCalledCount()
@@ -137,7 +139,7 @@ public:
: m_ReadRequests(0)
{}
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
IgnoreUnused(timeout);
++m_ReadRequests;
@@ -156,7 +158,7 @@ private:
class TestProfilingConnectionBadAckPacket : public TestProfilingConnectionBase
{
public:
- Packet ReadPacket(uint32_t timeout) override
+ arm::pipe::Packet ReadPacket(uint32_t timeout) override
{
IgnoreUnused(timeout);
// Connection Acknowledged Packet header (word 0, word 1 is always zero):
@@ -168,18 +170,18 @@ public:
uint32_t packetId = 37; // Wrong packet id!!!
uint32_t header = ((packetFamily & 0x0000003F) << 26) | ((packetId & 0x000003FF) << 16);
- return Packet(header);
+ return arm::pipe::Packet(header);
}
};
-class TestFunctorA : public CommandHandlerFunctor
+class TestFunctorA : public arm::pipe::CommandHandlerFunctor
{
public:
using CommandHandlerFunctor::CommandHandlerFunctor;
int GetCount() { return m_Count; }
- void operator()(const Packet& packet) override
+ void operator()(const arm::pipe::Packet& packet) override
{
IgnoreUnused(packet);
m_Count++;
diff --git a/src/profiling/test/RequestCountersPacketHandler.cpp b/src/profiling/test/RequestCountersPacketHandler.cpp
index 76c4b0cdc6..230c38857f 100644
--- a/src/profiling/test/RequestCountersPacketHandler.cpp
+++ b/src/profiling/test/RequestCountersPacketHandler.cpp
@@ -1,12 +1,12 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "RequestCountersPacketHandler.hpp"
#include "DirectoryCaptureCommandHandler.hpp"
-#include "PacketVersionResolver.hpp"
+#include <common/include/PacketVersionResolver.hpp>
#include <common/include/ProfilingException.hpp>
@@ -23,13 +23,13 @@ std::vector<uint32_t> RequestCountersPacketHandler::GetHeadersAccepted()
return headers;
}
-void RequestCountersPacketHandler::HandlePacket(const Packet& packet)
+void RequestCountersPacketHandler::HandlePacket(const arm::pipe::Packet& packet)
{
if (packet.GetHeader() != m_CounterDirectoryMessageHeader)
{
return;
}
- armnn::profiling::PacketVersionResolver packetVersionResolver;
+ arm::pipe::PacketVersionResolver packetVersionResolver;
DirectoryCaptureCommandHandler directoryCaptureCommandHandler(
0, 2, packetVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue());
directoryCaptureCommandHandler.operator()(packet);
@@ -69,7 +69,7 @@ void RequestCountersPacketHandler::SendCounterSelectionPacket()
offset += uint16_t_size;
}
- Packet packet(0x40000, bodySize, uniqueData);
+ arm::pipe::Packet packet(0x40000, bodySize, uniqueData);
m_Connection->ReturnPacket(packet);
}
diff --git a/src/profiling/test/RequestCountersPacketHandler.hpp b/src/profiling/test/RequestCountersPacketHandler.hpp
index 203edcc9df..b5e48626a7 100644
--- a/src/profiling/test/RequestCountersPacketHandler.hpp
+++ b/src/profiling/test/RequestCountersPacketHandler.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2020 Arm Ltd. All rights reserved.
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -7,9 +7,10 @@
#include <armnn/Types.hpp>
#include <armnn/profiling/ILocalPacketHandler.hpp>
-#include "Packet.hpp"
#include "ProfilingUtils.hpp"
+#include <common/include/Packet.hpp>
+
namespace armnn
{
@@ -26,7 +27,7 @@ public:
std::vector<uint32_t> GetHeadersAccepted() override; // ILocalPacketHandler
- void HandlePacket(const Packet& packet) override; // ILocalPacketHandler
+ void HandlePacket(const arm::pipe::Packet& packet) override; // ILocalPacketHandler
void SetConnection(IInternalProfilingConnection* profilingConnection) override // ILocalPacketHandler
{
diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp
index c5f9177c90..87cfb5bf58 100644
--- a/src/profiling/test/SendCounterPacketTests.cpp
+++ b/src/profiling/test/SendCounterPacketTests.cpp
@@ -9,7 +9,7 @@
#include <BufferManager.hpp>
#include <CounterDirectory.hpp>
-#include <EncodeVersion.hpp>
+#include <common/include/EncodeVersion.hpp>
#include <ProfilingUtils.hpp>
#include <SendCounterPacket.hpp>
#include <Processes.hpp>
@@ -325,19 +325,19 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest)
// Timeline Message Directory (packet_family = 1, packet_class = 0, packet_type = 0) Version 1.0.0
// Timeline Message (packet_family = 1, packet_class = 0, packet_type = 1) Version 1.0.0
std::vector<std::pair<uint32_t, uint32_t>> packetVersions;
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 1), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 2), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 3), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 4), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 5), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 6), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(0, 7), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 1), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 0), EncodeVersion(1, 0, 0)));
- packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 1), EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 2), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 3), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 4), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 5), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 6), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(0, 7), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 1), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
+ packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
uint32_t packetEntries = static_cast<uint32_t>(packetVersions.size());
@@ -359,9 +359,9 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest)
BOOST_TEST(headerWord1 == totalLength - (2 * sizeUint32)); // data length
uint32_t offset = sizeUint32 * 2;
- BOOST_TEST(ReadUint32(readBuffer2, offset) == armnnProfiling::PIPE_MAGIC); // pipe_magic
+ BOOST_TEST(ReadUint32(readBuffer2, offset) == arm::pipe::PIPE_MAGIC); // pipe_magic
offset += sizeUint32;
- BOOST_TEST(ReadUint32(readBuffer2, offset) == EncodeVersion(1, 0, 0)); // stream_metadata_version
+ BOOST_TEST(ReadUint32(readBuffer2, offset) == arm::pipe::EncodeVersion(1, 0, 0)); // stream_metadata_version
offset += sizeUint32;
BOOST_TEST(ReadUint32(readBuffer2, offset) == MAX_METADATA_PACKET_LENGTH); // max_data_len
offset += sizeUint32;
diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp
index 5e9f6bddea..7b68bb9753 100644
--- a/src/profiling/test/SendTimelinePacketTests.cpp
+++ b/src/profiling/test/SendTimelinePacketTests.cpp
@@ -6,14 +6,16 @@
#include "ProfilingMocks.hpp"
#include <BufferManager.hpp>
-#include <Threads.hpp>
+#include <LabelsAndEventClasses.hpp>
#include <ProfilingService.hpp>
#include <ProfilingUtils.hpp>
#include <SendTimelinePacket.hpp>
+#include <Threads.hpp>
#include <TimelinePacketWriterFactory.hpp>
+#include <common/include/SwTrace.hpp>
+
#include <boost/test/unit_test.hpp>
-#include <LabelsAndEventClasses.hpp>
#include <functional>
#include <Runtime.hpp>
@@ -72,9 +74,9 @@ BOOST_AUTO_TEST_CASE(SendTimelineMessageDirectoryPackageTest)
BOOST_CHECK(DeclCount == 5);
offset += uint32_t_size;
- SwTraceMessage swTraceMessage = ReadSwTraceMessage(packetBuffer->GetReadableData(),
- offset,
- packetBuffer->GetSize());
+ arm::pipe::SwTraceMessage swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
+ offset,
+ packetBuffer->GetSize());
BOOST_CHECK(swTraceMessage.m_Id == 0);
BOOST_CHECK(swTraceMessage.m_Name == "declareLabel");
@@ -86,7 +88,9 @@ BOOST_AUTO_TEST_CASE(SendTimelineMessageDirectoryPackageTest)
BOOST_CHECK(swTraceMessage.m_ArgNames[0] == "guid");
BOOST_CHECK(swTraceMessage.m_ArgNames[1] == "value");
- swTraceMessage = ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize());
+ swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
+ offset,
+ packetBuffer->GetSize());
BOOST_CHECK(swTraceMessage.m_Id == 1);
BOOST_CHECK(swTraceMessage.m_Name == "declareEntity");
@@ -96,7 +100,9 @@ BOOST_AUTO_TEST_CASE(SendTimelineMessageDirectoryPackageTest)
BOOST_CHECK(swTraceMessage.m_ArgNames.size() == 1);
BOOST_CHECK(swTraceMessage.m_ArgNames[0] == "guid");
- swTraceMessage = ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize());
+ swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
+ offset,
+ packetBuffer->GetSize());
BOOST_CHECK(swTraceMessage.m_Id == 2);
BOOST_CHECK(swTraceMessage.m_Name == "declareEventClass");
@@ -108,7 +114,9 @@ BOOST_AUTO_TEST_CASE(SendTimelineMessageDirectoryPackageTest)
BOOST_CHECK(swTraceMessage.m_ArgNames[0] == "guid");
BOOST_CHECK(swTraceMessage.m_ArgNames[1] == "nameGuid");
- swTraceMessage = ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize());
+ swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
+ offset,
+ packetBuffer->GetSize());
BOOST_CHECK(swTraceMessage.m_Id == 3);
BOOST_CHECK(swTraceMessage.m_Name == "declareRelationship");
@@ -126,7 +134,9 @@ BOOST_AUTO_TEST_CASE(SendTimelineMessageDirectoryPackageTest)
BOOST_CHECK(swTraceMessage.m_ArgNames[3] == "tailGuid");
BOOST_CHECK(swTraceMessage.m_ArgNames[4] == "attributeGuid");
- swTraceMessage = ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize());
+ swTraceMessage = arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(),
+ offset,
+ packetBuffer->GetSize());
BOOST_CHECK(swTraceMessage.m_Id == 4);
BOOST_CHECK(swTraceMessage.m_Name == "declareEvent");
diff --git a/src/profiling/test/TestTimelinePacketHandler.cpp b/src/profiling/test/TestTimelinePacketHandler.cpp
index ccb806b238..df847d4c7c 100644
--- a/src/profiling/test/TestTimelinePacketHandler.cpp
+++ b/src/profiling/test/TestTimelinePacketHandler.cpp
@@ -7,11 +7,8 @@
#include "IProfilingConnection.hpp"
#include <LabelsAndEventClasses.hpp>
-#include <armnn/utility/IgnoreUnused.hpp>
-
#include <chrono>
#include <iostream>
-#include <sstream>
namespace armnn
{
@@ -27,7 +24,7 @@ std::vector<uint32_t> TestTimelinePacketHandler::GetHeadersAccepted()
return headers;
}
-void TestTimelinePacketHandler::HandlePacket(const Packet& packet)
+void TestTimelinePacketHandler::HandlePacket(const arm::pipe::Packet& packet)
{
if (packet.GetHeader() == m_DirectoryHeader)
{
@@ -79,44 +76,46 @@ void TestTimelinePacketHandler::SetInferenceComplete()
m_InferenceCompletedConditionVariable.notify_one();
}
-void TestTimelinePacketHandler::ProcessDirectoryPacket(const Packet& packet)
+void TestTimelinePacketHandler::ProcessDirectoryPacket(const arm::pipe::Packet& packet)
{
m_DirectoryDecoder(packet);
}
-void TestTimelinePacketHandler::ProcessMessagePacket(const Packet& packet)
+void TestTimelinePacketHandler::ProcessMessagePacket(const arm::pipe::Packet& packet)
{
m_Decoder(packet);
}
// TimelineMessageDecoder functions
-ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEntity(const Entity& entity)
+arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEntity(const Entity& entity)
{
m_TimelineModel.AddEntity(entity.m_Guid);
- return ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
+ return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
}
-ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEventClass(
- const ITimelineDecoder::EventClass& eventClass)
+arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEventClass(
+ const arm::pipe::ITimelineDecoder::EventClass& eventClass)
{
m_TimelineModel.AddEventClass(eventClass);
- return ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
+ return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
}
-ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEvent(const ITimelineDecoder::Event& event)
+arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEvent(
+ const arm::pipe::ITimelineDecoder::Event& event)
{
m_TimelineModel.AddEvent(event);
- return ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
+ return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
}
-ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateLabel(const ITimelineDecoder::Label& label)
+arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateLabel(
+ const arm::pipe::ITimelineDecoder::Label& label)
{
m_TimelineModel.AddLabel(label);
- return ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
+ return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
}
-ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateRelationship(
- const ITimelineDecoder::Relationship& relationship)
+arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateRelationship(
+ const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
m_TimelineModel.AddRelationship(relationship);
// check to see if this is an execution link to an inference of event class end of life
@@ -133,7 +132,7 @@ ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateRelationship(
}
}
}
- return ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
+ return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
}
} // namespace profiling
diff --git a/src/profiling/test/TestTimelinePacketHandler.hpp b/src/profiling/test/TestTimelinePacketHandler.hpp
index 08239fc38f..ab6eee5121 100644
--- a/src/profiling/test/TestTimelinePacketHandler.hpp
+++ b/src/profiling/test/TestTimelinePacketHandler.hpp
@@ -6,14 +6,15 @@
#pragma once
#include <armnn/profiling/ILocalPacketHandler.hpp>
-#include <armnn/profiling/ITimelineDecoder.hpp>
-#include <Packet.hpp>
+#include <server/include/timelineDecoder/ITimelineDecoder.hpp>
#include "ProfilingUtils.hpp"
-#include "TimelineCaptureCommandHandler.hpp"
-#include "TimelineDirectoryCaptureCommandHandler.hpp"
+#include <server/include/timelineDecoder/TimelineCaptureCommandHandler.hpp>
+#include <server/include/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp>
#include "TimelineModel.hpp"
+#include <common/include/Packet.hpp>
+
#include <condition_variable>
#include <map>
#include <mutex>
@@ -27,7 +28,7 @@ namespace profiling
// forward declaration of class
class TestTimelinePacketHandler;
-class TimelineMessageDecoder : public ITimelineDecoder
+class TimelineMessageDecoder : public arm::pipe::ITimelineDecoder
{
public:
TimelineMessageDecoder(TimelineModel& model) : m_PacketHandler(nullptr), m_TimelineModel(model) {}
@@ -57,7 +58,7 @@ public:
virtual std::vector<uint32_t> GetHeadersAccepted() override; // ILocalPacketHandler
- virtual void HandlePacket(const Packet& packet) override; // ILocalPacketHandler
+ virtual void HandlePacket(const arm::pipe::Packet& packet) override; // ILocalPacketHandler
void Stop();
@@ -72,8 +73,8 @@ public:
}
private:
- void ProcessDirectoryPacket(const Packet& packet);
- void ProcessMessagePacket(const Packet& packet);
+ void ProcessDirectoryPacket(const arm::pipe::Packet& packet);
+ void ProcessMessagePacket(const arm::pipe::Packet& packet);
IInternalProfilingConnection* m_Connection;
std::mutex m_InferenceCompletedMutex;
std::condition_variable m_InferenceCompletedConditionVariable;
@@ -82,8 +83,8 @@ private:
uint32_t m_DirectoryHeader;
uint32_t m_MessageHeader;
TimelineMessageDecoder m_MessageDecoder;
- timelinedecoder::TimelineCaptureCommandHandler m_Decoder;
- timelinedecoder::TimelineDirectoryCaptureCommandHandler m_DirectoryDecoder;
+ arm::pipe::TimelineCaptureCommandHandler m_Decoder;
+ arm::pipe::TimelineDirectoryCaptureCommandHandler m_DirectoryDecoder;
};
} // namespace profiling
diff --git a/src/profiling/test/TimelineModel.cpp b/src/profiling/test/TimelineModel.cpp
index 2e4fd06013..1f02addcf9 100644
--- a/src/profiling/test/TimelineModel.cpp
+++ b/src/profiling/test/TimelineModel.cpp
@@ -14,7 +14,7 @@ namespace armnn
namespace profiling
{
-void TimelineModel::AddLabel(const ITimelineDecoder::Label& label)
+void TimelineModel::AddLabel(const arm::pipe::ITimelineDecoder::Label& label)
{
m_LabelMap.emplace(label.m_Guid, label);
}
@@ -50,14 +50,14 @@ Entity* TimelineModel::FindEntity(uint64_t id)
}
}
-void TimelineModel::AddRelationship(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::AddRelationship(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
m_Relationships.emplace(relationship.m_Guid, relationship);
- if (relationship.m_RelationshipType == ITimelineDecoder::RelationshipType::LabelLink)
+ if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::LabelLink)
{
HandleLabelLink(relationship);
}
- else if (relationship.m_RelationshipType == ITimelineDecoder::RelationshipType::RetentionLink)
+ else if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink)
{
// Take care of the special case of a connection between layers in ArmNN
// modelled by a retention link between two layer entities with an attribute GUID
@@ -79,16 +79,16 @@ void TimelineModel::AddRelationship(const ITimelineDecoder::Relationship& relati
// report unknown relationship type
std::stringstream ss;
ss << "Encountered a RetentionLink of unknown type [" << relationship.m_AttributeGuid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
}
- else if (relationship.m_RelationshipType == ITimelineDecoder::RelationshipType::ExecutionLink)
+ else if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink)
{
HandleExecutionLink(relationship);
}
}
-void TimelineModel::HandleLabelLink(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::HandleLabelLink(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
Entity* entity = FindEntity(relationship.m_HeadGuid);
// we have a label attribute of an entity
@@ -101,7 +101,7 @@ void TimelineModel::HandleLabelLink(const ITimelineDecoder::Relationship& relati
std::stringstream ss;
ss << "could not find label link [" << relationship.m_Guid <<
"] value [" << relationship.m_TailGuid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
if (relationship.m_AttributeGuid != 0)
{
@@ -112,7 +112,7 @@ void TimelineModel::HandleLabelLink(const ITimelineDecoder::Relationship& relati
std::stringstream ss;
ss << "could not find label link [" << relationship.m_Guid <<
"] attribute [" << relationship.m_AttributeGuid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
}
else
@@ -120,7 +120,7 @@ void TimelineModel::HandleLabelLink(const ITimelineDecoder::Relationship& relati
//report an error
std::stringstream ss;
ss << "label link [" << relationship.m_Guid << "] has a zero attribute guid";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
if (entity != nullptr && attribute != nullptr && value != nullptr)
{
@@ -148,11 +148,11 @@ void TimelineModel::HandleLabelLink(const ITimelineDecoder::Relationship& relati
{
ss << "attribute [" << *attribute << "] ";
}
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
}
-void TimelineModel::HandleConnection(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::HandleConnection(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
Entity* outputLayer = FindEntity(relationship.m_HeadGuid);
if (outputLayer == nullptr)
@@ -160,7 +160,7 @@ void TimelineModel::HandleConnection(const ITimelineDecoder::Relationship& relat
std::stringstream ss;
ss << "could not find output entity [" << relationship.m_HeadGuid << "]";
ss << " of connection [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
Entity* inputLayer = FindEntity(relationship.m_TailGuid);
@@ -169,14 +169,14 @@ void TimelineModel::HandleConnection(const ITimelineDecoder::Relationship& relat
std::stringstream ss;
ss << "could not find input entity [" << relationship.m_TailGuid << "]";
ss << " of connection [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
Connection connection(relationship.m_Guid, outputLayer, inputLayer);
outputLayer->AddConnection(connection);
}
-void TimelineModel::HandleChild(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::HandleChild(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
Entity* parentEntity = FindEntity(relationship.m_HeadGuid);
if (parentEntity == nullptr)
@@ -184,7 +184,7 @@ void TimelineModel::HandleChild(const ITimelineDecoder::Relationship& relationsh
std::stringstream ss;
ss << "could not find parent entity [" << relationship.m_HeadGuid << "]";
ss << " of child relationship [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
Entity* childEntity = FindEntity(relationship.m_TailGuid);
@@ -193,13 +193,13 @@ void TimelineModel::HandleChild(const ITimelineDecoder::Relationship& relationsh
std::stringstream ss;
ss << "could not find child entity [" << relationship.m_TailGuid << "]";
ss << " of child relationship [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
parentEntity->AddChild(childEntity);
}
-void TimelineModel::HandleExecutionOf(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::HandleExecutionOf(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
Entity* parentEntity = FindEntity(relationship.m_HeadGuid);
if (parentEntity == nullptr)
@@ -207,7 +207,7 @@ void TimelineModel::HandleExecutionOf(const ITimelineDecoder::Relationship& rela
std::stringstream ss;
ss << "could not find parent entity [" << relationship.m_HeadGuid << "]";
ss << " of execution relationship [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
Entity* executedEntity = FindEntity(relationship.m_TailGuid);
@@ -216,13 +216,13 @@ void TimelineModel::HandleExecutionOf(const ITimelineDecoder::Relationship& rela
std::stringstream ss;
ss << "could not find executed entity [" << relationship.m_TailGuid << "]";
ss << " of execution relationship [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
parentEntity->AddExecution(executedEntity);
}
-void TimelineModel::HandleExecutionLink(const ITimelineDecoder::Relationship& relationship)
+void TimelineModel::HandleExecutionLink(const arm::pipe::ITimelineDecoder::Relationship& relationship)
{
// entityGuid,
Entity* parentEntity = FindEntity(relationship.m_HeadGuid);
@@ -231,7 +231,7 @@ void TimelineModel::HandleExecutionLink(const ITimelineDecoder::Relationship& re
std::stringstream ss;
ss << "could not find entity [" << relationship.m_HeadGuid << "]";
ss << " of ExecutionLink [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
// eventGuid,
@@ -241,7 +241,7 @@ void TimelineModel::HandleExecutionLink(const ITimelineDecoder::Relationship& re
std::stringstream ss;
ss << "could not find event [" << relationship.m_TailGuid << "]";
ss << " of ExecutionLink [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
// eventClassGuid
@@ -251,7 +251,7 @@ void TimelineModel::HandleExecutionLink(const ITimelineDecoder::Relationship& re
std::stringstream ss;
ss << "could not find event class [" << relationship.m_TailGuid << "]";
ss << " of ExecutionLink [" << relationship.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
return;
}
eventObj->SetEventClass(eventClassObj);
@@ -277,7 +277,7 @@ bool TimelineModel::IsInferenceGuid(uint64_t guid) const
return it != m_InferenceGuids.end();
}
-void TimelineModel::AddEventClass(const ITimelineDecoder::EventClass& eventClass)
+void TimelineModel::AddEventClass(const arm::pipe::ITimelineDecoder::EventClass& eventClass)
{
std::string* eventClassName = FindLabel(eventClass.m_NameGuid);
if (eventClassName != nullptr)
@@ -290,7 +290,7 @@ void TimelineModel::AddEventClass(const ITimelineDecoder::EventClass& eventClass
std::stringstream ss;
ss << "could not find name [" << eventClass.m_NameGuid << "]";
ss << " of of event class [" << eventClass.m_Guid << "]";
- m_Errors.push_back(armnnProfiling::ProfilingException(ss.str()));
+ m_Errors.push_back(arm::pipe::ProfilingException(ss.str()));
}
}
@@ -307,7 +307,7 @@ EventClassObj* TimelineModel::FindEventClass(uint64_t id)
}
}
-void TimelineModel::AddEvent(const ITimelineDecoder::Event& event)
+void TimelineModel::AddEvent(const arm::pipe::ITimelineDecoder::Event& event)
{
EventObj evt(event.m_Guid, event.m_TimeStamp, event.m_ThreadId);
m_Events.emplace(event.m_Guid, evt);
diff --git a/src/profiling/test/TimelineModel.hpp b/src/profiling/test/TimelineModel.hpp
index a6d62ce3e8..ccbec7b01d 100644
--- a/src/profiling/test/TimelineModel.hpp
+++ b/src/profiling/test/TimelineModel.hpp
@@ -5,8 +5,8 @@
#pragma once
-#include <armnn/profiling/ITimelineDecoder.hpp>
#include <common/include/ProfilingException.hpp>
+#include <server/include/timelineDecoder/ITimelineDecoder.hpp>
#include <map>
#include <sstream>
@@ -17,7 +17,7 @@ namespace armnn
namespace profiling
{
-using LabelMap = std::map<uint64_t, ITimelineDecoder::Label>;
+using LabelMap = std::map<uint64_t, arm::pipe::ITimelineDecoder::Label>;
using Attribute = std::pair<std::string, std::string>;
using Attributes = std::map<std::string, Attribute>;
class Entity;
@@ -31,13 +31,13 @@ public:
{
std::stringstream ss;
ss << "connection [" << guid << "] head cannot be null";
- throw armnnProfiling::ProfilingException(ss.str());
+ throw arm::pipe::ProfilingException(ss.str());
}
if (tail == nullptr)
{
std::stringstream ss;
ss << "connection [" << guid << "] tail cannot be null";
- throw armnnProfiling::ProfilingException(ss.str());
+ throw arm::pipe::ProfilingException(ss.str());
}
}
@@ -136,8 +136,8 @@ private:
using Entities = std::map<uint64_t, Entity>;
struct ModelRelationship
{
- ModelRelationship(const ITimelineDecoder::Relationship& relationship) : m_Relationship(relationship) {}
- ITimelineDecoder::Relationship m_Relationship;
+ ModelRelationship(const arm::pipe::ITimelineDecoder::Relationship& relationship) : m_Relationship(relationship) {}
+ arm::pipe::ITimelineDecoder::Relationship m_Relationship;
std::vector<Entity*> m_RelatedEntities;
};
using Relationships = std::map<uint64_t, ModelRelationship>;
@@ -146,35 +146,35 @@ using Events = std::map<uint64_t, EventObj>;
class TimelineModel
{
public:
- void AddLabel(const ITimelineDecoder::Label& label);
+ void AddLabel(const arm::pipe::ITimelineDecoder::Label& label);
std::string* FindLabel(uint64_t guid);
void AddEntity(uint64_t guid);
Entity* FindEntity(uint64_t id);
- void AddRelationship(const ITimelineDecoder::Relationship& relationship);
+ void AddRelationship(const arm::pipe::ITimelineDecoder::Relationship& relationship);
ModelRelationship* FindRelationship(uint64_t id);
const LabelMap& GetLabelMap() const {return m_LabelMap;}
const Entities& GetEntities() const {return m_Entities;}
- const std::vector<armnnProfiling::ProfilingException>& GetErrors() const {return m_Errors;}
+ const std::vector<arm::pipe::ProfilingException>& GetErrors() const {return m_Errors;}
bool IsInferenceGuid(uint64_t guid) const;
- void AddEventClass(const ITimelineDecoder::EventClass& eventClass);
+ void AddEventClass(const arm::pipe::ITimelineDecoder::EventClass& eventClass);
const EventClasses& GetEventClasses() const {return m_EventClasses;}
EventClassObj* FindEventClass(uint64_t id);
- void AddEvent(const ITimelineDecoder::Event& event);
+ void AddEvent(const arm::pipe::ITimelineDecoder::Event& event);
EventObj* FindEvent(uint64_t id);
private:
LabelMap m_LabelMap;
Entities m_Entities;
Relationships m_Relationships;
- std::vector<armnnProfiling::ProfilingException> m_Errors;
+ std::vector<arm::pipe::ProfilingException> m_Errors;
std::vector<uint64_t> m_InferenceGuids;
EventClasses m_EventClasses;
Events m_Events;
- void HandleLabelLink(const ITimelineDecoder::Relationship& relationship);
- void HandleConnection(const ITimelineDecoder::Relationship& relationship);
- void HandleChild(const ITimelineDecoder::Relationship& relationship);
- void HandleExecutionOf(const ITimelineDecoder::Relationship& relationship);
- void HandleExecutionLink(const ITimelineDecoder::Relationship& relationship);
+ void HandleLabelLink(const arm::pipe::ITimelineDecoder::Relationship& relationship);
+ void HandleConnection(const arm::pipe::ITimelineDecoder::Relationship& relationship);
+ void HandleChild(const arm::pipe::ITimelineDecoder::Relationship& relationship);
+ void HandleExecutionOf(const arm::pipe::ITimelineDecoder::Relationship& relationship);
+ void HandleExecutionLink(const arm::pipe::ITimelineDecoder::Relationship& relationship);
};
std::vector<std::string> GetModelDescription(const TimelineModel& model);
diff --git a/src/profiling/test/TimelinePacketTests.cpp b/src/profiling/test/TimelinePacketTests.cpp
index 71c6915a8c..4f056ce761 100644
--- a/src/profiling/test/TimelinePacketTests.cpp
+++ b/src/profiling/test/TimelinePacketTests.cpp
@@ -6,6 +6,8 @@
#include <Threads.hpp>
#include <ProfilingUtils.hpp>
+#include <common/include/SwTrace.hpp>
+
#include <boost/test/unit_test.hpp>
#include <boost/numeric/conversion/cast.hpp>
@@ -524,7 +526,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestFullConstruction)
// Check the ui_name
std::vector<uint32_t> swTraceString;
- StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString);
+ arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
uint32_t swTraceUINameLength = ReadUint32(buffer.data(), offset);
BOOST_CHECK(swTraceUINameLength == 14); // ui_name length including the null-terminator
@@ -536,7 +538,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestFullConstruction)
swTraceUINameLength - 1) == 0); // The length of the label
// Check arg_types
- StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString);
+ arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
uint32_t swTraceArgTypesLength = ReadUint32(buffer.data(), offset);
BOOST_CHECK(swTraceArgTypesLength == 3); // arg_types length including the null-terminator
@@ -548,7 +550,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestFullConstruction)
swTraceArgTypesLength - 1) == 0); // The length of the label
// Check arg_names
- StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString);
+ arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
uint32_t swTraceArgNamesLength = ReadUint32(buffer.data(), offset);
BOOST_CHECK(swTraceArgNamesLength == 11); // arg_names length including the null-terminator
@@ -560,7 +562,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestFullConstruction)
swTraceArgNamesLength - 1) == 0); // The length of the label
// Check second message decl_id
- StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString);
+ arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
readDeclId = ReadUint32(buffer.data(), offset);
BOOST_CHECK(readDeclId == 1);
diff --git a/src/timelineDecoder/CMakeLists.txt b/src/timelineDecoder/CMakeLists.txt
index 695aa5cbe8..e7d5481eb5 100644
--- a/src/timelineDecoder/CMakeLists.txt
+++ b/src/timelineDecoder/CMakeLists.txt
@@ -1,37 +1,31 @@
#
-# Copyright © 2020 Arm Ltd. All rights reserved.
+# Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
# SPDX-License-Identifier: MIT
#
if(BUILD_TIMELINE_DECODER)
- set(timelineDecoder_sources)
- list(APPEND timelineDecoder_sources
- ${PROJECT_SOURCE_DIR}/include/armnn/profiling/ITimelineDecoder.hpp
- TimelineCaptureCommandHandler.cpp
- TimelineCaptureCommandHandler.hpp
+ set(jsonTimelineDecoder_sources)
+ list(APPEND jsonTimelineDecoder_sources
JSONTimelineDecoder.cpp
- JSONTimelineDecoder.hpp
- TimelineDecoder.cpp
- TimelineDecoder.hpp
- TimelineDirectoryCaptureCommandHandler.cpp
- TimelineDirectoryCaptureCommandHandler.hpp)
+ JSONTimelineDecoder.hpp)
include_directories(${PROJECT_SOURCE_DIR}/src/profiling
${PROJECT_SOURCE_DIR}/profiling/common/include
+ ${PROJECT_SOURCE_DIR}/profiling/server/include/timelineDecoder
${PROJECT_SOURCE_DIR}/src/armnnUtils)
if(BUILD_UNIT_TESTS)
target_include_directories(UnitTests PRIVATE ${PROJECT_SOURCE_DIR}/src/timelineDecoder)
endif()
- add_library_ex(timelineDecoder SHARED ${timelineDecoder_sources})
+ add_library_ex(jsonTimelineDecoder SHARED ${jsonTimelineDecoder_sources})
- set_target_properties(timelineDecoder PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
- set_target_properties(timelineDecoder PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
+ set_target_properties(jsonTimelineDecoder PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
+ set_target_properties(jsonTimelineDecoder PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
- target_link_libraries(timelineDecoder armnn)
+ target_link_libraries(jsonTimelineDecoder armnn)
- install(TARGETS timelineDecoder
+ install(TARGETS jsonTimelineDecoder
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
diff --git a/src/timelineDecoder/JSONTimelineDecoder.cpp b/src/timelineDecoder/JSONTimelineDecoder.cpp
index c0e81370ed..0eafe493aa 100644
--- a/src/timelineDecoder/JSONTimelineDecoder.cpp
+++ b/src/timelineDecoder/JSONTimelineDecoder.cpp
@@ -7,7 +7,6 @@
#include "../profiling/ProfilingUtils.hpp"
#include <string>
-#include <fstream>
namespace armnn
{
diff --git a/src/timelineDecoder/JSONTimelineDecoder.hpp b/src/timelineDecoder/JSONTimelineDecoder.hpp
index a6e2579b45..7fed9a1a86 100644
--- a/src/timelineDecoder/JSONTimelineDecoder.hpp
+++ b/src/timelineDecoder/JSONTimelineDecoder.hpp
@@ -5,7 +5,7 @@
#pragma once
-#include <armnn/profiling/ITimelineDecoder.hpp>
+#include <server/include/timelineDecoder/ITimelineDecoder.hpp>
#include <Filesystem.hpp>
#include <map>
@@ -15,7 +15,7 @@ namespace armnn
{
namespace timelinedecoder
{
-class JSONTimelineDecoder : public ITimelineDecoder
+class JSONTimelineDecoder : public arm::pipe::ITimelineDecoder
{
public:
struct JSONEntity
diff --git a/src/timelineDecoder/TimelineCaptureCommandHandler.cpp b/src/timelineDecoder/TimelineCaptureCommandHandler.cpp
deleted file mode 100644
index 39a806ce87..0000000000
--- a/src/timelineDecoder/TimelineCaptureCommandHandler.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "TimelineCaptureCommandHandler.hpp"
-
-#include <string>
-#include <armnn/Logging.hpp>
-namespace armnn
-{
-
-namespace timelinedecoder
-{
-
-//Array of member functions, the array index matches the decl_id
-const TimelineCaptureCommandHandler::ReadFunction TimelineCaptureCommandHandler::m_ReadFunctions[]
-{
- &TimelineCaptureCommandHandler::ReadLabel, // Label decl_id = 0
- &TimelineCaptureCommandHandler::ReadEntity, // Entity decl_id = 1
- &TimelineCaptureCommandHandler::ReadEventClass, // EventClass decl_id = 2
- &TimelineCaptureCommandHandler::ReadRelationship, // Relationship decl_id = 3
- &TimelineCaptureCommandHandler::ReadEvent // Event decl_id = 4
-};
-
-void TimelineCaptureCommandHandler::SetThreadIdSize(uint32_t size)
-{
- m_ThreadIdSize = size;
-}
-
-void TimelineCaptureCommandHandler::operator()(const profiling::Packet& packet)
-{
- ParseData(packet);
-}
-
-void TimelineCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
-{
- uint32_t offset = 0;
- m_PacketLength = packet.GetLength();
-
- // We are expecting TimelineDirectoryCaptureCommandHandler to set the thread id size
- // if it not set in the constructor
- if (m_ThreadIdSize == 0)
- {
- ARMNN_LOG(error) << "TimelineCaptureCommandHandler: m_ThreadIdSize has not been set";
- return;
- }
-
- if (packet.GetLength() < 8)
- {
- return;
- }
-
- const unsigned char* data = reinterpret_cast<const unsigned char*>(packet.GetData());
-
- uint32_t declId = 0;
-
- while ( offset < m_PacketLength )
- {
- declId = profiling::ReadUint32(data, offset);
- offset += uint32_t_size;
-
- ITimelineDecoder::TimelineStatus status = (this->*m_ReadFunctions[declId])(data, offset);
- if (status == ITimelineDecoder::TimelineStatus::TimelineStatus_Fail)
- {
- ARMNN_LOG(error) << "Decode of timeline message type [" << declId <<
- "] at offset [" << offset << "] failed";
- break;
- }
- }
-}
-
-ITimelineDecoder::TimelineStatus TimelineCaptureCommandHandler::ReadLabel(const unsigned char* data, uint32_t& offset)
-{
- ITimelineDecoder::Label label;
- label.m_Guid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- uint32_t nameLength = profiling::ReadUint32(data, offset);
- offset += uint32_t_size;
-
- uint32_t i = 0;
- // nameLength - 1 to account for null operator \0
- for ( i = 0; i < nameLength - 1; ++i )
- {
- label.m_Name += static_cast<char>(profiling::ReadUint8(data, offset + i));
- }
- // Shift offset past nameLength
- uint32_t uint32WordAmount = (nameLength / uint32_t_size) + (nameLength % uint32_t_size != 0 ? 1 : 0);
- offset += uint32WordAmount * uint32_t_size;
-
- return m_TimelineDecoder.CreateLabel(label);
-}
-
-ITimelineDecoder::TimelineStatus TimelineCaptureCommandHandler::ReadEntity(
- const unsigned char* data, uint32_t& offset)
-{
- ITimelineDecoder::Entity entity;
- entity.m_Guid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
- return m_TimelineDecoder.CreateEntity(entity);
-}
-
-ITimelineDecoder::TimelineStatus TimelineCaptureCommandHandler::ReadEventClass(
- const unsigned char* data, uint32_t& offset)
-{
- ITimelineDecoder::EventClass eventClass;
- eventClass.m_Guid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
- eventClass.m_NameGuid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
- return m_TimelineDecoder.CreateEventClass(eventClass);
-}
-
-ITimelineDecoder::TimelineStatus TimelineCaptureCommandHandler::ReadRelationship(
- const unsigned char* data, uint32_t& offset)
-{
- ITimelineDecoder::Relationship relationship;
- relationship.m_RelationshipType =
- static_cast<ITimelineDecoder::RelationshipType>(profiling::ReadUint32(data, offset));
- offset += uint32_t_size;
-
- relationship.m_Guid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- relationship.m_HeadGuid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- relationship.m_TailGuid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- relationship.m_AttributeGuid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- return m_TimelineDecoder.CreateRelationship(relationship);
-}
-
-ITimelineDecoder::TimelineStatus TimelineCaptureCommandHandler::ReadEvent(
- const unsigned char* data, uint32_t& offset)
-{
- ITimelineDecoder::Event event;
- event.m_TimeStamp = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- if ( m_ThreadIdSize == 4 )
- {
- event.m_ThreadId = profiling::ReadUint32(data, offset);
- }
- else if ( m_ThreadIdSize == 8 )
- {
- event.m_ThreadId = profiling::ReadUint64(data, offset);
- }
-
- offset += m_ThreadIdSize;
-
- event.m_Guid = profiling::ReadUint64(data, offset);
- offset += uint64_t_size;
-
- return m_TimelineDecoder.CreateEvent(event);
-}
-
-} //namespace gatordmock
-
-} //namespace armnn
diff --git a/src/timelineDecoder/TimelineCaptureCommandHandler.hpp b/src/timelineDecoder/TimelineCaptureCommandHandler.hpp
deleted file mode 100644
index 0431e9ca49..0000000000
--- a/src/timelineDecoder/TimelineCaptureCommandHandler.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include <armnn/profiling/ITimelineDecoder.hpp>
-
-#include <CommandHandlerFunctor.hpp>
-#include <Packet.hpp>
-#include <ProfilingUtils.hpp>
-
-namespace armnn
-{
-
-namespace timelinedecoder
-{
-
-class TimelineCaptureCommandHandler :
- public profiling::CommandHandlerFunctor
-{
- // Utils
- uint32_t uint32_t_size = sizeof(uint32_t);
- uint32_t uint64_t_size = sizeof(uint64_t);
-
- using ReadFunction = ITimelineDecoder::TimelineStatus (TimelineCaptureCommandHandler::*)(
- const unsigned char*, uint32_t&);
-
-public:
- TimelineCaptureCommandHandler(uint32_t familyId,
- uint32_t packetId,
- uint32_t version,
- ITimelineDecoder& timelineDecoder,
- uint32_t threadIdSize = 0)
- : CommandHandlerFunctor(familyId, packetId, version)
- , m_TimelineDecoder(timelineDecoder)
- , m_ThreadIdSize(threadIdSize)
- , m_PacketLength(0)
- {}
-
- void operator()(const armnn::profiling::Packet& packet) override;
-
-
- void SetThreadIdSize(uint32_t size);
-
-private:
- void ParseData(const armnn::profiling::Packet& packet);
-
- ITimelineDecoder::TimelineStatus ReadLabel(const unsigned char* data, uint32_t& offset);
- ITimelineDecoder::TimelineStatus ReadEntity(const unsigned char* data, uint32_t& offset);
- ITimelineDecoder::TimelineStatus ReadEventClass(const unsigned char* data, uint32_t& offset);
- ITimelineDecoder::TimelineStatus ReadRelationship(const unsigned char* data, uint32_t& offset);
- ITimelineDecoder::TimelineStatus ReadEvent(const unsigned char* data, uint32_t& offset);
-
- ITimelineDecoder& m_TimelineDecoder;
- uint32_t m_ThreadIdSize;
- unsigned int m_PacketLength;
- static const ReadFunction m_ReadFunctions[];
-
-};
-
-} //namespace gatordmock
-
-} //namespace armnn
diff --git a/src/timelineDecoder/TimelineDecoder.cpp b/src/timelineDecoder/TimelineDecoder.cpp
deleted file mode 100644
index 9aa84d2084..0000000000
--- a/src/timelineDecoder/TimelineDecoder.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "TimelineDecoder.hpp"
-#include <ProfilingUtils.hpp>
-#include <iostream>
-
-namespace armnn
-{
-namespace timelinedecoder
-{
-
-TimelineDecoder::TimelineStatus TimelineDecoder::CreateEntity(const Entity &entity)
-{
- if (m_OnNewEntityCallback == nullptr)
- {
- return TimelineStatus::TimelineStatus_Fail;
- }
- m_OnNewEntityCallback(m_Model, entity);
-
- return TimelineStatus::TimelineStatus_Success;
-}
-
-TimelineDecoder::TimelineStatus TimelineDecoder::CreateEventClass(const EventClass &eventClass)
-{
- if (m_OnNewEventClassCallback == nullptr)
- {
- return TimelineStatus::TimelineStatus_Fail;
- }
- m_OnNewEventClassCallback(m_Model, eventClass);
-
- return TimelineStatus::TimelineStatus_Success;
-}
-
-TimelineDecoder::TimelineStatus TimelineDecoder::CreateEvent(const Event &event)
-{
- if (m_OnNewEventCallback == nullptr)
- {
- return TimelineStatus::TimelineStatus_Fail;
- }
- m_OnNewEventCallback(m_Model, event);
-
- return TimelineStatus::TimelineStatus_Success;
-}
-
-TimelineDecoder::TimelineStatus TimelineDecoder::CreateLabel(const Label &label)
-{
- if (m_OnNewLabelCallback == nullptr)
- {
- return TimelineStatus::TimelineStatus_Fail;
- }
- m_OnNewLabelCallback(m_Model, label);
-
- return TimelineStatus::TimelineStatus_Success;
-}
-
-TimelineDecoder::TimelineStatus TimelineDecoder::CreateRelationship(const Relationship &relationship)
-{
- if (m_OnNewRelationshipCallback == nullptr)
- {
- return TimelineStatus::TimelineStatus_Fail;
- }
- m_OnNewRelationshipCallback(m_Model, relationship);
- return TimelineStatus::TimelineStatus_Success;
-}
-
-const TimelineDecoder::Model &TimelineDecoder::GetModel()
-{
- return m_Model;
-}
-
-TimelineDecoder::TimelineStatus TimelineDecoder::SetEntityCallback(OnNewEntityCallback cb)
-{
- if (cb == nullptr)
- {
- return TimelineStatus::TimelineStatus_Fail;
- }
- m_OnNewEntityCallback = cb;
- return TimelineStatus::TimelineStatus_Success;
-}
-
-TimelineDecoder::TimelineStatus TimelineDecoder::SetEventClassCallback(OnNewEventClassCallback cb)
-{
- if (cb == nullptr)
- {
- return TimelineStatus::TimelineStatus_Fail;
- }
- m_OnNewEventClassCallback = cb;
- return TimelineStatus::TimelineStatus_Success;
-}
-
-TimelineDecoder::TimelineStatus TimelineDecoder::SetEventCallback(OnNewEventCallback cb)
-{
- if (cb == nullptr)
- {
- return TimelineStatus::TimelineStatus_Fail;
- }
- m_OnNewEventCallback = cb;
- return TimelineStatus::TimelineStatus_Success;
-}
-
-TimelineDecoder::TimelineStatus TimelineDecoder::SetLabelCallback(OnNewLabelCallback cb)
-{
- if (cb == nullptr)
- {
- return TimelineStatus::TimelineStatus_Fail;
- }
- m_OnNewLabelCallback = cb;
- return TimelineStatus::TimelineStatus_Success;
-}
-
-TimelineDecoder::TimelineStatus TimelineDecoder::SetRelationshipCallback(OnNewRelationshipCallback cb)
-{
- if (cb == nullptr)
- {
- return TimelineStatus::TimelineStatus_Fail;
- }
- m_OnNewRelationshipCallback = cb;
- return TimelineStatus::TimelineStatus_Success;
-}
-
-void TimelineDecoder::SetDefaultCallbacks()
-{
- SetEntityCallback([](Model& model, const ITimelineDecoder::Entity entity)
- {
- model.m_Entities.emplace_back(entity);
- });
-
- SetEventClassCallback([](Model& model, const ITimelineDecoder::EventClass eventClass)
- {
- model.m_EventClasses.emplace_back(eventClass);
- });
-
- SetEventCallback([](Model& model, const ITimelineDecoder::Event event)
- {
- model.m_Events.emplace_back(event);
- });
-
- SetLabelCallback([](Model& model, const ITimelineDecoder::Label label)
- {
- model.m_Labels.emplace_back(label);
- });
-
- SetRelationshipCallback([](Model& model, const ITimelineDecoder::Relationship relationship)
- {
- model.m_Relationships.emplace_back(relationship);
- });
-}
-
-void TimelineDecoder::print()
-{
- if (m_Model.m_Labels.empty() && m_Model.m_Entities.empty() && m_Model.m_EventClasses.empty() &&
- m_Model.m_Events.empty() && m_Model.m_Relationships.empty())
- {
- std::cout << "No timeline packets received" << std::endl;
- return;
- }
-
- printLabels();
- printEntities();
- printEventClasses();
- printEvents();
- printRelationships();
-}
-
-void TimelineDecoder::printLabels()
-{
- std::string header;
-
- header.append(profiling::CentreAlignFormatting("guid", 12));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("value", 30));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("LABELS", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
-
- for (uint32_t i = 0; i < m_Model.m_Labels.size(); ++i)
- {
- std::string body;
-
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Labels[i].m_Guid), 12));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(m_Model.m_Labels[i].m_Name, 30));
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout << body;
- }
-}
-
-void TimelineDecoder::printEntities()
-{
- std::string header;
- header.append(profiling::CentreAlignFormatting("guid", 12));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("ENTITIES", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
-
- for (uint32_t i = 0; i < m_Model.m_Entities.size(); ++i)
- {
- std::string body;
-
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Entities[i].m_Guid), 12));
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout << body;
- }
-}
-
-void TimelineDecoder::printEventClasses()
-{
- std::string header;
- header.append(profiling::CentreAlignFormatting("guid", 12));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("EVENT CLASSES", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
-
- for (uint32_t i = 0; i < m_Model.m_EventClasses.size(); ++i)
- {
- std::string body;
-
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_EventClasses[i].m_Guid), 12));
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout << body;
- }
-}
-
-void TimelineDecoder::printEvents()
-{
- std::string header;
-
- header.append(profiling::CentreAlignFormatting("timestamp", 12));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("threadId", 12));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("eventGuid", 12));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("EVENTS", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
-
- for (uint32_t i = 0; i < m_Model.m_Events.size(); ++i)
- {
- std::string body;
-
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Events[i].m_TimeStamp), 12));
- body.append(" | ");
-
- std::stringstream ss;
- ss << m_Model.m_Events[i].m_ThreadId;
- std::string threadId = ss.str();;
-
- body.append(profiling::CentreAlignFormatting(threadId, 12));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Events[i].m_Guid), 12));
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout << body;
- }
-}
-
-void TimelineDecoder::printRelationships()
-{
- std::string header;
- header.append(profiling::CentreAlignFormatting("relationshipType", 20));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("relationshipGuid", 20));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("headGuid", 12));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("tailGuid", 12));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("RELATIONSHIPS", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
- std::cout << header;
-
- for (uint32_t i = 0; i < m_Model.m_Relationships.size(); ++i)
- {
- std::string body;
-
- body.append(
- profiling::CentreAlignFormatting(std::to_string(static_cast<unsigned int>
- (m_Model.m_Relationships[i].m_RelationshipType)),
- 20));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Relationships[i].m_Guid), 20));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Relationships[i].m_HeadGuid), 12));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(std::to_string(m_Model.m_Relationships[i].m_TailGuid), 12));
- body.append(" | ");
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
- std::cout << body;
- }
-}
-}
-} \ No newline at end of file
diff --git a/src/timelineDecoder/TimelineDecoder.hpp b/src/timelineDecoder/TimelineDecoder.hpp
deleted file mode 100644
index 2efdc4483b..0000000000
--- a/src/timelineDecoder/TimelineDecoder.hpp
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Copyright © 2020 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-#pragma once
-
-#include <armnn/profiling/ITimelineDecoder.hpp>
-
-#include <vector>
-
-namespace armnn
-{
-namespace timelinedecoder
-{
-class TimelineDecoder : public ITimelineDecoder
-{
-
-public:
-
- struct Model
- {
- std::vector<Entity> m_Entities;
- std::vector<EventClass> m_EventClasses;
- std::vector<Event> m_Events;
- std::vector<Label> m_Labels;
- std::vector<Relationship> m_Relationships;
- };
-
- using OnNewEntityCallback = void (*)(Model &, const Entity);
- using OnNewEventClassCallback = void (*)(Model &, const EventClass);
- using OnNewEventCallback = void (*)(Model &, const Event);
- using OnNewLabelCallback = void (*)(Model &, const Label);
- using OnNewRelationshipCallback = void (*)(Model &, const Relationship);
-
- virtual TimelineStatus CreateEntity(const Entity &) override;
- virtual TimelineStatus CreateEventClass(const EventClass &) override;
- virtual TimelineStatus CreateEvent(const Event &) override;
- virtual TimelineStatus CreateLabel(const Label &) override;
- virtual TimelineStatus CreateRelationship(const Relationship &) override;
-
- const Model& GetModel();
-
- TimelineStatus SetEntityCallback(const OnNewEntityCallback);
- TimelineStatus SetEventClassCallback(const OnNewEventClassCallback);
- TimelineStatus SetEventCallback(const OnNewEventCallback);
- TimelineStatus SetLabelCallback(const OnNewLabelCallback);
- TimelineStatus SetRelationshipCallback(const OnNewRelationshipCallback);
-
- void SetDefaultCallbacks();
-
- void print();
-
-private:
- Model m_Model;
-
- OnNewEntityCallback m_OnNewEntityCallback;
- OnNewEventClassCallback m_OnNewEventClassCallback;
- OnNewEventCallback m_OnNewEventCallback;
- OnNewLabelCallback m_OnNewLabelCallback;
- OnNewRelationshipCallback m_OnNewRelationshipCallback;
-
- void printLabels();
- void printEntities();
- void printEventClasses();
- void printRelationships();
- void printEvents();
-};
-
-}
-} \ No newline at end of file
diff --git a/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp b/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
deleted file mode 100644
index 5aac77c86a..0000000000
--- a/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include "TimelineDirectoryCaptureCommandHandler.hpp"
-#include "TimelineCaptureCommandHandler.hpp"
-
-#include <iostream>
-#include <string>
-
-using namespace armnn::profiling;
-
-namespace armnn
-{
-
-namespace timelinedecoder
-{
-
-void TimelineDirectoryCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet)
-{
- uint32_t offset = 0;
-
- if (packet.GetLength() < 8)
- {
- return;
- }
-
- const unsigned char* data = packet.GetData();
-
- m_SwTraceHeader.m_StreamVersion = ReadUint8(data, offset);
- offset += uint8_t_size;
- m_SwTraceHeader.m_PointerBytes = ReadUint8(data, offset);
- offset += uint8_t_size;
- m_SwTraceHeader.m_ThreadIdBytes = ReadUint8(data, offset);
- offset += uint8_t_size;
-
- uint32_t numberOfDeclarations = profiling::ReadUint32(data, offset);
- offset += uint32_t_size;
-
- for (uint32_t declaration = 0; declaration < numberOfDeclarations; ++declaration)
- {
- m_SwTraceMessages.push_back(profiling::ReadSwTraceMessage(data, offset, packet.GetLength()));
- }
-
- m_TimelineCaptureCommandHandler.SetThreadIdSize(m_SwTraceHeader.m_ThreadIdBytes);
-}
-
-void TimelineDirectoryCaptureCommandHandler::Print()
-{
- std::string header;
-
- header.append(profiling::CentreAlignFormatting("decl_id", 12));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("decl_name", 20));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("ui_name", 20));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("arg_types", 16));
- header.append(" | ");
- header.append(profiling::CentreAlignFormatting("arg_names", 80));
- header.append("\n");
-
- std::cout << "\n" << "\n";
- std::cout << profiling::CentreAlignFormatting("SW DIRECTORY", static_cast<int>(header.size()));
- std::cout << "\n";
- std::cout << std::string(header.size(), '=') << "\n";
-
- std::cout << header;
-
- for (const auto& swTraceMessage : m_SwTraceMessages)
- {
- std::string body;
-
- body.append(profiling::CentreAlignFormatting(std::to_string(swTraceMessage.m_Id), 12));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(swTraceMessage.m_Name, 20));
- body.append(" | ");
- body.append(profiling::CentreAlignFormatting(swTraceMessage.m_UiName, 20));
- body.append(" | ");
-
- std::string argTypes;
- for (auto argType: swTraceMessage.m_ArgTypes)
- {
- argTypes += argType;
- argTypes += " ";
- }
- body.append(profiling::CentreAlignFormatting(argTypes, 16));
- body.append(" | ");
-
- std::string argNames;
- for (auto argName: swTraceMessage.m_ArgNames)
- {
- argNames += argName + " ";
- }
- body.append(profiling::CentreAlignFormatting(argNames, 80));
-
- body.append("\n");
-
- std::cout << std::string(body.size(), '-') << "\n";
-
- std::cout << body;
- }
-}
-
-void TimelineDirectoryCaptureCommandHandler::operator()(const profiling::Packet& packet)
-{
- ParseData(packet);
-
- if (!m_QuietOperation)
- {
- Print();
- }
-}
-
-} //namespace gatordmock
-
-} //namespace armnn
diff --git a/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp b/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp
deleted file mode 100644
index 2879052340..0000000000
--- a/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#pragma once
-
-#include "TimelineCaptureCommandHandler.hpp"
-
-#include <Packet.hpp>
-#include <PacketBuffer.hpp>
-#include <ProfilingUtils.hpp>
-
-namespace armnn
-{
-
-namespace timelinedecoder
-{
-
-class TimelineDirectoryCaptureCommandHandler : public profiling::CommandHandlerFunctor
-{
- // Utils
- uint32_t uint8_t_size = sizeof(uint8_t);
- uint32_t uint32_t_size = sizeof(uint32_t);
-
-public:
- TimelineDirectoryCaptureCommandHandler(uint32_t familyId,
- uint32_t packetId,
- uint32_t version,
- TimelineCaptureCommandHandler& timelineCaptureCommandHandler,
- bool quietOperation = false)
- : CommandHandlerFunctor(familyId, packetId, version)
- , m_TimelineCaptureCommandHandler(timelineCaptureCommandHandler)
- , m_QuietOperation(quietOperation)
- {}
-
- void operator()(const armnn::profiling::Packet& packet) override;
-
- profiling::SwTraceHeader m_SwTraceHeader;
- std::vector<profiling::SwTraceMessage> m_SwTraceMessages;
-
-private:
- void ParseData(const armnn::profiling::Packet& packet);
- void Print();
-
- TimelineCaptureCommandHandler& m_TimelineCaptureCommandHandler;
- bool m_QuietOperation;
-};
-
-} //namespace gatordmock
-
-} //namespace armnn
diff --git a/src/timelineDecoder/tests/JSONTimelineDecoderTests.cpp b/src/timelineDecoder/tests/JSONTimelineDecoderTests.cpp
index 3961f9bfb5..dfe5fd0609 100644
--- a/src/timelineDecoder/tests/JSONTimelineDecoderTests.cpp
+++ b/src/timelineDecoder/tests/JSONTimelineDecoderTests.cpp
@@ -4,8 +4,8 @@
//
#include <JSONTimelineDecoder.hpp>
-#include <TimelineCaptureCommandHandler.hpp>
-#include <TimelineDecoder.hpp>
+#include <server/include/timelineDecoder/TimelineCaptureCommandHandler.hpp>
+#include <server/include/timelineDecoder/TimelineDecoder.hpp>
#include <Filesystem.hpp>
#include <boost/test/test_tools.hpp>
@@ -23,661 +23,661 @@ void RunSimpleModelThroughDecoder(JSONTimelineDecoder& timelineDecoder)
/*
* Building Simple model structure to test
*/
- ITimelineDecoder::Label name;
+ arm::pipe::ITimelineDecoder::Label name;
name.m_Guid = uint64_t(10420554295983197538U);
name.m_Name = "name";
timelineDecoder.CreateLabel(name);
- ITimelineDecoder::Label type;
+ arm::pipe::ITimelineDecoder::Label type;
type.m_Guid = uint64_t(14196220359693045352U);
type.m_Name = "type";
timelineDecoder.CreateLabel(type);
- ITimelineDecoder::Label index;
+ arm::pipe::ITimelineDecoder::Label index;
index.m_Guid = uint64_t(13922236767355949814U);
index.m_Name = "index";
timelineDecoder.CreateLabel(index);
- ITimelineDecoder::Label backendId;
+ arm::pipe::ITimelineDecoder::Label backendId;
backendId.m_Guid = uint64_t(10874037804557439415U);
backendId.m_Name = "backendId";
timelineDecoder.CreateLabel(backendId);
- ITimelineDecoder::Label layer;
+ arm::pipe::ITimelineDecoder::Label layer;
layer.m_Guid = uint64_t(14761340794127440397U);
layer.m_Name = "layer";
timelineDecoder.CreateLabel(layer);
- ITimelineDecoder::Label workload;
+ arm::pipe::ITimelineDecoder::Label workload;
workload.m_Guid = uint64_t(15704252740552608110U);
workload.m_Name = "workload";
timelineDecoder.CreateLabel(workload);
- ITimelineDecoder::Label network;
+ arm::pipe::ITimelineDecoder::Label network;
network.m_Guid = uint64_t(16862199137063532871U);
network.m_Name = "network";
timelineDecoder.CreateLabel(network);
- ITimelineDecoder::Label connection;
+ arm::pipe::ITimelineDecoder::Label connection;
connection.m_Guid = uint64_t(15733717748792475675U);
connection.m_Name = "connection";
timelineDecoder.CreateLabel(connection);
- ITimelineDecoder::Label inference;
+ arm::pipe::ITimelineDecoder::Label inference;
inference.m_Guid = uint64_t(15026600058430441282U);
inference.m_Name = "inference";
timelineDecoder.CreateLabel(inference);
- ITimelineDecoder::Label workload_execution;
+ arm::pipe::ITimelineDecoder::Label workload_execution;
workload_execution.m_Guid = uint64_t(10172155312650606003U);
workload_execution.m_Name = "workload_execution";
timelineDecoder.CreateLabel(workload_execution);
- ITimelineDecoder::EventClass eventClass1;
+ arm::pipe::ITimelineDecoder::EventClass eventClass1;
eventClass1.m_Guid = uint64_t(17170418158534996719U);
timelineDecoder.CreateEventClass(eventClass1);
- ITimelineDecoder::EventClass eventClass2;
+ arm::pipe::ITimelineDecoder::EventClass eventClass2;
eventClass2.m_Guid = uint64_t(10812061579584851344U);
timelineDecoder.CreateEventClass(eventClass2);
- ITimelineDecoder::Entity entity6;
+ arm::pipe::ITimelineDecoder::Entity entity6;
entity6.m_Guid = uint64_t(6);
timelineDecoder.CreateEntity(entity6);
- ITimelineDecoder::Relationship relationship7;
+ arm::pipe::ITimelineDecoder::Relationship relationship7;
relationship7.m_Guid = uint64_t(7);
- relationship7.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship7.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship7.m_HeadGuid = uint64_t(6);
relationship7.m_TailGuid = uint64_t(16862199137063532871U);
timelineDecoder.CreateRelationship(relationship7);
- ITimelineDecoder::Relationship relationship8;
+ arm::pipe::ITimelineDecoder::Relationship relationship8;
relationship8.m_Guid = uint64_t(8);
- relationship8.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship8.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship8.m_HeadGuid = uint64_t(7);
relationship8.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship8);
// Adding normalization layer
- ITimelineDecoder::Entity entity0;
+ arm::pipe::ITimelineDecoder::Entity entity0;
entity0.m_Guid = uint64_t(0);
timelineDecoder.CreateEntity(entity0);
- ITimelineDecoder::Label input;
+ arm::pipe::ITimelineDecoder::Label input;
input.m_Guid = uint64_t(18179123836411086572U);
input.m_Name = "input";
timelineDecoder.CreateLabel(input);
- ITimelineDecoder::Relationship relationship9;
+ arm::pipe::ITimelineDecoder::Relationship relationship9;
relationship9.m_Guid = uint64_t(9);
- relationship9.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship9.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship9.m_HeadGuid = uint64_t(0);
relationship9.m_TailGuid = uint64_t(18179123836411086572U);
timelineDecoder.CreateRelationship(relationship9);
- ITimelineDecoder::Relationship relationship10;
+ arm::pipe::ITimelineDecoder::Relationship relationship10;
relationship10.m_Guid = uint64_t(10);
- relationship10.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship10.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship10.m_HeadGuid = uint64_t(9);
relationship10.m_TailGuid = uint64_t(10420554295983197538U);
timelineDecoder.CreateRelationship(relationship10);
- ITimelineDecoder::Relationship relationship11;
+ arm::pipe::ITimelineDecoder::Relationship relationship11;
relationship11.m_Guid = uint64_t(11);
- relationship11.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship11.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship11.m_HeadGuid = uint64_t(0);
relationship11.m_TailGuid = uint64_t(14761340794127440397U);
timelineDecoder.CreateRelationship(relationship11);
- ITimelineDecoder::Relationship relationship12;
+ arm::pipe::ITimelineDecoder::Relationship relationship12;
relationship12.m_Guid = uint64_t(12);
- relationship12.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship12.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship12.m_HeadGuid = uint64_t(11);
relationship12.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship12);
- ITimelineDecoder::Relationship relationship13;
+ arm::pipe::ITimelineDecoder::Relationship relationship13;
relationship13.m_Guid = uint64_t(13);
- relationship13.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship13.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship13.m_HeadGuid = uint64_t(6);
relationship13.m_TailGuid = uint64_t(0);
timelineDecoder.CreateRelationship(relationship13);
// Adding normalization layer
- ITimelineDecoder::Entity entity1;
+ arm::pipe::ITimelineDecoder::Entity entity1;
entity1.m_Guid = uint64_t(1);
timelineDecoder.CreateEntity(entity1);
- ITimelineDecoder::Label normalization;
+ arm::pipe::ITimelineDecoder::Label normalization;
normalization.m_Guid = uint64_t(15955949569988957863U);
normalization.m_Name = "normalization";
timelineDecoder.CreateLabel(normalization);
- ITimelineDecoder::Relationship relationship14;
+ arm::pipe::ITimelineDecoder::Relationship relationship14;
relationship14.m_Guid = uint64_t(14);
- relationship14.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship14.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship14.m_HeadGuid = uint64_t(1);
relationship14.m_TailGuid = uint64_t(15955949569988957863U);
timelineDecoder.CreateRelationship(relationship14);
- ITimelineDecoder::Relationship relationship15;
+ arm::pipe::ITimelineDecoder::Relationship relationship15;
relationship15.m_Guid = uint64_t(15);
- relationship15.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship15.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship15.m_HeadGuid = uint64_t(14);
relationship15.m_TailGuid = uint64_t(10420554295983197538U);
timelineDecoder.CreateRelationship(relationship15);
- ITimelineDecoder::Relationship relationship16;
+ arm::pipe::ITimelineDecoder::Relationship relationship16;
relationship16.m_Guid = uint64_t(16);
- relationship16.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship16.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship16.m_HeadGuid = uint64_t(1);
relationship16.m_TailGuid = uint64_t(14761340794127440397U);
timelineDecoder.CreateRelationship(relationship16);
- ITimelineDecoder::Relationship relationship17;
+ arm::pipe::ITimelineDecoder::Relationship relationship17;
relationship17.m_Guid = uint64_t(17);
- relationship17.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship17.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship17.m_HeadGuid = uint64_t(16);
relationship17.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship17);
- ITimelineDecoder::Relationship relationship18;
+ arm::pipe::ITimelineDecoder::Relationship relationship18;
relationship18.m_Guid = uint64_t(18);
- relationship18.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship18.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship18.m_HeadGuid = uint64_t(6);
relationship18.m_TailGuid = uint64_t(1);
timelineDecoder.CreateRelationship(relationship18);
- ITimelineDecoder::Relationship relationship19;
+ arm::pipe::ITimelineDecoder::Relationship relationship19;
relationship19.m_Guid = uint64_t(19);
- relationship19.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship19.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship19.m_HeadGuid = uint64_t(0);
relationship19.m_TailGuid = uint64_t(1);
timelineDecoder.CreateRelationship(relationship19);
- ITimelineDecoder::Relationship relationship20;
+ arm::pipe::ITimelineDecoder::Relationship relationship20;
relationship20.m_Guid = uint64_t(20);
- relationship20.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship20.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship20.m_HeadGuid = uint64_t(19);
relationship20.m_TailGuid = uint64_t(15733717748792475675U);
timelineDecoder.CreateRelationship(relationship20);
- ITimelineDecoder::Relationship relationship21;
+ arm::pipe::ITimelineDecoder::Relationship relationship21;
relationship21.m_Guid = uint64_t(21);
- relationship21.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship21.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship21.m_HeadGuid = uint64_t(20);
relationship21.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship21);
- ITimelineDecoder::Entity entity22;
+ arm::pipe::ITimelineDecoder::Entity entity22;
entity22.m_Guid = uint64_t(22);
timelineDecoder.CreateEntity(entity22);
- ITimelineDecoder::Relationship relationship23;
+ arm::pipe::ITimelineDecoder::Relationship relationship23;
relationship23.m_Guid = uint64_t(23);
- relationship23.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship23.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship23.m_HeadGuid = uint64_t(22);
relationship23.m_TailGuid = uint64_t(15704252740552608110U);
timelineDecoder.CreateRelationship(relationship23);
- ITimelineDecoder::Relationship relationship24;
+ arm::pipe::ITimelineDecoder::Relationship relationship24;
relationship24.m_Guid = uint64_t(24);
- relationship24.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship24.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship24.m_HeadGuid = uint64_t(23);
relationship24.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship24);
- ITimelineDecoder::Label CpuRef;
+ arm::pipe::ITimelineDecoder::Label CpuRef;
CpuRef.m_Guid = uint64_t(9690680943817437852U);
CpuRef.m_Name = "CpuRef";
timelineDecoder.CreateLabel(CpuRef);
- ITimelineDecoder::Relationship relationship25;
+ arm::pipe::ITimelineDecoder::Relationship relationship25;
relationship25.m_Guid = uint64_t(25);
- relationship25.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship25.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship25.m_HeadGuid = uint64_t(22);
relationship25.m_TailGuid = uint64_t(9690680943817437852U);
timelineDecoder.CreateRelationship(relationship25);
- ITimelineDecoder::Relationship relationship26;
+ arm::pipe::ITimelineDecoder::Relationship relationship26;
relationship26.m_Guid = uint64_t(26);
- relationship26.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship26.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship26.m_HeadGuid = uint64_t(25);
relationship26.m_TailGuid = uint64_t(10874037804557439415U);
timelineDecoder.CreateRelationship(relationship26);
- ITimelineDecoder::Relationship relationship27;
+ arm::pipe::ITimelineDecoder::Relationship relationship27;
relationship27.m_Guid = uint64_t(27);
- relationship27.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink ;
+ relationship27.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink ;
relationship27.m_HeadGuid = uint64_t(1);
relationship27.m_TailGuid = uint64_t(22);
timelineDecoder.CreateRelationship(relationship27);
// Adding output layer
- ITimelineDecoder::Entity entity2;
+ arm::pipe::ITimelineDecoder::Entity entity2;
entity2.m_Guid = uint64_t(2);
timelineDecoder.CreateEntity(entity2);
- ITimelineDecoder::Label output;
+ arm::pipe::ITimelineDecoder::Label output;
output.m_Guid = uint64_t(18419179028513879730U);
output.m_Name = "output";
timelineDecoder.CreateLabel(output);
- ITimelineDecoder::Relationship relationship28;
+ arm::pipe::ITimelineDecoder::Relationship relationship28;
relationship28.m_Guid = uint64_t(28);
- relationship28.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship28.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship28.m_HeadGuid = uint64_t(2);
relationship28.m_TailGuid = uint64_t(18419179028513879730U);
timelineDecoder.CreateRelationship(relationship28);
- ITimelineDecoder::Relationship relationship29;
+ arm::pipe::ITimelineDecoder::Relationship relationship29;
relationship29.m_Guid = uint64_t(29);
- relationship29.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship29.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship29.m_HeadGuid = uint64_t(28);
relationship29.m_TailGuid = uint64_t(10420554295983197538U);
timelineDecoder.CreateRelationship(relationship29);
- ITimelineDecoder::Relationship relationship30;
+ arm::pipe::ITimelineDecoder::Relationship relationship30;
relationship30.m_Guid = uint64_t(30);
- relationship30.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship30.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship30.m_HeadGuid = uint64_t(2);
relationship30.m_TailGuid = uint64_t(14761340794127440397U);
timelineDecoder.CreateRelationship(relationship30);
- ITimelineDecoder::Relationship relationship31;
+ arm::pipe::ITimelineDecoder::Relationship relationship31;
relationship31.m_Guid = uint64_t(31);
- relationship31.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship31.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship31.m_HeadGuid = uint64_t(30);
relationship31.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship31);
- ITimelineDecoder::Relationship relationship32;
+ arm::pipe::ITimelineDecoder::Relationship relationship32;
relationship32.m_Guid = uint64_t(32);
- relationship32.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship32.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship32.m_HeadGuid = uint64_t(6);
relationship32.m_TailGuid = uint64_t(2);
timelineDecoder.CreateRelationship(relationship32);
- ITimelineDecoder::Relationship relationship33;
+ arm::pipe::ITimelineDecoder::Relationship relationship33;
relationship33.m_Guid = uint64_t(33);
- relationship33.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship33.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship33.m_HeadGuid = uint64_t(1);
relationship33.m_TailGuid = uint64_t(2);
timelineDecoder.CreateRelationship(relationship33);
- ITimelineDecoder::Relationship relationship34;
+ arm::pipe::ITimelineDecoder::Relationship relationship34;
relationship34.m_Guid = uint64_t(34);
- relationship34.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship34.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship34.m_HeadGuid = uint64_t(33);
relationship34.m_TailGuid = uint64_t(15733717748792475675U);
timelineDecoder.CreateRelationship(relationship34);
- ITimelineDecoder::Relationship relationship35;
+ arm::pipe::ITimelineDecoder::Relationship relationship35;
relationship35.m_Guid = uint64_t(35);
- relationship35.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship35.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship35.m_HeadGuid = uint64_t(34);
relationship35.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship35);
- ITimelineDecoder::Entity entity36;
+ arm::pipe::ITimelineDecoder::Entity entity36;
entity36.m_Guid = uint64_t(36);
timelineDecoder.CreateEntity(entity36);
- ITimelineDecoder::Relationship relationship37;
+ arm::pipe::ITimelineDecoder::Relationship relationship37;
relationship37.m_Guid = uint64_t(37);
- relationship37.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship37.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship37.m_HeadGuid = uint64_t(36);
relationship37.m_TailGuid = uint64_t(15704252740552608110U);
timelineDecoder.CreateRelationship(relationship37);
- ITimelineDecoder::Relationship relationship38;
+ arm::pipe::ITimelineDecoder::Relationship relationship38;
relationship38.m_Guid = uint64_t(38);
- relationship38.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship38.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship38.m_HeadGuid = uint64_t(37);
relationship38.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship38);
- ITimelineDecoder::Relationship relationship39;
+ arm::pipe::ITimelineDecoder::Relationship relationship39;
relationship39.m_Guid = uint64_t(39);
- relationship39.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship39.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship39.m_HeadGuid = uint64_t(36);
relationship39.m_TailGuid = uint64_t(9690680943817437852U);
timelineDecoder.CreateRelationship(relationship39);
- ITimelineDecoder::Relationship relationship40;
+ arm::pipe::ITimelineDecoder::Relationship relationship40;
relationship40.m_Guid = uint64_t(40);
- relationship40.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship40.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship40.m_HeadGuid = uint64_t(39);
relationship40.m_TailGuid = uint64_t(10874037804557439415U);
timelineDecoder.CreateRelationship(relationship40);
- ITimelineDecoder::Relationship relationship41;
+ arm::pipe::ITimelineDecoder::Relationship relationship41;
relationship41.m_Guid = uint64_t(41);
- relationship41.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship41.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship41.m_HeadGuid = uint64_t(0);
relationship41.m_TailGuid = uint64_t(36);
timelineDecoder.CreateRelationship(relationship41);
- ITimelineDecoder::Entity entity42;
+ arm::pipe::ITimelineDecoder::Entity entity42;
entity42.m_Guid = uint64_t(42);
timelineDecoder.CreateEntity(entity42);
- ITimelineDecoder::Relationship relationship43;
+ arm::pipe::ITimelineDecoder::Relationship relationship43;
relationship43.m_Guid = uint64_t(43);
- relationship43.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship43.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship43.m_HeadGuid = uint64_t(42);
relationship43.m_TailGuid = uint64_t(15704252740552608110U);
timelineDecoder.CreateRelationship(relationship43);
- ITimelineDecoder::Relationship relationship44;
+ arm::pipe::ITimelineDecoder::Relationship relationship44;
relationship44.m_Guid = uint64_t(44);
- relationship44.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship44.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship44.m_HeadGuid = uint64_t(43);
relationship44.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship44);
- ITimelineDecoder::Relationship relationship45;
+ arm::pipe::ITimelineDecoder::Relationship relationship45;
relationship45.m_Guid = uint64_t(45);
- relationship45.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship45.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship45.m_HeadGuid = uint64_t(42);
relationship45.m_TailGuid = uint64_t(9690680943817437852U);
timelineDecoder.CreateRelationship(relationship45);
- ITimelineDecoder::Relationship relationship46;
+ arm::pipe::ITimelineDecoder::Relationship relationship46;
relationship46.m_Guid = uint64_t(46);
- relationship46.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship46.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship46.m_HeadGuid = uint64_t(45);
relationship46.m_TailGuid = uint64_t(10874037804557439415U);
timelineDecoder.CreateRelationship(relationship46);
- ITimelineDecoder::Relationship relationship47;
+ arm::pipe::ITimelineDecoder::Relationship relationship47;
relationship47.m_Guid = uint64_t(47);
- relationship47.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship47.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship47.m_HeadGuid = uint64_t(2);
relationship47.m_TailGuid = uint64_t(42);
timelineDecoder.CreateRelationship(relationship47);
- ITimelineDecoder::Entity entity48;
+ arm::pipe::ITimelineDecoder::Entity entity48;
entity48.m_Guid = uint64_t(48);
timelineDecoder.CreateEntity(entity48);
- ITimelineDecoder::Relationship relationship49;
+ arm::pipe::ITimelineDecoder::Relationship relationship49;
relationship49.m_Guid = uint64_t(49);
- relationship49.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship49.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship49.m_HeadGuid = uint64_t(48);
relationship49.m_TailGuid = uint64_t(15026600058430441282U);
timelineDecoder.CreateRelationship(relationship49);
- ITimelineDecoder::Relationship relationship50;
+ arm::pipe::ITimelineDecoder::Relationship relationship50;
relationship50.m_Guid = uint64_t(50);
- relationship50.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship50.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship50.m_HeadGuid = uint64_t(49);
relationship50.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship50);
- ITimelineDecoder::Relationship relationship51;
+ arm::pipe::ITimelineDecoder::Relationship relationship51;
relationship51.m_Guid = uint64_t(51);
- relationship51.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship51.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship51.m_HeadGuid = uint64_t(6);
relationship51.m_TailGuid = uint64_t(48);
timelineDecoder.CreateRelationship(relationship51);
- ITimelineDecoder::Relationship relationship53;
+ arm::pipe::ITimelineDecoder::Relationship relationship53;
relationship53.m_Guid = uint64_t(53);
- relationship53.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship53.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship53.m_HeadGuid = uint64_t(48);
relationship53.m_TailGuid = uint64_t(52);
timelineDecoder.CreateRelationship(relationship53);
- ITimelineDecoder::Relationship relationship54;
+ arm::pipe::ITimelineDecoder::Relationship relationship54;
relationship54.m_Guid = uint64_t(54);
- relationship54.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship54.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship54.m_HeadGuid = uint64_t(52);
relationship54.m_TailGuid = uint64_t(17170418158534996719U);
timelineDecoder.CreateRelationship(relationship54);
- ITimelineDecoder::Entity entity55;
+ arm::pipe::ITimelineDecoder::Entity entity55;
entity55.m_Guid = uint64_t(55);
timelineDecoder.CreateEntity(entity55);
- ITimelineDecoder::Relationship relationship56;
+ arm::pipe::ITimelineDecoder::Relationship relationship56;
relationship56.m_Guid = uint64_t(56);
- relationship56.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship56.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship56.m_HeadGuid = uint64_t(55);
relationship56.m_TailGuid = uint64_t(10172155312650606003U);
timelineDecoder.CreateRelationship(relationship56);
- ITimelineDecoder::Relationship relationship57;
+ arm::pipe::ITimelineDecoder::Relationship relationship57;
relationship57.m_Guid = uint64_t(57);
- relationship57.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship57.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship57.m_HeadGuid = uint64_t(56);
relationship57.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship57);
- ITimelineDecoder::Relationship relationship58;
+ arm::pipe::ITimelineDecoder::Relationship relationship58;
relationship58.m_Guid = uint64_t(58);
- relationship58.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship58.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship58.m_HeadGuid = uint64_t(48);
relationship58.m_TailGuid = uint64_t(55);
timelineDecoder.CreateRelationship(relationship58);
- ITimelineDecoder::Relationship relationship59;
+ arm::pipe::ITimelineDecoder::Relationship relationship59;
relationship59.m_Guid = uint64_t(59);
- relationship59.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship59.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship59.m_HeadGuid = uint64_t(36);
relationship59.m_TailGuid = uint64_t(55);
timelineDecoder.CreateRelationship(relationship59);
- ITimelineDecoder::Event event60;
+ arm::pipe::ITimelineDecoder::Event event60;
event60.m_Guid = uint64_t(60);
event60.m_TimeStamp = uint64_t(96557081111036);
event60.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event60);
- ITimelineDecoder::Relationship relationship61;
+ arm::pipe::ITimelineDecoder::Relationship relationship61;
relationship61.m_Guid = uint64_t(61);
- relationship61.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship61.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship61.m_HeadGuid = uint64_t(55);
relationship61.m_TailGuid = uint64_t(60);
timelineDecoder.CreateRelationship(relationship61);
- ITimelineDecoder::Relationship relationship62;
+ arm::pipe::ITimelineDecoder::Relationship relationship62;
relationship62.m_Guid = uint64_t(62);
- relationship62.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship62.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship62.m_HeadGuid = uint64_t(60);
relationship62.m_TailGuid = uint64_t(17170418158534996719U);
timelineDecoder.CreateRelationship(relationship62);
- ITimelineDecoder::Event event63;
+ arm::pipe::ITimelineDecoder::Event event63;
event63.m_Guid = uint64_t(63);
event63.m_TimeStamp = uint64_t(96557081149730);
event63.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event63);
- ITimelineDecoder::Relationship relationship64;
+ arm::pipe::ITimelineDecoder::Relationship relationship64;
relationship64.m_Guid = uint64_t(61);
- relationship64.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship64.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship64.m_HeadGuid = uint64_t(55);
relationship64.m_TailGuid = uint64_t(63);
timelineDecoder.CreateRelationship(relationship64);
- ITimelineDecoder::Relationship relationship65;
+ arm::pipe::ITimelineDecoder::Relationship relationship65;
relationship65.m_Guid = uint64_t(62);
- relationship65.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship65.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship65.m_HeadGuid = uint64_t(63);
relationship65.m_TailGuid = uint64_t(10812061579584851344U);
timelineDecoder.CreateRelationship(relationship65);
- ITimelineDecoder::Entity entity66;
+ arm::pipe::ITimelineDecoder::Entity entity66;
entity66.m_Guid = uint64_t(66);
timelineDecoder.CreateEntity(entity66);
- ITimelineDecoder::Relationship relationship67;
+ arm::pipe::ITimelineDecoder::Relationship relationship67;
relationship67.m_Guid = uint64_t(67);
- relationship67.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship67.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship67.m_HeadGuid = uint64_t(66);
relationship67.m_TailGuid = uint64_t(10172155312650606003U);
timelineDecoder.CreateRelationship(relationship67);
- ITimelineDecoder::Relationship relationship68;
+ arm::pipe::ITimelineDecoder::Relationship relationship68;
relationship68.m_Guid = uint64_t(68);
- relationship68.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship68.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship68.m_HeadGuid = uint64_t(67);
relationship68.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship68);
- ITimelineDecoder::Relationship relationship69;
+ arm::pipe::ITimelineDecoder::Relationship relationship69;
relationship69.m_Guid = uint64_t(69);
- relationship69.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship69.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship69.m_HeadGuid = uint64_t(48);
relationship69.m_TailGuid = uint64_t(66);
timelineDecoder.CreateRelationship(relationship69);
- ITimelineDecoder::Relationship relationship70;
+ arm::pipe::ITimelineDecoder::Relationship relationship70;
relationship70.m_Guid = uint64_t(70);
- relationship70.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship70.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship70.m_HeadGuid = uint64_t(22);
relationship70.m_TailGuid = uint64_t(66);
timelineDecoder.CreateRelationship(relationship70);
- ITimelineDecoder::Event event71;
+ arm::pipe::ITimelineDecoder::Event event71;
event71.m_Guid = uint64_t(71);
event71.m_TimeStamp = uint64_t(96557081156464);
event71.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event71);
- ITimelineDecoder::Relationship relationship72;
+ arm::pipe::ITimelineDecoder::Relationship relationship72;
relationship72.m_Guid = uint64_t(72);
- relationship72.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship72.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship72.m_HeadGuid = uint64_t(66);
relationship72.m_TailGuid = uint64_t(71);
timelineDecoder.CreateRelationship(relationship72);
- ITimelineDecoder::Relationship relationship73;
+ arm::pipe::ITimelineDecoder::Relationship relationship73;
relationship73.m_Guid = uint64_t(73);
- relationship73.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship73.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship73.m_HeadGuid = uint64_t(71);
relationship73.m_TailGuid = uint64_t(17170418158534996719U);
timelineDecoder.CreateRelationship(relationship73);
- ITimelineDecoder::Event event74;
+ arm::pipe::ITimelineDecoder::Event event74;
event74.m_Guid = uint64_t(74);
event74.m_TimeStamp = uint64_t(96557081220825);
event74.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event74);
- ITimelineDecoder::Relationship relationship75;
+ arm::pipe::ITimelineDecoder::Relationship relationship75;
relationship75.m_Guid = uint64_t(75);
- relationship75.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship75.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship75.m_HeadGuid = uint64_t(66);
relationship75.m_TailGuid = uint64_t(74);
timelineDecoder.CreateRelationship(relationship75);
- ITimelineDecoder::Relationship relationship76;
+ arm::pipe::ITimelineDecoder::Relationship relationship76;
relationship76.m_Guid = uint64_t(76);
- relationship76.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship76.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship76.m_HeadGuid = uint64_t(74);
relationship76.m_TailGuid = uint64_t(10812061579584851344U);
timelineDecoder.CreateRelationship(relationship76);
- ITimelineDecoder::Entity entity77;
+ arm::pipe::ITimelineDecoder::Entity entity77;
entity77.m_Guid = uint64_t(77);
timelineDecoder.CreateEntity(entity77);
- ITimelineDecoder::Relationship relationship78;
+ arm::pipe::ITimelineDecoder::Relationship relationship78;
relationship78.m_Guid = uint64_t(78);
- relationship78.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship78.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship78.m_HeadGuid = uint64_t(77);
relationship78.m_TailGuid = uint64_t(10172155312650606003U);
timelineDecoder.CreateRelationship(relationship78);
- ITimelineDecoder::Relationship relationship79;
+ arm::pipe::ITimelineDecoder::Relationship relationship79;
relationship79.m_Guid = uint64_t(79);
- relationship79.m_RelationshipType = ITimelineDecoder::RelationshipType::LabelLink;
+ relationship79.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::LabelLink;
relationship79.m_HeadGuid = uint64_t(78);
relationship79.m_TailGuid = uint64_t(14196220359693045352U);
timelineDecoder.CreateRelationship(relationship79);
- ITimelineDecoder::Relationship relationship80;
+ arm::pipe::ITimelineDecoder::Relationship relationship80;
relationship80.m_Guid = uint64_t(80);
- relationship80.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship80.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship80.m_HeadGuid = uint64_t(48);
relationship80.m_TailGuid = uint64_t(77);
timelineDecoder.CreateRelationship(relationship80);
- ITimelineDecoder::Relationship relationship81;
+ arm::pipe::ITimelineDecoder::Relationship relationship81;
relationship81.m_Guid = uint64_t(81);
- relationship81.m_RelationshipType = ITimelineDecoder::RelationshipType::RetentionLink;
+ relationship81.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink;
relationship81.m_HeadGuid = uint64_t(42);
relationship81.m_TailGuid = uint64_t(77);
timelineDecoder.CreateRelationship(relationship81);
- ITimelineDecoder::Event event82;
+ arm::pipe::ITimelineDecoder::Event event82;
event82.m_Guid = uint64_t(82);
event82.m_TimeStamp = uint64_t(96557081227643);
event82.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event82);
- ITimelineDecoder::Relationship relationship83;
+ arm::pipe::ITimelineDecoder::Relationship relationship83;
relationship83.m_Guid = uint64_t(83);
- relationship83.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship83.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship83.m_HeadGuid = uint64_t(77);
relationship83.m_TailGuid = uint64_t(82);
timelineDecoder.CreateRelationship(relationship83);
- ITimelineDecoder::Relationship relationship84;
+ arm::pipe::ITimelineDecoder::Relationship relationship84;
relationship84.m_Guid = uint64_t(84);
- relationship84.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship84.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship84.m_HeadGuid = uint64_t(82);
relationship84.m_TailGuid = uint64_t(17170418158534996719U);
timelineDecoder.CreateRelationship(relationship84);
- ITimelineDecoder::Event event85;
+ arm::pipe::ITimelineDecoder::Event event85;
event85.m_Guid = uint64_t(85);
event85.m_TimeStamp = uint64_t(96557081240332);
event85.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event85);
- ITimelineDecoder::Relationship relationship86;
+ arm::pipe::ITimelineDecoder::Relationship relationship86;
relationship86.m_Guid = uint64_t(86);
- relationship86.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship86.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship86.m_HeadGuid = uint64_t(77);
relationship86.m_TailGuid = uint64_t(85);
timelineDecoder.CreateRelationship(relationship86);
- ITimelineDecoder::Relationship relationship87;
+ arm::pipe::ITimelineDecoder::Relationship relationship87;
relationship87.m_Guid = uint64_t(87);
- relationship87.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship87.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship87.m_HeadGuid = uint64_t(85);
relationship87.m_TailGuid = uint64_t(10812061579584851344U);
timelineDecoder.CreateRelationship(relationship87);
- ITimelineDecoder::Event event88;
+ arm::pipe::ITimelineDecoder::Event event88;
event88.m_Guid = uint64_t(88);
event88.m_TimeStamp = uint64_t(96557081243146);
event88.m_ThreadId = uint64_t(140522431862592);
timelineDecoder.CreateEvent(event88);
- ITimelineDecoder::Relationship relationship89;
+ arm::pipe::ITimelineDecoder::Relationship relationship89;
relationship89.m_Guid = uint64_t(89);
- relationship89.m_RelationshipType = ITimelineDecoder::RelationshipType::ExecutionLink;
+ relationship89.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::ExecutionLink;
relationship89.m_HeadGuid = uint64_t(48);
relationship89.m_TailGuid = uint64_t(88);
timelineDecoder.CreateRelationship(relationship89);
- ITimelineDecoder::Relationship relationship90;
+ arm::pipe::ITimelineDecoder::Relationship relationship90;
relationship90.m_Guid = uint64_t(90);
- relationship90.m_RelationshipType = ITimelineDecoder::RelationshipType::DataLink;
+ relationship90.m_RelationshipType = arm::pipe::ITimelineDecoder::RelationshipType::DataLink;
relationship90.m_HeadGuid = uint64_t(88);
relationship90.m_TailGuid = uint64_t(10812061579584851344U);
timelineDecoder.CreateRelationship(relationship90);
diff --git a/src/timelineDecoder/tests/TimelineTests.cpp b/src/timelineDecoder/tests/TimelineTests.cpp
deleted file mode 100644
index ceb955d131..0000000000
--- a/src/timelineDecoder/tests/TimelineTests.cpp
+++ /dev/null
@@ -1,369 +0,0 @@
-//
-// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
-// SPDX-License-Identifier: MIT
-//
-
-#include <TimelineCaptureCommandHandler.hpp>
-#include <TimelineDirectoryCaptureCommandHandler.hpp>
-#include <TimelineDecoder.hpp>
-
-#include <CommandHandlerFunctor.hpp>
-#include <Threads.hpp>
-#include <ProfilingService.hpp>
-#include <PacketBuffer.hpp>
-#include <TimelinePacketWriterFactory.hpp>
-
-#include <boost/test/test_tools.hpp>
-#include <boost/test/unit_test_suite.hpp>
-
-BOOST_AUTO_TEST_SUITE(TimelineDecoderTests)
-
-using namespace armnn;
-using namespace timelinedecoder;
-
-void SendTimelinePacketToCommandHandler(const unsigned char* packetBuffer,
- profiling::CommandHandlerFunctor &CommandHandler)
-{
- uint32_t uint32_t_size = sizeof(uint32_t);
- unsigned int offset = 0;
-
- uint32_t header[2];
- header[0] = profiling::ReadUint32(packetBuffer, offset);
- offset += uint32_t_size;
- header[1] = profiling::ReadUint32(packetBuffer, offset);
- offset += uint32_t_size;
- uint32_t PacketDataLength = header[1] & 0x00FFFFFF;
-
- auto uniquePacketData = std::make_unique<unsigned char[]>(PacketDataLength);
- std::memcpy(uniquePacketData.get(), packetBuffer + offset, PacketDataLength);
-
- armnn::profiling::Packet packet(header[0], PacketDataLength, uniquePacketData);
-
- BOOST_CHECK(std::memcmp(packetBuffer + offset, packet.GetData(), packet.GetLength()) == 0);
-
- CommandHandler(packet);
-}
-
-void PushEntity(TimelineDecoder::Model& model, const ITimelineDecoder::Entity entity)
-{
- model.m_Entities.emplace_back(entity);
-}
-
-void PushEventClass(TimelineDecoder::Model& model, const ITimelineDecoder::EventClass eventClass)
-{
- model.m_EventClasses.emplace_back(eventClass);
-}
-
-void PushEvent(TimelineDecoder::Model& model, const ITimelineDecoder::Event event)
-{
- model.m_Events.emplace_back(event);
-}
-
-void PushLabel(TimelineDecoder::Model& model, const ITimelineDecoder::Label label)
-{
- model.m_Labels.emplace_back(label);
-}
-
-void PushRelationship(TimelineDecoder::Model& model, const ITimelineDecoder::Relationship relationship)
-{
- model.m_Relationships.emplace_back(relationship);
-}
-
-BOOST_AUTO_TEST_CASE(TimelineDirectoryTest)
-{
- uint32_t uint8_t_size = sizeof(uint8_t);
- uint32_t uint32_t_size = sizeof(uint32_t);
- uint32_t uint64_t_size = sizeof(uint64_t);
-
- profiling::BufferManager bufferManager(5);
- profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
-
- std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
- timelinePacketWriterFactory.GetSendTimelinePacket();
-
- profiling::PacketVersionResolver packetVersionResolver;
-
- TimelineDecoder timelineDecoder;
- TimelineCaptureCommandHandler timelineCaptureCommandHandler(
- 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder);
-
- TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
- 1, 0, packetVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(),
- timelineCaptureCommandHandler, true);
-
- sendTimelinePacket->SendTimelineMessageDirectoryPackage();
- sendTimelinePacket->Commit();
-
- std::vector<profiling::SwTraceMessage> swTraceBufferMessages;
-
- unsigned int offset = uint32_t_size * 2;
-
- std::unique_ptr<profiling::IPacketBuffer> packetBuffer = bufferManager.GetReadableBuffer();
-
- uint8_t readStreamVersion = ReadUint8(packetBuffer, offset);
- BOOST_CHECK(readStreamVersion == 4);
- offset += uint8_t_size;
- uint8_t readPointerBytes = ReadUint8(packetBuffer, offset);
- BOOST_CHECK(readPointerBytes == uint64_t_size);
- offset += uint8_t_size;
- uint8_t readThreadIdBytes = ReadUint8(packetBuffer, offset);
- BOOST_CHECK(readThreadIdBytes == armnn::profiling::ThreadIdSize);
- offset += uint8_t_size;
-
- uint32_t declarationSize = profiling::ReadUint32(packetBuffer, offset);
- offset += uint32_t_size;
- for(uint32_t i = 0; i < declarationSize; ++i)
- {
- swTraceBufferMessages.push_back(profiling::ReadSwTraceMessage(packetBuffer->GetReadableData(),
- offset,
- packetBuffer->GetSize()));
- }
-
- SendTimelinePacketToCommandHandler(packetBuffer->GetReadableData(), timelineDirectoryCaptureCommandHandler);
-
- for(uint32_t index = 0; index < declarationSize; ++index)
- {
- profiling::SwTraceMessage& bufferMessage = swTraceBufferMessages[index];
- profiling::SwTraceMessage& handlerMessage = timelineDirectoryCaptureCommandHandler.m_SwTraceMessages[index];
-
- BOOST_CHECK(bufferMessage.m_Name == handlerMessage.m_Name);
- BOOST_CHECK(bufferMessage.m_UiName == handlerMessage.m_UiName);
- BOOST_CHECK(bufferMessage.m_Id == handlerMessage.m_Id);
-
- BOOST_CHECK(bufferMessage.m_ArgTypes.size() == handlerMessage.m_ArgTypes.size());
- for(uint32_t i = 0; i < bufferMessage.m_ArgTypes.size(); ++i)
- {
- BOOST_CHECK(bufferMessage.m_ArgTypes[i] == handlerMessage.m_ArgTypes[i]);
- }
-
- BOOST_CHECK(bufferMessage.m_ArgNames.size() == handlerMessage.m_ArgNames.size());
- for(uint32_t i = 0; i < bufferMessage.m_ArgNames.size(); ++i)
- {
- BOOST_CHECK(bufferMessage.m_ArgNames[i] == handlerMessage.m_ArgNames[i]);
- }
- }
-}
-
-BOOST_AUTO_TEST_CASE(TimelineCaptureTest)
-{
- profiling::BufferManager bufferManager(50);
- profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
-
- std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
- timelinePacketWriterFactory.GetSendTimelinePacket();
-
- profiling::PacketVersionResolver packetVersionResolver;
-
- TimelineDecoder timelineDecoder;
- const TimelineDecoder::Model& model = timelineDecoder.GetModel();
-
-
- TimelineCaptureCommandHandler timelineCaptureCommandHandler(
- 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder,
- armnn::profiling::ThreadIdSize);
-
- using Status = ITimelineDecoder::TimelineStatus;
- BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success);
- BOOST_CHECK(timelineDecoder.SetEventClassCallback(PushEventClass) == Status::TimelineStatus_Success);
- BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent) == Status::TimelineStatus_Success);
- BOOST_CHECK(timelineDecoder.SetLabelCallback(PushLabel) == Status::TimelineStatus_Success);
- BOOST_CHECK(timelineDecoder.SetRelationshipCallback(PushRelationship) == Status::TimelineStatus_Success);
-
- const uint64_t entityGuid = 111111u;
- const uint64_t eventClassGuid = 22222u;
- const uint64_t eventClassNameGuid = 22322u;
- const uint64_t timestamp = 33333u;
- const uint64_t eventGuid = 44444u;
-
- const int threadId = armnnUtils::Threads::GetCurrentThreadId();
-
- // need to do a bit of work here to extract the value from threadId
- unsigned char* uCharThreadId = new unsigned char[armnn::profiling::ThreadIdSize]();;
- uint64_t uint64ThreadId;
-
- profiling::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize);
-
- if (armnn::profiling::ThreadIdSize == 4)
- {
- uint64ThreadId = profiling::ReadUint32(uCharThreadId, 0);
- }
- else if (armnn::profiling::ThreadIdSize == 8)
- {
- uint64ThreadId = profiling::ReadUint64(uCharThreadId, 0);
- }
- delete[] uCharThreadId;
-
- const uint64_t labelGuid = 66666u;
- std::string labelName = "test_label";
-
- const uint64_t relationshipGuid = 77777u;
- const uint64_t headGuid = 888888u;
- const uint64_t tailGuid = 999999u;
-
- for (int i = 0; i < 10; ++i)
- {
- // Send entity
- sendTimelinePacket->SendTimelineEntityBinaryPacket(entityGuid);
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
-
- // Send event class
- sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid, eventClassNameGuid);
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
-
- // Send event
- sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid);
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
-
- // Send label
- sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
-
- // Send relationship
- profiling::ProfilingRelationshipType relationshipType = profiling::ProfilingRelationshipType::DataLink;
- sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
- relationshipGuid,
- headGuid,
- tailGuid,
- 0);
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
- }
-
- for (unsigned long i = 0; i < 10; ++i)
- {
- BOOST_CHECK(model.m_Entities[i].m_Guid == entityGuid);
-
- BOOST_CHECK(model.m_EventClasses[i].m_Guid == eventClassGuid);
-
- BOOST_CHECK(model.m_Events[i].m_TimeStamp == timestamp);
- BOOST_CHECK(model.m_Events[i].m_ThreadId == uint64ThreadId);
- BOOST_CHECK(model.m_Events[i].m_Guid == eventGuid);
-
- BOOST_CHECK(model.m_Labels[i].m_Guid == labelGuid);
- BOOST_CHECK(model.m_Labels[i].m_Name == labelName);
-
- BOOST_CHECK(model.m_Relationships[i].m_RelationshipType == ITimelineDecoder::RelationshipType::DataLink);
- BOOST_CHECK(model.m_Relationships[i].m_Guid == relationshipGuid);
- BOOST_CHECK(model.m_Relationships[i].m_HeadGuid == headGuid);
- BOOST_CHECK(model.m_Relationships[i].m_TailGuid == tailGuid);
- }
-}
-
-BOOST_AUTO_TEST_CASE(TimelineCaptureTestMultipleStringsInBuffer)
-{
- profiling::BufferManager bufferManager(50);
- profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
-
- std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
- timelinePacketWriterFactory.GetSendTimelinePacket();
-
- profiling::PacketVersionResolver packetVersionResolver;
-
- TimelineDecoder timelineDecoder;
- const TimelineDecoder::Model& model = timelineDecoder.GetModel();
-
- TimelineCaptureCommandHandler timelineCaptureCommandHandler(
- 1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder,
- armnn::profiling::ThreadIdSize);
-
- using Status = ITimelineDecoder::TimelineStatus;
- BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success);
- BOOST_CHECK(timelineDecoder.SetEventClassCallback(PushEventClass) == Status::TimelineStatus_Success);
- BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent) == Status::TimelineStatus_Success);
- BOOST_CHECK(timelineDecoder.SetLabelCallback(PushLabel) == Status::TimelineStatus_Success);
- BOOST_CHECK(timelineDecoder.SetRelationshipCallback(PushRelationship) == Status::TimelineStatus_Success);
-
- const uint64_t entityGuid = 111111u;
- const uint64_t eventClassGuid = 22222u;
- const uint64_t eventClassNameGuid = 22322u;
- const uint64_t timestamp = 33333u;
- const uint64_t eventGuid = 44444u;
-
- const int threadId = armnnUtils::Threads::GetCurrentThreadId();
-
- // need to do a bit of work here to extract the value from threadId
- unsigned char* uCharThreadId = new unsigned char[armnn::profiling::ThreadIdSize]();
- uint64_t uint64ThreadId;
-
- profiling::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize);
-
- if ( armnn::profiling::ThreadIdSize == 4 )
- {
- uint64ThreadId = profiling::ReadUint32(uCharThreadId, 0);
- }
- else if ( armnn::profiling::ThreadIdSize == 8 )
- {
- uint64ThreadId = profiling::ReadUint64(uCharThreadId, 0);
- }
- delete[] uCharThreadId;
-
- const uint64_t labelGuid = 66666u;
- std::string labelName = "test_label";
- std::string labelName2 = "test_label2";
- std::string labelName3 = "test_label32";
-
- const uint64_t relationshipGuid = 77777u;
- const uint64_t headGuid = 888888u;
- const uint64_t tailGuid = 999999u;
-
- // Check with multiple messages in the same buffer
- for ( int i = 0; i < 9; ++i )
- {
- // Send entity
- sendTimelinePacket->SendTimelineEntityBinaryPacket(entityGuid);
- // Send event class
- sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid, eventClassNameGuid);
- // Send event
- sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid);
- // Send label
- sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
- sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName2);
- sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName3);
- // Send relationship
- profiling::ProfilingRelationshipType relationshipType = profiling::ProfilingRelationshipType::DataLink;
- sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
- relationshipGuid,
- headGuid,
- tailGuid,
- 0);
- }
-
- sendTimelinePacket->Commit();
- SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
- timelineCaptureCommandHandler);
-
- for ( unsigned long i = 0; i < 9; ++i )
- {
- BOOST_CHECK(model.m_Entities[i].m_Guid == entityGuid);
-
- BOOST_CHECK(model.m_EventClasses[i].m_Guid == eventClassGuid);
-
- BOOST_CHECK(model.m_Labels[i].m_Guid == labelGuid);
-
- BOOST_CHECK(model.m_Events[i].m_TimeStamp == timestamp);
- BOOST_CHECK(model.m_Events[i].m_ThreadId == uint64ThreadId);
- BOOST_CHECK(model.m_Events[i].m_Guid == eventGuid);
-
- BOOST_CHECK(model.m_Relationships[i].m_RelationshipType == ITimelineDecoder::RelationshipType::DataLink);
- BOOST_CHECK(model.m_Relationships[i].m_Guid == relationshipGuid);
- BOOST_CHECK(model.m_Relationships[i].m_HeadGuid == headGuid);
- BOOST_CHECK(model.m_Relationships[i].m_TailGuid == tailGuid);
- }
- for ( unsigned long i = 0; i < 9; i += 3 )
- {
- BOOST_CHECK(model.m_Labels[i].m_Name == labelName);
- BOOST_CHECK(model.m_Labels[i+1].m_Name == labelName2);
- BOOST_CHECK(model.m_Labels[i+2].m_Name == labelName3);
- }
-}
-
-BOOST_AUTO_TEST_SUITE_END()