diff options
author | Cathal Corbett <cathal.corbett@arm.com> | 2022-02-25 15:33:28 +0000 |
---|---|---|
committer | Cathal Corbett <cathal.corbett@arm.com> | 2022-03-01 11:44:14 +0000 |
commit | 5aa9fd7ac6bf8dad576fa4a0a32aa3dae98d11ab (patch) | |
tree | 23a3a0d5ca5143924277f34c98d36cf7b99430a7 /src/profiling/test | |
parent | 1fc448ad2455ad31b96a3891f847125a3295d75a (diff) | |
download | armnn-5aa9fd7ac6bf8dad576fa4a0a32aa3dae98d11ab.tar.gz |
IVGCVSW-6704 Change the namespace from armnn::profiling to arm::pipe
* Updated ABI version to 29 due to being the first ABI break in 22.05
!android-nn-driver:7226
Signed-off-by: Cathal Corbett <cathal.corbett@arm.com>
Change-Id: I9c50007dcd5b5e792757e7bd1213606df5ffec36
Diffstat (limited to 'src/profiling/test')
22 files changed, 350 insertions, 351 deletions
diff --git a/src/profiling/test/BufferTests.cpp b/src/profiling/test/BufferTests.cpp index e3abe862e4..c4714d6ad4 100644 --- a/src/profiling/test/BufferTests.cpp +++ b/src/profiling/test/BufferTests.cpp @@ -13,7 +13,7 @@ #include <doctest/doctest.h> -using namespace armnn::profiling; +using namespace arm::pipe; TEST_SUITE("BufferTests") { @@ -383,8 +383,8 @@ TEST_CASE("ReadSwTraceMessageExceptionTest0") unsigned int uint32_t_size = sizeof(uint32_t); unsigned int offset = uint32_t_size; - CHECK_THROWS_AS(arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()), - arm::pipe::ProfilingException); + CHECK_THROWS_AS(ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()), + ProfilingException); } @@ -405,8 +405,8 @@ TEST_CASE("ReadSwTraceMessageExceptionTest1") unsigned int uint32_t_size = sizeof(uint32_t); unsigned int offset = uint32_t_size; - CHECK_THROWS_AS(arm::pipe::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()), - arm::pipe::ProfilingException); + CHECK_THROWS_AS(ReadSwTraceMessage(packetBuffer->GetReadableData(), offset, packetBuffer->GetSize()), + ProfilingException); } diff --git a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp index 03767c0a2a..5c5ee8a0e4 100644 --- a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp +++ b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp @@ -19,7 +19,7 @@ #include <sstream> #include <sys/stat.h> -using namespace armnn::profiling; +using namespace arm::pipe; using namespace armnn; using namespace std::chrono_literals; @@ -32,7 +32,7 @@ class FileOnlyHelperService : public ProfilingService { return ProfilingService::WaitForPacketSent(m_ProfilingService, timeout); } - armnn::profiling::ProfilingService m_ProfilingService; + ProfilingService m_ProfilingService; }; TEST_SUITE("FileOnlyProfilingDecoratorTests") diff --git a/src/profiling/test/PrintPacketHeaderHandler.cpp b/src/profiling/test/PrintPacketHeaderHandler.cpp index f85a7b1fcb..393153424d 100644 --- a/src/profiling/test/PrintPacketHeaderHandler.cpp +++ b/src/profiling/test/PrintPacketHeaderHandler.cpp @@ -8,10 +8,10 @@ #include <iostream> #include <sstream> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::vector<uint32_t> PrintPacketHeaderHandler::GetHeadersAccepted() @@ -27,6 +27,6 @@ void PrintPacketHeaderHandler::HandlePacket(const arm::pipe::Packet& packet) std::cout << ss.str() << std::endl; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/PrintPacketHeaderHandler.hpp b/src/profiling/test/PrintPacketHeaderHandler.hpp index 397da0b8ea..a05e733c07 100644 --- a/src/profiling/test/PrintPacketHeaderHandler.hpp +++ b/src/profiling/test/PrintPacketHeaderHandler.hpp @@ -9,10 +9,10 @@ #include <common/include/Packet.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class PrintPacketHeaderHandler : public ILocalPacketHandler @@ -22,6 +22,6 @@ class PrintPacketHeaderHandler : public ILocalPacketHandler virtual void HandlePacket(const arm::pipe::Packet& packet); }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp index a851e940b4..3c4800a361 100644 --- a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp +++ b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp @@ -14,7 +14,7 @@ #include <doctest/doctest.h> -using namespace armnn::profiling; +using namespace arm::pipe; namespace { @@ -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<arm::pipe::Packet>(0u, g_DataLength, m_PacketData); + m_Packet = std::make_unique<Packet>(0u, g_DataLength, m_PacketData); } ~DummyProfilingConnection() = default; @@ -54,7 +54,7 @@ public: return true; } - arm::pipe::Packet ReadPacket(uint32_t timeout) override + 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<arm::pipe::Packet> m_Packet; + std::unique_ptr<Packet> m_Packet; }; std::vector<char> ReadDumpFile(const std::string& dumpFileName) @@ -105,8 +105,8 @@ 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<arm::pipe::Packet> packet; - CHECK_NOTHROW(packet = std::make_unique<arm::pipe::Packet>(decorator.ReadPacket(0))); + std::unique_ptr<Packet> packet; + CHECK_NOTHROW(packet = std::make_unique<Packet>(decorator.ReadPacket(0))); decorator.Close(); diff --git a/src/profiling/test/ProfilingGuidTest.cpp b/src/profiling/test/ProfilingGuidTest.cpp index 30cfae82ca..0537badc33 100644 --- a/src/profiling/test/ProfilingGuidTest.cpp +++ b/src/profiling/test/ProfilingGuidTest.cpp @@ -14,7 +14,7 @@ #include <fmt/format.h> #include <thread> -using namespace armnn::profiling; +using namespace arm::pipe; TEST_SUITE("ProfilingGuidTests") { @@ -93,10 +93,10 @@ TEST_CASE("StaticGuidGeneratorCollisionTest") // If we're running on a 32bit system it is more likely to get a GUID clash over 1 million executions. // We can generally detect this when the GUID turns out to be MIN_STATIC_GUID. Output a warning // message rather than error in this case. - if (guid == ProfilingGuid(armnn::profiling::MIN_STATIC_GUID)) + if (guid == ProfilingGuid(MIN_STATIC_GUID)) { WARN("MIN_STATIC_GUID returned more than once from GenerateStaticId."); - } + } else { FAIL(fmt::format("GUID collision occurred: {} -> {}", str, guid)); diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp index 491f057599..5e7d31a914 100644 --- a/src/profiling/test/ProfilingMocks.hpp +++ b/src/profiling/test/ProfilingMocks.hpp @@ -27,10 +27,10 @@ #include <mutex> #include <thread> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class MockProfilingConnection : public IProfilingConnection @@ -131,7 +131,7 @@ public: arm::pipe::Packet ReadPacket(uint32_t timeout) override { - IgnoreUnused(timeout); + armnn::IgnoreUnused(timeout); // Simulate a delay in the reading process. The default timeout is way too long. std::this_thread::sleep_for(std::chrono::milliseconds(5)); @@ -165,7 +165,7 @@ class MockProfilingConnectionFactory : public IProfilingConnectionFactory public: IProfilingConnectionPtr GetProfilingConnection(const ProfilingOptions& options) const override { - IgnoreUnused(options); + armnn::IgnoreUnused(options); return std::make_unique<MockProfilingConnection>(); } }; @@ -404,7 +404,7 @@ public: void SendCounterDirectoryPacket(const ICounterDirectory& counterDirectory) override { - IgnoreUnused(counterDirectory); + armnn::IgnoreUnused(counterDirectory); std::string message("SendCounterDirectoryPacket"); unsigned int reserved = 0; @@ -416,7 +416,7 @@ public: void SendPeriodicCounterCapturePacket(uint64_t timestamp, const std::vector<CounterValue>& values) override { - IgnoreUnused(timestamp, values); + armnn::IgnoreUnused(timestamp, values); std::string message("SendPeriodicCounterCapturePacket"); unsigned int reserved = 0; @@ -428,7 +428,7 @@ public: void SendPeriodicCounterSelectionPacket(uint32_t capturePeriod, const std::vector<uint16_t>& selectedCounterIds) override { - IgnoreUnused(capturePeriod, selectedCounterIds); + armnn::IgnoreUnused(capturePeriod, selectedCounterIds); std::string message("SendPeriodicCounterSelectionPacket"); unsigned int reserved = 0; @@ -505,7 +505,7 @@ public: return counterSetPtr; } - const Counter* RegisterCounter(const BackendId& backendId, + const Counter* RegisterCounter(const armnn::BackendId& backendId, const uint16_t uid, const std::string& parentCategoryName, uint16_t counterClass, @@ -518,7 +518,7 @@ public: const armnn::Optional<uint16_t>& deviceUid = armnn::EmptyOptional(), const armnn::Optional<uint16_t>& counterSetUid = armnn::EmptyOptional()) { - IgnoreUnused(backendId); + armnn::IgnoreUnused(backendId); // Get the number of cores from the argument only uint16_t deviceCores = numberOfCores.has_value() ? numberOfCores.value() : 0; @@ -602,19 +602,19 @@ public: const Device* GetDevice(uint16_t uid) const override { - IgnoreUnused(uid); + armnn::IgnoreUnused(uid); return nullptr; // Not used by the unit tests } const CounterSet* GetCounterSet(uint16_t uid) const override { - IgnoreUnused(uid); + armnn::IgnoreUnused(uid); return nullptr; // Not used by the unit tests } const Counter* GetCounter(uint16_t uid) const override { - IgnoreUnused(uid); + armnn::IgnoreUnused(uid); return nullptr; // Not used by the unit tests } @@ -698,9 +698,9 @@ class MockProfilingServiceStatus : public IProfilingServiceStatus { public: void NotifyProfilingServiceActive() override {} - void WaitForProfilingServiceActivation(unsigned int timeout) override { IgnoreUnused(timeout); } + void WaitForProfilingServiceActivation(unsigned int timeout) override { armnn::IgnoreUnused(timeout); } }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp index a03a3ba28a..154234667e 100644 --- a/src/profiling/test/ProfilingTestUtils.cpp +++ b/src/profiling/test/ProfilingTestUtils.cpp @@ -125,7 +125,7 @@ ProfilingGuid VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid, } else { - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; CHECK(readProfilingGuid == profilingService.GetStaticId(label)); } @@ -373,7 +373,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) GetProfilingService(&runtime).ResetExternalProfilingOptions( ConvertExternalProfilingOptions(options.m_ProfilingOptions), false); - profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); + ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected); profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck); profilingServiceHelper.ForceTransitionToState(ProfilingState::Active); @@ -442,7 +442,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) armnn::NetworkId netId; CHECK(runtime.LoadNetwork(netId, std::move(optNet)) == Status::Success); - profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); + BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); auto readableBuffer = bufferManager.GetReadableBuffer(); // Profiling is enabled, the post-optimisation structure should be created diff --git a/src/profiling/test/ProfilingTestUtils.hpp b/src/profiling/test/ProfilingTestUtils.hpp index 6be35a96be..810a34c3e2 100644 --- a/src/profiling/test/ProfilingTestUtils.hpp +++ b/src/profiling/test/ProfilingTestUtils.hpp @@ -16,7 +16,7 @@ #include <common/include/ProfilingGuid.hpp> using namespace armnn; -using namespace armnn::profiling; +using namespace arm::pipe; const static uint32_t bodyHeaderSize = 6; @@ -63,10 +63,10 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId); bool CompareOutput(std::vector<std::string> output, std::vector<std::string> expectedOutput); -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class ProfilingServiceRuntimeHelper : public ProfilingService @@ -80,7 +80,7 @@ public: { return GetBufferManager(m_ProfilingService); } - armnn::profiling::ProfilingService& m_ProfilingService; + ProfilingService& m_ProfilingService; void ForceTransitionToState(ProfilingState newState) { @@ -88,7 +88,7 @@ public: } }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index 12a0105563..cba6ebd475 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -51,7 +51,7 @@ #include <random> -using namespace armnn::profiling; +using namespace arm::pipe; using PacketType = MockProfilingConnection::PacketType; TEST_SUITE("ExternalProfiling") @@ -530,7 +530,7 @@ TEST_CASE("CheckProfilingStateMachine") ProfilingStateMachine profilingState15(ProfilingState::Active); CHECK_THROWS_AS(profilingState15.TransitionToState(ProfilingState::Uninitialised), armnn::Exception); - ProfilingStateMachine profilingState16(armnn::profiling::ProfilingState::Active); + ProfilingStateMachine profilingState16(ProfilingState::Active); CHECK_THROWS_AS(profilingState16.TransitionToState(ProfilingState::WaitingForAck), armnn::Exception); ProfilingStateMachine profilingState17(ProfilingState::Uninitialised); @@ -657,7 +657,7 @@ TEST_CASE("CaptureDataMethods") TEST_CASE("CheckProfilingServiceDisabled") { ProfilingOptions options; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.Update(); @@ -667,7 +667,7 @@ TEST_CASE("CheckProfilingServiceDisabled") TEST_CASE("CheckProfilingServiceCounterDirectory") { ProfilingOptions options; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); const ICounterDirectory& counterDirectory0 = profilingService.GetCounterDirectory(); @@ -691,7 +691,7 @@ TEST_CASE("CheckProfilingServiceCounterValues") { ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); profilingService.Update(); @@ -702,7 +702,7 @@ TEST_CASE("CheckProfilingServiceCounterValues") std::vector<std::thread> writers; CHECK(!counters.empty()); - uint16_t inferencesRun = armnn::profiling::INFERENCES_RUN; + uint16_t inferencesRun = INFERENCES_RUN; // Test GetAbsoluteCounterValue for (int i = 0; i < 4; ++i) @@ -838,13 +838,13 @@ TEST_CASE("CheckCounterDirectoryRegisterCategory") // Register a category with an invalid name const Category* noCategory = nullptr; - CHECK_THROWS_AS(noCategory = counterDirectory.RegisterCategory(""), armnn::InvalidArgumentException); + CHECK_THROWS_AS(noCategory = counterDirectory.RegisterCategory(""), arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCategoryCount() == 0); CHECK(!noCategory); // Register a category with an invalid name CHECK_THROWS_AS(noCategory = counterDirectory.RegisterCategory("invalid category"), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCategoryCount() == 0); CHECK(!noCategory); @@ -871,7 +871,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCategory") // Register a category already registered const Category* anotherCategory = nullptr; CHECK_THROWS_AS(anotherCategory = counterDirectory.RegisterCategory(categoryName), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCategoryCount() == 1); CHECK(!anotherCategory); @@ -898,7 +898,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCategory") const Category* categoryInvalidDeviceName = nullptr; CHECK_THROWS_AS(categoryInvalidDeviceName = counterDirectory.RegisterCategory(categoryWoDeviceName), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCategoryCount() == 2); CHECK(!categoryInvalidDeviceName); @@ -961,12 +961,12 @@ TEST_CASE("CheckCounterDirectoryRegisterDevice") // Register a device with an invalid name const Device* noDevice = nullptr; - CHECK_THROWS_AS(noDevice = counterDirectory.RegisterDevice(""), armnn::InvalidArgumentException); + CHECK_THROWS_AS(noDevice = counterDirectory.RegisterDevice(""), arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetDeviceCount() == 0); CHECK(!noDevice); // Register a device with an invalid name - CHECK_THROWS_AS(noDevice = counterDirectory.RegisterDevice("inv@lid nam€"), armnn::InvalidArgumentException); + CHECK_THROWS_AS(noDevice = counterDirectory.RegisterDevice("inv@lid nam€"), arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetDeviceCount() == 0); CHECK(!noDevice); @@ -992,7 +992,7 @@ TEST_CASE("CheckCounterDirectoryRegisterDevice") // Register a device with the name of a device already registered const Device* deviceSameName = nullptr; - CHECK_THROWS_AS(deviceSameName = counterDirectory.RegisterDevice(deviceName), armnn::InvalidArgumentException); + CHECK_THROWS_AS(deviceSameName = counterDirectory.RegisterDevice(deviceName), arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetDeviceCount() == 1); CHECK(!deviceSameName); @@ -1019,7 +1019,7 @@ TEST_CASE("CheckCounterDirectoryRegisterDevice") const Device* deviceWCoresWInvalidParentCategory = nullptr; CHECK_THROWS_AS(deviceWCoresWInvalidParentCategory = counterDirectory.RegisterDevice(deviceWCoresWInvalidParentCategoryName, 3, std::string("")), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetDeviceCount() == 2); CHECK(!deviceWCoresWInvalidParentCategory); @@ -1028,7 +1028,7 @@ TEST_CASE("CheckCounterDirectoryRegisterDevice") const Device* deviceWCoresWInvalidParentCategory2 = nullptr; CHECK_THROWS_AS(deviceWCoresWInvalidParentCategory2 = counterDirectory.RegisterDevice( deviceWCoresWInvalidParentCategoryName2, 3, std::string("invalid_parent_category")), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetDeviceCount() == 2); CHECK(!deviceWCoresWInvalidParentCategory2); @@ -1065,13 +1065,13 @@ TEST_CASE("CheckCounterDirectoryRegisterCounterSet") // Register a counter set with an invalid name const CounterSet* noCounterSet = nullptr; - CHECK_THROWS_AS(noCounterSet = counterDirectory.RegisterCounterSet(""), armnn::InvalidArgumentException); + CHECK_THROWS_AS(noCounterSet = counterDirectory.RegisterCounterSet(""), arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 0); CHECK(!noCounterSet); // Register a counter set with an invalid name CHECK_THROWS_AS(noCounterSet = counterDirectory.RegisterCounterSet("invalid name"), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 0); CHECK(!noCounterSet); @@ -1098,7 +1098,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCounterSet") // Register a counter set with the name of a counter set already registered const CounterSet* counterSetSameName = nullptr; CHECK_THROWS_AS(counterSetSameName = counterDirectory.RegisterCounterSet(counterSetName), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 1); CHECK(!counterSetSameName); @@ -1126,7 +1126,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCounterSet") const CounterSet* counterSetWCountWInvalidParentCategory = nullptr; CHECK_THROWS_AS(counterSetWCountWInvalidParentCategory = counterDirectory.RegisterCounterSet( counterSetWCountWInvalidParentCategoryName, 42, std::string("")), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 2); CHECK(!counterSetWCountWInvalidParentCategory); @@ -1136,7 +1136,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCounterSet") const CounterSet* counterSetWCountWInvalidParentCategory2 = nullptr; CHECK_THROWS_AS(counterSetWCountWInvalidParentCategory2 = counterDirectory.RegisterCounterSet( counterSetWCountWInvalidParentCategoryName2, 42, std::string("invalid_parent_category")), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 2); CHECK(!counterSetWCountWInvalidParentCategory2); @@ -1169,7 +1169,7 @@ TEST_CASE("CheckCounterDirectoryRegisterCounterSet") const CounterSet* counterSetSameCategory = nullptr; CHECK_THROWS_AS(counterSetSameCategory = counterDirectory.RegisterCounterSet(counterSetSameCategoryName, 0, invalidCategoryName), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterSetCount() == 3); CHECK(!counterSetSameCategory); } @@ -1193,62 +1193,62 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "valid ", "name"), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid parent category name CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 1, - "invalid parent category", - 0, - 1, - 123.45f, - "valid name", - "valid description"), - armnn::InvalidArgumentException); + 1, + "invalid parent category", + 0, + 1, + 123.45f, + "valid name", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid class CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 2, - "valid_parent_category", - 2, - 1, - 123.45f, - "valid " - "name", - "valid description"), - armnn::InvalidArgumentException); + 2, + "valid_parent_category", + 2, + 1, + 123.45f, + "valid " + "name", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid interpolation CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 4, - "valid_parent_category", - 0, - 3, - 123.45f, - "valid " - "name", - "valid description"), - armnn::InvalidArgumentException); + 4, + "valid_parent_category", + 0, + 3, + 123.45f, + "valid " + "name", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid multiplier CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 5, - "valid_parent_category", - 0, - 1, - .0f, - "valid " - "name", - "valid description"), - armnn::InvalidArgumentException); + 5, + "valid_parent_category", + 0, + 1, + .0f, + "valid " + "name", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); @@ -1262,20 +1262,20 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "", "valid description"), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid name CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 7, - "valid_parent_category", - 0, - 1, - 123.45f, - "invalid nam€", - "valid description"), - armnn::InvalidArgumentException); + 7, + "valid_parent_category", + 0, + 1, + 123.45f, + "invalid nam€", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); @@ -1289,48 +1289,48 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") 123.45f, "valid name", ""), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid description CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 9, - "valid_parent_category", - 0, - 1, - 123.45f, - "valid " - "name", - "inv@lid description"), - armnn::InvalidArgumentException); + 9, + "valid_parent_category", + 0, + 1, + 123.45f, + "valid " + "name", + "inv@lid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with an invalid unit2 CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 10, - "valid_parent_category", - 0, - 1, - 123.45f, - "valid name", - "valid description", - std::string("Mb/s2")), - armnn::InvalidArgumentException); + 10, + "valid_parent_category", + 0, + 1, + 123.45f, + "valid name", + "valid description", + std::string("Mb/s2")), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); // Register a counter with a non-existing parent category name CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 11, - "invalid_parent_category", - 0, - 1, - 123.45f, - "valid name", - "valid description"), - armnn::InvalidArgumentException); + 11, + "invalid_parent_category", + 0, + 1, + 123.45f, + "valid name", + "valid description"), + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 0); CHECK(!noCounter); @@ -1384,21 +1384,21 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") "valid name", "valid description", std::string("description")), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 1); CHECK(!counterSameName); // Register a counter with a valid parent category name and units const Counter* counterWUnits = nullptr; CHECK_NOTHROW(counterWUnits = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 14, - categoryName, - 0, - 1, - 123.45f, - "valid name 2", - "valid description", - std::string("Mnnsq2"))); // Units + 14, + categoryName, + 0, + 1, + 123.45f, + "valid name 2", + "valid description", + std::string("Mnnsq2"))); // Units CHECK(counterDirectory.GetCounterCount() == 2); CHECK(counterWUnits); CHECK(counterWUnits->m_Uid > counter->m_Uid); @@ -1417,16 +1417,16 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter with a valid parent category name and not associated with a device const Counter* counterWoDevice = nullptr; CHECK_NOTHROW(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 CHECK(counterDirectory.GetCounterCount() == 3); CHECK(counterWoDevice); CHECK(counterWoDevice->m_Uid > counter->m_Uid); @@ -1444,17 +1444,17 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter with a valid parent category name and associated to an invalid device CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 15, - categoryName, - 0, - 1, - 123.45f, - "valid name 4", - "valid description", - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores - 100), // Device UID - armnn::InvalidArgumentException); + 15, + categoryName, + 0, + 1, + 123.45f, + "valid name 4", + "valid description", + armnn::EmptyOptional(), // Units + armnn::EmptyOptional(), // Number of cores + 100), // Device UID + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 3); CHECK(!noCounter); @@ -1471,16 +1471,16 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter with a valid parent category name and associated to a device const Counter* counterWDevice = nullptr; CHECK_NOTHROW(counterWDevice = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 16, - categoryName, - 0, - 1, - 123.45f, - "valid name 5", - std::string("valid description"), - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores - device->m_Uid)); // Device UID + 16, + categoryName, + 0, + 1, + 123.45f, + "valid name 5", + std::string("valid description"), + armnn::EmptyOptional(), // Units + armnn::EmptyOptional(), // Number of cores + device->m_Uid)); // Device UID CHECK(counterDirectory.GetCounterCount() == 4); CHECK(counterWDevice); CHECK(counterWDevice->m_Uid > counter->m_Uid); @@ -1499,17 +1499,17 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter with a valid parent category name and not associated with a counter set const Counter* counterWoCounterSet = nullptr; CHECK_NOTHROW(counterWoCounterSet = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 17, - categoryName, - 0, - 1, - 123.45f, - "valid name 6", - "valid description", - armnn::EmptyOptional(),// Units - armnn::EmptyOptional(),// No of cores - armnn::EmptyOptional(),// Device UID - 0)); // CounterSet UID + 17, + categoryName, + 0, + 1, + 123.45f, + "valid name 6", + "valid description", + armnn::EmptyOptional(),// Units + armnn::EmptyOptional(),// No of cores + armnn::EmptyOptional(),// Device UID + 0)); // CounterSet UID CHECK(counterDirectory.GetCounterCount() == 5); CHECK(counterWoCounterSet); CHECK(counterWoCounterSet->m_Uid > counter->m_Uid); @@ -1527,18 +1527,18 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter with a valid parent category name and associated to an invalid counter set CHECK_THROWS_AS(noCounter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 18, - categoryName, - 0, - 1, - 123.45f, - "valid ", - "name 7", - std::string("valid description"), - armnn::EmptyOptional(), // Units - armnn::EmptyOptional(), // Number of cores - 100), // Counter set UID - armnn::InvalidArgumentException); + 18, + categoryName, + 0, + 1, + 123.45f, + "valid ", + "name 7", + std::string("valid description"), + armnn::EmptyOptional(), // Units + armnn::EmptyOptional(), // Number of cores + 100), // Counter set UID + arm::pipe::InvalidArgumentException); CHECK(counterDirectory.GetCounterCount() == 5); CHECK(!noCounter); @@ -1727,12 +1727,12 @@ TEST_CASE("CheckCounterDirectoryRegisterCounter") // Register a counter to the other category const Counter* anotherCounter = nullptr; CHECK_NOTHROW(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 + 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 CHECK(counterDirectory.GetCounterCount() == 29); CHECK(anotherCounter); CHECK(anotherCounter->m_MaxCounterUid == anotherCounter->m_Uid); @@ -1787,7 +1787,7 @@ TEST_CASE("CounterSelectionCommandHandlerParseData") uint32_t version = 1; const std::unordered_map<armnn::BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>> backendProfilingContext; + std::shared_ptr<IBackendProfilingContext>> backendProfilingContext; CounterIdMap counterIdMap; Holder holder; TestCaptureThread captureThread; @@ -1928,7 +1928,7 @@ TEST_CASE("CheckTimelineActivationAndDeactivation") TestReportStructure testReportStructure; TestNotifyBackends testNotifyBackends; - profiling::ActivateTimelineReportingCommandHandler activateTimelineReportingCommandHandler(0, + ActivateTimelineReportingCommandHandler activateTimelineReportingCommandHandler(0, 6, packetVersionResolver.ResolvePacketVersion(0, 6) .GetEncodedValue(), @@ -2001,19 +2001,18 @@ TEST_CASE("CheckTimelineActivationAndDeactivation") TEST_CASE("CheckProfilingServiceNotActive") { using namespace armnn; - using namespace armnn::profiling; // Create runtime in which the test will run armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; armnn::RuntimeImpl runtime(options); - profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); + ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected); profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck); profilingServiceHelper.ForceTransitionToState(ProfilingState::Active); - profiling::BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); + BufferManager& bufferManager = profilingServiceHelper.GetProfilingBufferManager(); auto readableBuffer = bufferManager.GetReadableBuffer(); // Profiling is enabled, the post-optimisation structure should be created @@ -2344,7 +2343,7 @@ TEST_CASE("CheckPeriodicCounterCaptureThread") ProfilingStateMachine profilingStateMachine; const std::unordered_map<armnn::BackendId, - std::shared_ptr<armnn::profiling::IBackendProfilingContext>> backendProfilingContext; + std::shared_ptr<IBackendProfilingContext>> backendProfilingContext; CounterIdMap counterIdMap; Holder data; std::vector<uint16_t> captureIds1 = { 0, 1 }; @@ -2551,7 +2550,7 @@ TEST_CASE("CheckProfilingServiceGoodConnectionAcknowledgedPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2611,7 +2610,7 @@ TEST_CASE("CheckProfilingServiceGoodRequestCounterDirectoryPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2669,7 +2668,7 @@ TEST_CASE("CheckProfilingServiceBadPeriodicCounterSelectionPacketInvalidCounterU // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2748,7 +2747,7 @@ TEST_CASE("CheckProfilingServiceGoodPeriodicCounterSelectionPacketNoCounters") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2813,7 +2812,7 @@ TEST_CASE("CheckProfilingServiceGoodPeriodicCounterSelectionPacketSingleCounter" // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2890,7 +2889,7 @@ TEST_CASE("CheckProfilingServiceGoodPeriodicCounterSelectionPacketMultipleCounte // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -2969,7 +2968,7 @@ TEST_CASE("CheckProfilingServiceDisconnect") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -3027,7 +3026,7 @@ TEST_CASE("CheckProfilingServiceGoodPerJobCounterSelectionPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -3094,7 +3093,7 @@ TEST_CASE("CheckConfigureProfilingServiceOn") { ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.ConfigureProfilingService(options); // should get as far as NOT_CONNECTED @@ -3107,7 +3106,7 @@ TEST_CASE("CheckConfigureProfilingServiceOn") TEST_CASE("CheckConfigureProfilingServiceOff") { ProfilingOptions options; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.ConfigureProfilingService(options); // should not move from Uninitialised @@ -3123,7 +3122,7 @@ TEST_CASE("CheckProfilingServiceEnabled") LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning); ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.Update(); @@ -3153,7 +3152,7 @@ TEST_CASE("CheckProfilingServiceEnabledRuntime") // Locally reduce log level to "Warning", as this test needs to parse a warning message from the standard output LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning); ProfilingOptions options; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.Update(); @@ -3196,7 +3195,7 @@ TEST_CASE("CheckProfilingServiceBadConnectionAcknowledgedPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -3258,7 +3257,7 @@ TEST_CASE("CheckProfilingServiceBadRequestCounterDirectoryPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -3322,7 +3321,7 @@ TEST_CASE("CheckProfilingServiceBadPeriodicCounterSelectionPacket") // Reset the profiling service to the uninitialized state ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Swap the profiling connection factory in the profiling service instance with our mock one @@ -3417,7 +3416,7 @@ TEST_CASE("CheckCounterIdMap") TEST_CASE("CheckRegisterBackendCounters") { - uint16_t globalCounterIds = armnn::profiling::INFERENCES_RUN; + uint16_t globalCounterIds = INFERENCES_RUN; armnn::BackendId cpuRefId(armnn::Compute::CpuRef); // Reset the profiling service to the uninitialized state @@ -3454,7 +3453,7 @@ TEST_CASE("CheckRegisterBackendCounters") 1.f, "CounterOne", "first test counter"); - CHECK((newGlobalCounterId = armnn::profiling::INFERENCES_RUN + 1)); + CHECK((newGlobalCounterId = INFERENCES_RUN + 1)); uint16_t mappedGlobalId = profilingService.GetCounterMappings().GetGlobalId(0, cpuRefId); CHECK(mappedGlobalId == newGlobalCounterId); auto backendMapping = profilingService.GetCounterMappings().GetBackendId(newGlobalCounterId); @@ -3482,7 +3481,7 @@ TEST_CASE("CheckCounterStatusQuery") BackendProfiling backendProfilingCpuRef(options, profilingService, cpuRefId); BackendProfiling backendProfilingCpuAcc(options, profilingService, cpuAccId); - uint16_t initialNumGlobalCounterIds = armnn::profiling::INFERENCES_RUN; + uint16_t initialNumGlobalCounterIds = INFERENCES_RUN; // Create RegisterBackendCounters for CpuRef RegisterBackendCounters registerBackendCountersCpuRef(initialNumGlobalCounterIds, cpuRefId, profilingService); @@ -3617,15 +3616,15 @@ TEST_CASE("CheckRegisterCounters") mockProfilingService.RegisterMapping(7, 1, cpuRefId); mockProfilingService.RegisterMapping(8, 2, cpuRefId); - armnn::profiling::BackendProfiling backendProfiling(options, + BackendProfiling backendProfiling(options, mockProfilingService, cpuRefId); - armnn::profiling::Timestamp timestamp; + Timestamp timestamp; timestamp.timestamp = 1000998; timestamp.counterValues.emplace_back(0, 700); timestamp.counterValues.emplace_back(2, 93); - std::vector<armnn::profiling::Timestamp> timestamps; + std::vector<Timestamp> timestamps; timestamps.push_back(timestamp); backendProfiling.ReportCounters(timestamps); @@ -3675,7 +3674,7 @@ TEST_CASE("CheckFileFormat") { // Change file format to an unsupported value options.m_FileFormat = "json"; // Enable the profiling service - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); // Start the command handler and the send thread profilingService.Update(); diff --git a/src/profiling/test/ProfilingTests.hpp b/src/profiling/test/ProfilingTests.hpp index a8ca1b9b18..fd8ad315f1 100644 --- a/src/profiling/test/ProfilingTests.hpp +++ b/src/profiling/test/ProfilingTests.hpp @@ -21,10 +21,10 @@ #include <chrono> #include <thread> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { struct LogLevelSwapper @@ -79,7 +79,7 @@ public: bool WritePacket(const unsigned char* buffer, uint32_t length) override { - IgnoreUnused(buffer, length); + armnn::IgnoreUnused(buffer, length); return false; } @@ -141,7 +141,7 @@ public: arm::pipe::Packet ReadPacket(uint32_t timeout) override { - IgnoreUnused(timeout); + armnn::IgnoreUnused(timeout); ++m_ReadRequests; throw armnn::Exception("Simulate a non-timeout error"); } @@ -160,7 +160,7 @@ class TestProfilingConnectionBadAckPacket : public TestProfilingConnectionBase public: arm::pipe::Packet ReadPacket(uint32_t timeout) override { - IgnoreUnused(timeout); + armnn::IgnoreUnused(timeout); // Connection Acknowledged Packet header (word 0, word 1 is always zero): // 26:31 [6] packet_family: Control Packet Family, value 0b000000 // 16:25 [10] packet_id: Packet identifier, value 0b0000000001 @@ -183,7 +183,7 @@ public: void operator()(const arm::pipe::Packet& packet) override { - IgnoreUnused(packet); + armnn::IgnoreUnused(packet); m_Count++; } @@ -206,7 +206,7 @@ class SwapProfilingConnectionFactoryHelper : public ProfilingService public: using MockProfilingConnectionFactoryPtr = std::unique_ptr<MockProfilingConnectionFactory>; - SwapProfilingConnectionFactoryHelper(armnn::profiling::ProfilingService& profilingService) + SwapProfilingConnectionFactoryHelper(ProfilingService& profilingService) : ProfilingService() , m_ProfilingService(profilingService) , m_MockProfilingConnectionFactory(new MockProfilingConnectionFactory()) @@ -231,7 +231,7 @@ public: MockProfilingConnection* GetMockProfilingConnection() { IProfilingConnection* profilingConnection = GetProfilingConnection(m_ProfilingService); - return PolymorphicDowncast<MockProfilingConnection*>(profilingConnection); + return armnn::PolymorphicDowncast<MockProfilingConnection*>(profilingConnection); } void ForceTransitionToState(ProfilingState newState) @@ -272,11 +272,11 @@ public: } private: - armnn::profiling::ProfilingService& m_ProfilingService; + ProfilingService& m_ProfilingService; MockProfilingConnectionFactoryPtr m_MockProfilingConnectionFactory; IProfilingConnectionFactory* m_BackupProfilingConnectionFactory; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/RequestCountersPacketHandler.cpp b/src/profiling/test/RequestCountersPacketHandler.cpp index 3ba50503a1..fb3eee8f20 100644 --- a/src/profiling/test/RequestCountersPacketHandler.cpp +++ b/src/profiling/test/RequestCountersPacketHandler.cpp @@ -12,10 +12,10 @@ #include <common/include/PacketVersionResolver.hpp> #include <common/include/ProfilingException.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::vector<uint32_t> RequestCountersPacketHandler::GetHeadersAccepted() @@ -75,6 +75,6 @@ void RequestCountersPacketHandler::SendCounterSelectionPacket() m_Connection->ReturnPacket(packet); } -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/RequestCountersPacketHandler.hpp b/src/profiling/test/RequestCountersPacketHandler.hpp index 82bd313b85..7068a4f253 100644 --- a/src/profiling/test/RequestCountersPacketHandler.hpp +++ b/src/profiling/test/RequestCountersPacketHandler.hpp @@ -11,10 +11,10 @@ #include <common/include/Packet.hpp> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class RequestCountersPacketHandler : public ILocalPacketHandler @@ -43,6 +43,6 @@ private: void SendCounterSelectionPacket(); }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp index 675d083644..1380b42d37 100644 --- a/src/profiling/test/SendCounterPacketTests.cpp +++ b/src/profiling/test/SendCounterPacketTests.cpp @@ -26,7 +26,7 @@ #include <chrono> -using namespace armnn::profiling; +using namespace arm::pipe; namespace { @@ -294,7 +294,7 @@ TEST_CASE("SendStreamMetaDataPacketTest") // Error no space left in buffer MockBufferManager mockBuffer1(10); SendCounterPacket sendPacket1(mockBuffer1); - CHECK_THROWS_AS(sendPacket1.SendStreamMetaDataPacket(), armnn::profiling::BufferExhaustion); + CHECK_THROWS_AS(sendPacket1.SendStreamMetaDataPacket(), BufferExhaustion); // Full metadata packet @@ -1180,7 +1180,7 @@ TEST_CASE("SendCounterDirectoryPacketTest1") MockBufferManager mockBuffer(10); SendCounterPacket sendCounterPacket(mockBuffer); CHECK_THROWS_AS(sendCounterPacket.SendCounterDirectoryPacket(counterDirectory), - armnn::profiling::BufferExhaustion); + BufferExhaustion); } TEST_CASE("SendCounterDirectoryPacketTest2") @@ -1228,49 +1228,49 @@ TEST_CASE("SendCounterDirectoryPacketTest2") // Register a counter associated to "category1" const Counter* counter1 = nullptr; CHECK_NOTHROW(counter1 = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 0, - category1Name, - 0, - 1, - 123.45f, - "counter1", - "counter1description", - std::string("counter1units"), - numberOfCores)); + 0, + category1Name, + 0, + 1, + 123.45f, + "counter1", + "counter1description", + std::string("counter1units"), + numberOfCores)); CHECK(counterDirectory.GetCounterCount() == 4); CHECK(counter1); // Register a counter associated to "category1" const Counter* counter2 = nullptr; CHECK_NOTHROW(counter2 = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 4, - category1Name, - 1, - 0, - 330.1245656765f, - "counter2", - "counter2description", - std::string("counter2units"), - armnn::EmptyOptional(), - device2->m_Uid, - 0)); + 4, + category1Name, + 1, + 0, + 330.1245656765f, + "counter2", + "counter2description", + std::string("counter2units"), + armnn::EmptyOptional(), + device2->m_Uid, + 0)); CHECK(counterDirectory.GetCounterCount() == 5); CHECK(counter2); // Register a counter associated to "category2" const Counter* counter3 = nullptr; CHECK_NOTHROW(counter3 = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 5, - category2Name, - 1, - 1, - 0.0000045399f, - "counter3", - "counter3description", - armnn::EmptyOptional(), - numberOfCores, - device2->m_Uid, - counterSet1->m_Uid)); + 5, + category2Name, + 1, + 1, + 0.0000045399f, + "counter3", + "counter3description", + armnn::EmptyOptional(), + numberOfCores, + device2->m_Uid, + counterSet1->m_Uid)); CHECK(counterDirectory.GetCounterCount() == 9); CHECK(counter3); @@ -1773,17 +1773,17 @@ TEST_CASE("SendCounterDirectoryPacketTest7") // Register an invalid counter associated to a valid category const Counter* counter = nullptr; CHECK_NOTHROW(counter = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, - 0, - categoryName, - 0, - 1, - 123.45f, - "counter", - "counter description", - std::string("invalid counter units"), - 5, - device->m_Uid, - counterSet->m_Uid)); + 0, + categoryName, + 0, + 1, + 123.45f, + "counter", + "counter description", + std::string("invalid counter units"), + 5, + device->m_Uid, + counterSet->m_Uid)); CHECK(counterDirectory.GetCounterCount() == 5); CHECK(counter); diff --git a/src/profiling/test/SendCounterPacketTests.hpp b/src/profiling/test/SendCounterPacketTests.hpp index 2eac395ecf..4dec67d335 100644 --- a/src/profiling/test/SendCounterPacketTests.hpp +++ b/src/profiling/test/SendCounterPacketTests.hpp @@ -22,10 +22,10 @@ #include <mutex> #include <thread> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { class SendCounterPacketTest : public SendCounterPacket @@ -65,6 +65,6 @@ public: } }; -} // namespace profiling +} // namespace pipe -} // namespace armnn +} // namespace arm diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp index a2076b87c5..4e32149e44 100644 --- a/src/profiling/test/SendTimelinePacketTests.cpp +++ b/src/profiling/test/SendTimelinePacketTests.cpp @@ -21,7 +21,7 @@ #include <functional> #include <Runtime.hpp> -using namespace armnn::profiling; +using namespace arm::pipe; TEST_SUITE("SendTimelinePacketTests") { @@ -421,7 +421,7 @@ TEST_CASE("SendTimelinePacketTests3") const uint64_t eventClassBinaryPacketNameGuid = 8845u; CHECK_THROWS_AS(sendTimelinePacket->SendTimelineEventClassBinaryPacket( eventClassBinaryPacketProfilingGuid, eventClassBinaryPacketNameGuid), - armnn::profiling::BufferExhaustion); + BufferExhaustion); } TEST_CASE("GetGuidsFromProfilingService") @@ -429,7 +429,7 @@ TEST_CASE("GetGuidsFromProfilingService") armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; armnn::RuntimeImpl runtime(options); - armnn::profiling::ProfilingService profilingService(runtime); + ProfilingService profilingService(runtime); profilingService.ResetExternalProfilingOptions( ConvertExternalProfilingOptions(options.m_ProfilingOptions), true); @@ -450,7 +450,7 @@ TEST_CASE("GetTimelinePackerWriterFromProfilingService") { ProfilingOptions options; options.m_EnableProfiling = true; - armnn::profiling::ProfilingService profilingService; + ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); std::unique_ptr<ISendTimelinePacket> writer = profilingService.GetSendTimelinePacket(); diff --git a/src/profiling/test/TestTimelinePacketHandler.cpp b/src/profiling/test/TestTimelinePacketHandler.cpp index a2b5286728..d38c1751cb 100644 --- a/src/profiling/test/TestTimelinePacketHandler.cpp +++ b/src/profiling/test/TestTimelinePacketHandler.cpp @@ -11,10 +11,10 @@ #include <chrono> #include <iostream> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { std::vector<uint32_t> TestTimelinePacketHandler::GetHeadersAccepted() @@ -125,7 +125,7 @@ arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateRelati m_TimelineModel.IsInferenceGuid(relationship.m_HeadGuid)) { ProfilingStaticGuid attributeGuid(relationship.m_AttributeGuid); - if (attributeGuid == armnn::profiling::LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS) + if (attributeGuid == LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS) { if (m_PacketHandler != nullptr) { @@ -136,6 +136,6 @@ arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateRelati return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success; } -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/TestTimelinePacketHandler.hpp b/src/profiling/test/TestTimelinePacketHandler.hpp index ab6eee5121..7166707e80 100644 --- a/src/profiling/test/TestTimelinePacketHandler.hpp +++ b/src/profiling/test/TestTimelinePacketHandler.hpp @@ -20,10 +20,10 @@ #include <mutex> #include <vector> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { // forward declaration of class @@ -87,6 +87,6 @@ private: arm::pipe::TimelineDirectoryCaptureCommandHandler m_DirectoryDecoder; }; -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/TimelineModel.cpp b/src/profiling/test/TimelineModel.cpp index a80ad11e24..24ced44942 100644 --- a/src/profiling/test/TimelineModel.cpp +++ b/src/profiling/test/TimelineModel.cpp @@ -9,10 +9,10 @@ #include <algorithm> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { void TimelineModel::AddLabel(const arm::pipe::ITimelineDecoder::Label& label) @@ -58,20 +58,20 @@ void TimelineModel::AddRelationship(const arm::pipe::ITimelineDecoder::Relations { HandleLabelLink(relationship); } - else if (relationship.m_RelationshipType == arm::pipe::ITimelineDecoder::RelationshipType::RetentionLink) + else if (relationship.m_RelationshipType == 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 // of connection - if (relationship.m_AttributeGuid == armnn::profiling::LabelsAndEventClasses::CONNECTION_GUID) + if (relationship.m_AttributeGuid == LabelsAndEventClasses::CONNECTION_GUID) { HandleConnection(relationship); } - else if (relationship.m_AttributeGuid == armnn::profiling::LabelsAndEventClasses::CHILD_GUID) + else if (relationship.m_AttributeGuid == LabelsAndEventClasses::CHILD_GUID) { HandleChild(relationship); } - else if (relationship.m_AttributeGuid == armnn::profiling::LabelsAndEventClasses::EXECUTION_OF_GUID) + else if (relationship.m_AttributeGuid == LabelsAndEventClasses::EXECUTION_OF_GUID) { HandleExecutionOf(relationship); } @@ -128,8 +128,8 @@ void TimelineModel::HandleLabelLink(const arm::pipe::ITimelineDecoder::Relations entity->AddAttribute(*attribute, *value); // if the attribute is 'type' and the value is 'inference' // we need to cache the entity guid as an inference - if (armnn::profiling::LabelsAndEventClasses::TYPE_LABEL.compare(*attribute) == 0 && - armnn::profiling::LabelsAndEventClasses::INFERENCE.compare(*value) == 0) + if (LabelsAndEventClasses::TYPE_LABEL.compare(*attribute) == 0 && + LabelsAndEventClasses::INFERENCE.compare(*value) == 0) { m_InferenceGuids.push_back(relationship.m_HeadGuid); } @@ -360,7 +360,7 @@ std::string GetEntityDescription(const Entity& entity) ss << "Entity [" << entity.GetGuid() << "]"; for (auto& attributeEntry : entity.GetAttributes()) { - if (profiling::LabelsAndEventClasses::PROCESS_ID_LABEL == attributeEntry.second.first) + if (LabelsAndEventClasses::PROCESS_ID_LABEL == attributeEntry.second.first) { ss << " " << attributeEntry.second.first << " = [processId]"; } @@ -400,6 +400,6 @@ std::string GetEventDescription(EventObj* event) return ss.str(); } -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/TimelineModel.hpp b/src/profiling/test/TimelineModel.hpp index ccbec7b01d..7628f8c042 100644 --- a/src/profiling/test/TimelineModel.hpp +++ b/src/profiling/test/TimelineModel.hpp @@ -12,10 +12,10 @@ #include <sstream> #include <vector> -namespace armnn +namespace arm { -namespace profiling +namespace pipe { using LabelMap = std::map<uint64_t, arm::pipe::ITimelineDecoder::Label>; using Attribute = std::pair<std::string, std::string>; @@ -184,6 +184,6 @@ std::string GetConnectionDescription(const Connection& connection); std::string GetExecutionDescription(Entity* execution); std::string GetEventDescription(EventObj* event); -} // namespace profiling +} // namespace pipe -} // namespace armnn
\ No newline at end of file +} // namespace arm
\ No newline at end of file diff --git a/src/profiling/test/TimelinePacketTests.cpp b/src/profiling/test/TimelinePacketTests.cpp index 379988a9dc..de791c1da0 100644 --- a/src/profiling/test/TimelinePacketTests.cpp +++ b/src/profiling/test/TimelinePacketTests.cpp @@ -12,7 +12,7 @@ #include <doctest/doctest.h> -using namespace armnn::profiling; +using namespace arm::pipe; TEST_SUITE("TimelinePacketTests") { @@ -204,7 +204,7 @@ TEST_CASE("TimelineRelationshipPacketInvalidRelationTest") buffer.data(), armnn::numeric_cast<unsigned int>(buffer.size()), numberOfBytesWritten), - armnn::InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK(numberOfBytesWritten == 0); } @@ -527,7 +527,7 @@ TEST_CASE("TimelineMessageDirectoryPacketTestFullConstruction") // Check the ui_name std::vector<uint32_t> swTraceString; - arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString); + StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; uint32_t swTraceUINameLength = ReadUint32(buffer.data(), offset); CHECK(swTraceUINameLength == 14); // ui_name length including the null-terminator @@ -539,7 +539,7 @@ TEST_CASE("TimelineMessageDirectoryPacketTestFullConstruction") swTraceUINameLength - 1) == 0); // The length of the label // Check arg_types - arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString); + StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; uint32_t swTraceArgTypesLength = ReadUint32(buffer.data(), offset); CHECK(swTraceArgTypesLength == 3); // arg_types length including the null-terminator @@ -551,7 +551,7 @@ TEST_CASE("TimelineMessageDirectoryPacketTestFullConstruction") swTraceArgTypesLength - 1) == 0); // The length of the label // Check arg_names - arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString); + StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; uint32_t swTraceArgNamesLength = ReadUint32(buffer.data(), offset); CHECK(swTraceArgNamesLength == 11); // arg_names length including the null-terminator @@ -563,7 +563,7 @@ TEST_CASE("TimelineMessageDirectoryPacketTestFullConstruction") swTraceArgNamesLength - 1) == 0); // The length of the label // Check second message decl_id - arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString); + StringToSwTraceString<SwTraceCharPolicy>(label, swTraceString); offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size; readDeclId = ReadUint32(buffer.data(), offset); CHECK(readDeclId == 1); diff --git a/src/profiling/test/TimelineUtilityMethodsTests.cpp b/src/profiling/test/TimelineUtilityMethodsTests.cpp index 47e1182a3d..b0b7bff517 100644 --- a/src/profiling/test/TimelineUtilityMethodsTests.cpp +++ b/src/profiling/test/TimelineUtilityMethodsTests.cpp @@ -17,7 +17,7 @@ #include <doctest/doctest.h> using namespace armnn; -using namespace armnn::profiling; +using namespace arm::pipe; TEST_SUITE("TimelineUtilityMethodsTests") { @@ -214,20 +214,20 @@ TEST_CASE("CreateNamedTypedChildEntityTest") profilingService.NextGuid(); CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedChildEntity(parentEntityGuid, "", entityType), - InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedChildEntity(parentEntityGuid, entityName, ""), - InvalidArgumentException); + arm::pipe::InvalidArgumentException); CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedChildEntity( - childEntityGuid, parentEntityGuid, "", entityType), InvalidArgumentException); + childEntityGuid, parentEntityGuid, "", entityType), arm::pipe::InvalidArgumentException); CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedChildEntity( - childEntityGuid, parentEntityGuid, entityName, ""), InvalidArgumentException); + childEntityGuid, parentEntityGuid, entityName, ""), arm::pipe::InvalidArgumentException); CHECK_NOTHROW(childEntityGuid = timelineUtilityMethods.CreateNamedTypedChildEntity(parentEntityGuid, entityName, entityType)); CHECK(childEntityGuid != ProfilingGuid(0)); - // Commit all packets at once + // Commit all packets at onceTimelineUtilityMethodsTests.cpp timelineUtilityMethods.Commit(); // Get the readable buffer @@ -296,7 +296,7 @@ TEST_CASE("DeclareLabelTest") profilingService.NextGuid(); // Try declaring an invalid (empty) label - CHECK_THROWS_AS(timelineUtilityMethods.DeclareLabel(""), InvalidArgumentException); + CHECK_THROWS_AS(timelineUtilityMethods.DeclareLabel(""), arm::pipe::InvalidArgumentException); // Try declaring an invalid (wrong SWTrace format) label CHECK_THROWS_AS(timelineUtilityMethods.DeclareLabel("inv@lid lab€l"), RuntimeException); @@ -322,20 +322,20 @@ TEST_CASE("CreateNameTypeEntityInvalidTest") TimelineUtilityMethods timelineUtilityMethods(sendTimelinePacket); // Invalid name - CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity("", "Type"), InvalidArgumentException); + CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity("", "Type"), arm::pipe::InvalidArgumentException); // Invalid type - CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity("Name", ""), InvalidArgumentException); + CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity("Name", ""), arm::pipe::InvalidArgumentException); ProfilingDynamicGuid guid = profilingService.NextGuid(); // CreatedNamedTypedEntity with Guid - Invalid name CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity(guid, "", "Type"), - InvalidArgumentException); + arm::pipe::InvalidArgumentException); // CreatedNamedTypedEntity with Guid - Invalid type CHECK_THROWS_AS(timelineUtilityMethods.CreateNamedTypedEntity(guid, "Name", ""), - InvalidArgumentException); + arm::pipe::InvalidArgumentException); } |