From 6730fe9cbc195f054d697b25daba8516d70658e0 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Thu, 10 Mar 2022 22:57:47 +0000 Subject: IVGCVSW-6842 Replace ARMNN_ASSERT with ARM_PIPE_ASSERT in profiling code Change-Id: Ie982ae603b7fb2793baf921232d32ce43f46d444 Signed-off-by: Jim Flynn --- src/profiling/CommandHandler.cpp | 2 +- src/profiling/CounterDirectory.cpp | 59 ++++++++++++++------------- src/profiling/FileOnlyProfilingConnection.cpp | 2 +- src/profiling/ProfilingService.cpp | 18 ++++---- src/profiling/ProfilingService.hpp | 4 +- src/profiling/ProfilingUtils.cpp | 22 +++++----- src/profiling/SendCounterPacket.cpp | 26 ++++++------ src/profiling/SendTimelinePacket.hpp | 4 +- src/profiling/test/ProfilingMocks.hpp | 24 +++++------ src/profiling/test/ProfilingTestUtils.cpp | 14 +++---- src/profiling/test/SendCounterPacketTests.cpp | 25 ++++++------ src/profiling/test/SendCounterPacketTests.hpp | 1 - 12 files changed, 100 insertions(+), 101 deletions(-) diff --git a/src/profiling/CommandHandler.cpp b/src/profiling/CommandHandler.cpp index 0cacf22536..ff7b5a5e76 100644 --- a/src/profiling/CommandHandler.cpp +++ b/src/profiling/CommandHandler.cpp @@ -62,7 +62,7 @@ void CommandHandler::HandleCommands(IProfilingConnection& profilingConnection) m_CommandHandlerRegistry.GetFunctor(packet.GetPacketFamily(), packet.GetPacketId(), version.GetEncodedValue()); - ARMNN_ASSERT(commandHandlerFunctor); + ARM_PIPE_ASSERT(commandHandlerFunctor); commandHandlerFunctor->operator()(packet); } catch (const arm::pipe::TimeoutException&) diff --git a/src/profiling/CounterDirectory.cpp b/src/profiling/CounterDirectory.cpp index 11dc3803dd..87706996ad 100644 --- a/src/profiling/CounterDirectory.cpp +++ b/src/profiling/CounterDirectory.cpp @@ -7,8 +7,8 @@ #include "ProfilingUtils.hpp" #include -#include +#include #include #include @@ -38,11 +38,11 @@ const Category* CounterDirectory::RegisterCategory(const std::string& categoryNa // Create the category CategoryPtr category = std::make_unique(categoryName); - ARMNN_ASSERT(category); + ARM_PIPE_ASSERT(category); // Get the raw category pointer const Category* categoryPtr = category.get(); - ARMNN_ASSERT(categoryPtr); + ARM_PIPE_ASSERT(categoryPtr); // Register the category m_Categories.insert(std::move(category)); @@ -100,11 +100,11 @@ const Device* CounterDirectory::RegisterDevice(const std::string& deviceName, // Create the device DevicePtr device = std::make_unique(deviceUid, deviceName, cores); - ARMNN_ASSERT(device); + ARM_PIPE_ASSERT(device); // Get the raw device pointer const Device* devicePtr = device.get(); - ARMNN_ASSERT(devicePtr); + ARM_PIPE_ASSERT(devicePtr); // Register the device m_Devices.insert(std::make_pair(deviceUid, std::move(device))); @@ -162,15 +162,15 @@ const CounterSet* CounterDirectory::RegisterCounterSet(const std::string& counte // Get the counter set UID uint16_t counterSetUid = GetNextUid(); - ARMNN_ASSERT(counterSetUid == counterSetUidPeek); + ARM_PIPE_ASSERT(counterSetUid == counterSetUidPeek); // Create the counter set CounterSetPtr counterSet = std::make_unique(counterSetUid, counterSetName, count); - ARMNN_ASSERT(counterSet); + ARM_PIPE_ASSERT(counterSet); // Get the raw counter set pointer const CounterSet* counterSetPtr = counterSet.get(); - ARMNN_ASSERT(counterSetPtr); + ARM_PIPE_ASSERT(counterSetPtr); // Register the counter set m_CounterSets.insert(std::make_pair(counterSetUid, std::move(counterSet))); @@ -248,14 +248,14 @@ const Counter* CounterDirectory::RegisterCounter(const std::string& /*backendId* // Get the parent category const CategoryPtr& parentCategory = *categoryIt; - ARMNN_ASSERT(parentCategory); + ARM_PIPE_ASSERT(parentCategory); // Check that a counter with the given name is not already registered within the parent category const std::vector& parentCategoryCounters = parentCategory->m_Counters; for (uint16_t parentCategoryCounterUid : parentCategoryCounters) { const Counter* parentCategoryCounter = GetCounter(parentCategoryCounterUid); - ARMNN_ASSERT(parentCategoryCounter); + ARM_PIPE_ASSERT(parentCategoryCounter); if (parentCategoryCounter->m_Name == name) { @@ -287,7 +287,7 @@ const Counter* CounterDirectory::RegisterCounter(const std::string& /*backendId* // Get the counter UIDs and calculate the max counter UID std::vector counterUids = GetNextCounterUids(uid, deviceCores); - ARMNN_ASSERT(!counterUids.empty()); + ARM_PIPE_ASSERT(!counterUids.empty()); uint16_t maxCounterUid = deviceCores <= 1 ? counterUids.front() : counterUids.back(); // Get the counter units @@ -305,11 +305,11 @@ const Counter* CounterDirectory::RegisterCounter(const std::string& /*backendId* unitsValue, deviceUidValue, counterSetUidValue); - ARMNN_ASSERT(counter); + ARM_PIPE_ASSERT(counter); // Get the raw counter pointer const Counter* counterPtr = counter.get(); - ARMNN_ASSERT(counterPtr); + ARM_PIPE_ASSERT(counterPtr); // Process multiple counters if necessary for (uint16_t counterUid : counterUids) @@ -333,7 +333,7 @@ const Category* CounterDirectory::GetCategory(const std::string& categoryName) c } const Category* category = it->get(); - ARMNN_ASSERT(category); + ARM_PIPE_ASSERT(category); return category; } @@ -347,8 +347,8 @@ const Device* CounterDirectory::GetDevice(uint16_t deviceUid) const } const Device* device = it->second.get(); - ARMNN_ASSERT(device); - ARMNN_ASSERT(device->m_Uid == deviceUid); + ARM_PIPE_ASSERT(device); + ARM_PIPE_ASSERT(device->m_Uid == deviceUid); return device; } @@ -362,8 +362,8 @@ const CounterSet* CounterDirectory::GetCounterSet(uint16_t counterSetUid) const } const CounterSet* counterSet = it->second.get(); - ARMNN_ASSERT(counterSet); - ARMNN_ASSERT(counterSet->m_Uid == counterSetUid); + ARM_PIPE_ASSERT(counterSet); + ARM_PIPE_ASSERT(counterSet->m_Uid == counterSetUid); return counterSet; } @@ -377,9 +377,9 @@ const Counter* CounterDirectory::GetCounter(uint16_t counterUid) const } const Counter* counter = it->second.get(); - ARMNN_ASSERT(counter); - ARMNN_ASSERT(counter->m_Uid <= counterUid); - ARMNN_ASSERT(counter->m_Uid <= counter->m_MaxCounterUid); + ARM_PIPE_ASSERT(counter); + ARM_PIPE_ASSERT(counter->m_Uid <= counterUid); + ARM_PIPE_ASSERT(counter->m_Uid <= counter->m_MaxCounterUid); return counter; } @@ -446,7 +446,7 @@ CategoriesIt CounterDirectory::FindCategory(const std::string& categoryName) con { return std::find_if(m_Categories.begin(), m_Categories.end(), [&categoryName](const CategoryPtr& category) { - ARMNN_ASSERT(category); + ARM_PIPE_ASSERT(category); return category->m_Name == categoryName; }); @@ -461,8 +461,8 @@ DevicesIt CounterDirectory::FindDevice(const std::string& deviceName) const { return std::find_if(m_Devices.begin(), m_Devices.end(), [&deviceName](const auto& pair) { - ARMNN_ASSERT(pair.second); - ARMNN_ASSERT(pair.second->m_Uid == pair.first); + ARM_PIPE_ASSERT(pair.second); + ARM_PIPE_ASSERT(pair.second->m_Uid == pair.first); return pair.second->m_Name == deviceName; }); @@ -477,8 +477,8 @@ CounterSetsIt CounterDirectory::FindCounterSet(const std::string& counterSetName { return std::find_if(m_CounterSets.begin(), m_CounterSets.end(), [&counterSetName](const auto& pair) { - ARMNN_ASSERT(pair.second); - ARMNN_ASSERT(pair.second->m_Uid == pair.first); + ARM_PIPE_ASSERT(pair.second); + ARM_PIPE_ASSERT(pair.second->m_Uid == pair.first); return pair.second->m_Name == counterSetName; }); @@ -493,8 +493,8 @@ CountersIt CounterDirectory::FindCounter(const std::string& counterName) const { return std::find_if(m_Counters.begin(), m_Counters.end(), [&counterName](const auto& pair) { - ARMNN_ASSERT(pair.second); - ARMNN_ASSERT(pair.first >= pair.second->m_Uid && pair.first <= pair.second->m_MaxCounterUid); + ARM_PIPE_ASSERT(pair.second); + ARM_PIPE_ASSERT(pair.first >= pair.second->m_Uid && pair.first <= pair.second->m_MaxCounterUid); return pair.second->m_Name == counterName; }); @@ -532,7 +532,8 @@ uint16_t CounterDirectory::GetNumberOfCores(const armnn::Optional& num // Get the associated device const DevicePtr& device = deviceIt->second; - ARMNN_ASSERT(device); + ARM_PIPE_ASSERT(device); + // Get the number of cores of the associated device return device->m_Cores; diff --git a/src/profiling/FileOnlyProfilingConnection.cpp b/src/profiling/FileOnlyProfilingConnection.cpp index 23bb4857a6..bee2c62de0 100644 --- a/src/profiling/FileOnlyProfilingConnection.cpp +++ b/src/profiling/FileOnlyProfilingConnection.cpp @@ -107,7 +107,7 @@ void FileOnlyProfilingConnection::Close() bool FileOnlyProfilingConnection::WritePacket(const unsigned char* buffer, uint32_t length) { - ARMNN_ASSERT(buffer); + ARM_PIPE_ASSERT(buffer); arm::pipe::Packet packet = ReceivePacket(buffer, length); ForwardPacketToHandlers(packet); return true; diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp index f0d668cc32..677158e64c 100644 --- a/src/profiling/ProfilingService.cpp +++ b/src/profiling/ProfilingService.cpp @@ -126,7 +126,7 @@ void ProfilingService::Update() try { // Setup the profiling connection - ARMNN_ASSERT(m_ProfilingConnectionFactory); + ARM_PIPE_ASSERT(m_ProfilingConnectionFactory); m_ProfilingConnection = m_ProfilingConnectionFactory->GetProfilingConnection(m_Options); } catch (const arm::pipe::ProfilingException& e) @@ -147,7 +147,7 @@ void ProfilingService::Update() // "NotConnected" state break; case ProfilingState::WaitingForAck: - ARMNN_ASSERT(m_ProfilingConnection); + ARM_PIPE_ASSERT(m_ProfilingConnection); // Start the command thread m_CommandHandler.Start(*m_ProfilingConnection); @@ -196,7 +196,7 @@ void ProfilingService::Disconnect() void ProfilingService::AddBackendProfilingContext(const std::string& backendId, std::shared_ptr profilingContext) { - ARMNN_ASSERT(profilingContext != nullptr); + ARM_PIPE_ASSERT(profilingContext != nullptr); // Register the backend counters m_MaxGlobalCounterId = profilingContext->RegisterCounters(m_MaxGlobalCounterId); m_BackendProfilingContexts.emplace(backendId, std::move(profilingContext)); @@ -230,7 +230,7 @@ uint32_t ProfilingService::GetAbsoluteCounterValue(uint16_t counterUid) const { CheckCounterUid(counterUid); std::atomic* counterValuePtr = m_CounterIndex.at(counterUid); - ARMNN_ASSERT(counterValuePtr); + ARM_PIPE_ASSERT(counterValuePtr); return counterValuePtr->load(std::memory_order::memory_order_relaxed); } @@ -238,7 +238,7 @@ uint32_t ProfilingService::GetDeltaCounterValue(uint16_t counterUid) { CheckCounterUid(counterUid); std::atomic* counterValuePtr = m_CounterIndex.at(counterUid); - ARMNN_ASSERT(counterValuePtr); + ARM_PIPE_ASSERT(counterValuePtr); const uint32_t counterValue = counterValuePtr->load(std::memory_order::memory_order_relaxed); SubtractCounterValue(counterUid, counterValue); return counterValue; @@ -280,7 +280,7 @@ void ProfilingService::SetCounterValue(uint16_t counterUid, uint32_t value) { CheckCounterUid(counterUid); std::atomic* counterValuePtr = m_CounterIndex.at(counterUid); - ARMNN_ASSERT(counterValuePtr); + ARM_PIPE_ASSERT(counterValuePtr); counterValuePtr->store(value, std::memory_order::memory_order_relaxed); } @@ -288,7 +288,7 @@ uint32_t ProfilingService::AddCounterValue(uint16_t counterUid, uint32_t value) { CheckCounterUid(counterUid); std::atomic* counterValuePtr = m_CounterIndex.at(counterUid); - ARMNN_ASSERT(counterValuePtr); + ARM_PIPE_ASSERT(counterValuePtr); return counterValuePtr->fetch_add(value, std::memory_order::memory_order_relaxed); } @@ -296,7 +296,7 @@ uint32_t ProfilingService::SubtractCounterValue(uint16_t counterUid, uint32_t va { CheckCounterUid(counterUid); std::atomic* counterValuePtr = m_CounterIndex.at(counterUid); - ARMNN_ASSERT(counterValuePtr); + ARM_PIPE_ASSERT(counterValuePtr); return counterValuePtr->fetch_sub(value, std::memory_order::memory_order_relaxed); } @@ -304,7 +304,7 @@ uint32_t ProfilingService::IncrementCounterValue(uint16_t counterUid) { CheckCounterUid(counterUid); std::atomic* counterValuePtr = m_CounterIndex.at(counterUid); - ARMNN_ASSERT(counterValuePtr); + ARM_PIPE_ASSERT(counterValuePtr); return counterValuePtr->operator++(std::memory_order::memory_order_relaxed); } diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp index efad871c8c..e0083dc9a8 100644 --- a/src/profiling/ProfilingService.hpp +++ b/src/profiling/ProfilingService.hpp @@ -271,8 +271,8 @@ protected: IProfilingConnectionFactory* other, IProfilingConnectionFactory*& backup) { - ARMNN_ASSERT(instance.m_ProfilingConnectionFactory); - ARMNN_ASSERT(other); + ARM_PIPE_ASSERT(instance.m_ProfilingConnectionFactory); + ARM_PIPE_ASSERT(other); backup = instance.m_ProfilingConnectionFactory.release(); instance.m_ProfilingConnectionFactory.reset(other); diff --git a/src/profiling/ProfilingUtils.cpp b/src/profiling/ProfilingUtils.cpp index 993585a566..22388f43bf 100644 --- a/src/profiling/ProfilingUtils.cpp +++ b/src/profiling/ProfilingUtils.cpp @@ -5,6 +5,7 @@ #include "ProfilingUtils.hpp" +#include #include #include #include @@ -13,7 +14,6 @@ #include -#include #include @@ -94,7 +94,7 @@ std::vector GetNextCounterUids(uint16_t firstUid, uint16_t cores) void WriteBytes(const IPacketBufferPtr& packetBuffer, unsigned int offset, const void* value, unsigned int valueSize) { - ARMNN_ASSERT(packetBuffer); + ARM_PIPE_ASSERT(packetBuffer); WriteBytes(packetBuffer->GetWritableData(), offset, value, valueSize); } @@ -115,63 +115,63 @@ uint32_t ConstructHeader(uint32_t packetFamily, uint32_t packetClass, uint32_t p void WriteUint64(const std::unique_ptr& packetBuffer, unsigned int offset, uint64_t value) { - ARMNN_ASSERT(packetBuffer); + ARM_PIPE_ASSERT(packetBuffer); WriteUint64(packetBuffer->GetWritableData(), offset, value); } void WriteUint32(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint32_t value) { - ARMNN_ASSERT(packetBuffer); + ARM_PIPE_ASSERT(packetBuffer); WriteUint32(packetBuffer->GetWritableData(), offset, value); } void WriteUint16(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint16_t value) { - ARMNN_ASSERT(packetBuffer); + ARM_PIPE_ASSERT(packetBuffer); WriteUint16(packetBuffer->GetWritableData(), offset, value); } void WriteUint8(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint8_t value) { - ARMNN_ASSERT(packetBuffer); + ARM_PIPE_ASSERT(packetBuffer); WriteUint8(packetBuffer->GetWritableData(), offset, value); } void ReadBytes(const IPacketBufferPtr& packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[]) { - ARMNN_ASSERT(packetBuffer); + ARM_PIPE_ASSERT(packetBuffer); ReadBytes(packetBuffer->GetReadableData(), offset, valueSize, outValue); } uint64_t ReadUint64(const IPacketBufferPtr& packetBuffer, unsigned int offset) { - ARMNN_ASSERT(packetBuffer); + ARM_PIPE_ASSERT(packetBuffer); return ReadUint64(packetBuffer->GetReadableData(), offset); } uint32_t ReadUint32(const IPacketBufferPtr& packetBuffer, unsigned int offset) { - ARMNN_ASSERT(packetBuffer); + ARM_PIPE_ASSERT(packetBuffer); return ReadUint32(packetBuffer->GetReadableData(), offset); } uint16_t ReadUint16(const IPacketBufferPtr& packetBuffer, unsigned int offset) { - ARMNN_ASSERT(packetBuffer); + ARM_PIPE_ASSERT(packetBuffer); return ReadUint16(packetBuffer->GetReadableData(), offset); } uint8_t ReadUint8(const IPacketBufferPtr& packetBuffer, unsigned int offset) { - ARMNN_ASSERT(packetBuffer); + ARM_PIPE_ASSERT(packetBuffer); return ReadUint8(packetBuffer->GetReadableData(), offset); } diff --git a/src/profiling/SendCounterPacket.cpp b/src/profiling/SendCounterPacket.cpp index 3ac2272e5b..6a30c65936 100644 --- a/src/profiling/SendCounterPacket.cpp +++ b/src/profiling/SendCounterPacket.cpp @@ -5,6 +5,7 @@ #include "SendCounterPacket.hpp" +#include #include #include #include @@ -13,8 +14,7 @@ #include #include -#include -#include +#include #include @@ -177,10 +177,10 @@ bool SendCounterPacket::CreateCategoryRecord(const CategoryPtr& category, CategoryRecord& categoryRecord, std::string& errorMessage) { - ARMNN_ASSERT(category); + ARM_PIPE_ASSERT(category); const std::string& categoryName = category->m_Name; - ARMNN_ASSERT(!categoryName.empty()); + ARM_PIPE_ASSERT(!categoryName.empty()); // Remove any duplicate counters std::vector categoryCounters; @@ -299,13 +299,13 @@ bool SendCounterPacket::CreateDeviceRecord(const DevicePtr& device, DeviceRecord& deviceRecord, std::string& errorMessage) { - ARMNN_ASSERT(device); + ARM_PIPE_ASSERT(device); uint16_t deviceUid = device->m_Uid; const std::string& deviceName = device->m_Name; uint16_t deviceCores = device->m_Cores; - ARMNN_ASSERT(!deviceName.empty()); + ARM_PIPE_ASSERT(!deviceName.empty()); // Device record word 0: // 16:31 [16] uid: the unique identifier for the device @@ -349,13 +349,13 @@ bool SendCounterPacket::CreateCounterSetRecord(const CounterSetPtr& counterSet, CounterSetRecord& counterSetRecord, std::string& errorMessage) { - ARMNN_ASSERT(counterSet); + ARM_PIPE_ASSERT(counterSet); uint16_t counterSetUid = counterSet->m_Uid; const std::string& counterSetName = counterSet->m_Name; uint16_t counterSetCount = counterSet->m_Count; - ARMNN_ASSERT(!counterSetName.empty()); + ARM_PIPE_ASSERT(!counterSetName.empty()); // Counter set record word 0: // 16:31 [16] uid: the unique identifier for the counter_set @@ -399,7 +399,7 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter, EventRecord& eventRecord, std::string& errorMessage) { - ARMNN_ASSERT(counter); + ARM_PIPE_ASSERT(counter); uint16_t counterUid = counter->m_Uid; uint16_t maxCounterUid = counter->m_MaxCounterUid; @@ -412,9 +412,9 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter, const std::string& counterDescription = counter->m_Description; const std::string& counterUnits = counter->m_Units; - ARMNN_ASSERT(counterClass == 0 || counterClass == 1); - ARMNN_ASSERT(counterInterpolation == 0 || counterInterpolation == 1); - ARMNN_ASSERT(counterMultiplier); + ARM_PIPE_ASSERT(counterClass == 0 || counterClass == 1); + ARM_PIPE_ASSERT(counterInterpolation == 0 || counterInterpolation == 1); + ARM_PIPE_ASSERT(counterMultiplier); // Utils const size_t uint32_t_size = sizeof(uint32_t); @@ -453,7 +453,7 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter, // 0:63 [64] multiplier: internal data stream is represented as integer values, this allows scaling of // those values as if they are fixed point numbers. Zero is not a valid value uint32_t multiplier[2] = { 0u, 0u }; - ARMNN_ASSERT(sizeof(counterMultiplier) == sizeof(multiplier)); + ARM_PIPE_ASSERT(sizeof(counterMultiplier) == sizeof(multiplier)); std::memcpy(multiplier, &counterMultiplier, sizeof(multiplier)); const uint32_t eventRecordWord3 = multiplier[0]; const uint32_t eventRecordWord4 = multiplier[1]; diff --git a/src/profiling/SendTimelinePacket.hpp b/src/profiling/SendTimelinePacket.hpp index fe8c5d45e2..ca3022fc4f 100644 --- a/src/profiling/SendTimelinePacket.hpp +++ b/src/profiling/SendTimelinePacket.hpp @@ -9,7 +9,7 @@ #include "armnn/profiling/ISendTimelinePacket.hpp" #include "ProfilingUtils.hpp" -#include +#include #include @@ -80,7 +80,7 @@ void SendTimelinePacket::ForwardWriteBinaryFunction(Func& func, Params&& ... par try { ReserveBuffer(); - ARMNN_ASSERT(m_WriteBuffer); + ARM_PIPE_ASSERT(m_WriteBuffer); unsigned int numberOfBytesWritten = 0; // Header will be prepended to the buffer on Commit() while ( true ) diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp index 962912e995..4af2b6064e 100644 --- a/src/profiling/test/ProfilingMocks.hpp +++ b/src/profiling/test/ProfilingMocks.hpp @@ -15,8 +15,8 @@ #include #include -#include +#include #include #include #include @@ -452,11 +452,11 @@ public: { // Create the category CategoryPtr category = std::make_unique(categoryName); - ARMNN_ASSERT(category); + ARM_PIPE_ASSERT(category); // Get the raw category pointer const Category* categoryPtr = category.get(); - ARMNN_ASSERT(categoryPtr); + ARM_PIPE_ASSERT(categoryPtr); // Register the category m_Categories.insert(std::move(category)); @@ -472,11 +472,11 @@ public: // Create the device DevicePtr device = std::make_unique(deviceUid, deviceName, cores); - ARMNN_ASSERT(device); + ARM_PIPE_ASSERT(device); // Get the raw device pointer const Device* devicePtr = device.get(); - ARMNN_ASSERT(devicePtr); + ARM_PIPE_ASSERT(devicePtr); // Register the device m_Devices.insert(std::make_pair(deviceUid, std::move(device))); @@ -493,11 +493,11 @@ public: // Create the counter set CounterSetPtr counterSet = std::make_unique(counterSetUid, counterSetName, count); - ARMNN_ASSERT(counterSet); + ARM_PIPE_ASSERT(counterSet); // Get the raw counter set pointer const CounterSet* counterSetPtr = counterSet.get(); - ARMNN_ASSERT(counterSetPtr); + ARM_PIPE_ASSERT(counterSetPtr); // Register the counter set m_CounterSets.insert(std::make_pair(counterSetUid, std::move(counterSet))); @@ -531,7 +531,7 @@ public: // Get the counter UIDs and calculate the max counter UID std::vector counterUids = GetNextCounterUids(uid, deviceCores); - ARMNN_ASSERT(!counterUids.empty()); + ARM_PIPE_ASSERT(!counterUids.empty()); uint16_t maxCounterUid = deviceCores <= 1 ? counterUids.front() : counterUids.back(); // Get the counter units @@ -549,18 +549,18 @@ public: unitsValue, deviceUidValue, counterSetUidValue); - ARMNN_ASSERT(counter); + ARM_PIPE_ASSERT(counter); // Get the raw counter pointer const Counter* counterPtr = counter.get(); - ARMNN_ASSERT(counterPtr); + ARM_PIPE_ASSERT(counterPtr); // Process multiple counters if necessary for (uint16_t counterUid : counterUids) { // Connect the counter to the parent category Category* parentCategory = const_cast(GetCategory(parentCategoryName)); - ARMNN_ASSERT(parentCategory); + ARM_PIPE_ASSERT(parentCategory); parentCategory->m_Counters.push_back(counterUid); // Register the counter @@ -587,7 +587,7 @@ public: { auto it = std::find_if(m_Categories.begin(), m_Categories.end(), [&name](const CategoryPtr& category) { - ARMNN_ASSERT(category); + ARM_PIPE_ASSERT(category); return category->m_Name == name; }); diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp index ca322868fc..a6ec66da2f 100644 --- a/src/profiling/test/ProfilingTestUtils.cpp +++ b/src/profiling/test/ProfilingTestUtils.cpp @@ -10,12 +10,12 @@ #include #include -#include #include #include #include +#include #include #include @@ -78,7 +78,7 @@ void VerifyTimelineHeaderBinary(const unsigned char* readableData, unsigned int& offset, uint32_t packetDataLength) { - ARMNN_ASSERT(readableData); + ARM_PIPE_ASSERT(readableData); // Utils unsigned int uint32_t_size = sizeof(uint32_t); @@ -107,7 +107,7 @@ ProfilingGuid VerifyTimelineLabelBinaryPacketData(Optional guid, const unsigned char* readableData, unsigned int& offset) { - ARMNN_ASSERT(readableData); + ARM_PIPE_ASSERT(readableData); // Utils unsigned int uint32_t_size = sizeof(uint32_t); @@ -153,7 +153,7 @@ void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid, const unsigned char* readableData, unsigned int& offset) { - ARMNN_ASSERT(readableData); + ARM_PIPE_ASSERT(readableData); // Utils unsigned int uint32_t_size = sizeof(uint32_t); @@ -184,7 +184,7 @@ void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relati const unsigned char* readableData, unsigned int& offset) { - ARMNN_ASSERT(readableData); + ARM_PIPE_ASSERT(readableData); uint32_t relationshipTypeUint = 0; switch (relationshipType) @@ -274,7 +274,7 @@ ProfilingGuid VerifyTimelineEntityBinaryPacketData(Optional guid, const unsigned char* readableData, unsigned int& offset) { - ARMNN_ASSERT(readableData); + ARM_PIPE_ASSERT(readableData); // Utils unsigned int uint32_t_size = sizeof(uint32_t); @@ -310,7 +310,7 @@ ProfilingGuid VerifyTimelineEventBinaryPacket(Optional timestamp, const unsigned char* readableData, unsigned int& offset) { - ARMNN_ASSERT(readableData); + ARM_PIPE_ASSERT(readableData); // Utils unsigned int uint32_t_size = sizeof(uint32_t); diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp index 17931cc79b..e94687119d 100644 --- a/src/profiling/test/SendCounterPacketTests.cpp +++ b/src/profiling/test/SendCounterPacketTests.cpp @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -17,12 +16,12 @@ #include #include +#include #include +#include #include #include -#include - #include #include @@ -565,7 +564,7 @@ TEST_CASE("CreateEventRecordTest") counterUnits, deviceUid, counterSetUid); - ARMNN_ASSERT(counter); + ARM_PIPE_ASSERT(counter); // Create an event record SendCounterPacket::EventRecord eventRecord; @@ -691,7 +690,7 @@ TEST_CASE("CreateEventRecordNoUnitsTest") "", deviceUid, counterSetUid); - ARMNN_ASSERT(counter); + ARM_PIPE_ASSERT(counter); // Create an event record SendCounterPacket::EventRecord eventRecord; @@ -798,7 +797,7 @@ TEST_CASE("CreateInvalidEventRecordTest1") counterUnits, deviceUid, counterSetUid); - ARMNN_ASSERT(counter); + ARM_PIPE_ASSERT(counter); // Create an event record SendCounterPacket::EventRecord eventRecord; @@ -837,7 +836,7 @@ TEST_CASE("CreateInvalidEventRecordTest2") counterUnits, deviceUid, counterSetUid); - ARMNN_ASSERT(counter); + ARM_PIPE_ASSERT(counter); // Create an event record SendCounterPacket::EventRecord eventRecord; @@ -876,7 +875,7 @@ TEST_CASE("CreateInvalidEventRecordTest3") counterUnits, deviceUid, counterSetUid); - ARMNN_ASSERT(counter); + ARM_PIPE_ASSERT(counter); // Create an event record SendCounterPacket::EventRecord eventRecord; @@ -896,7 +895,7 @@ TEST_CASE("CreateCategoryRecordTest") // Create a category for testing const std::string categoryName = "some_category"; const CategoryPtr category = std::make_unique(categoryName); - ARMNN_ASSERT(category); + ARM_PIPE_ASSERT(category); category->m_Counters = { 11u, 23u, 5670u }; // Create a collection of counters @@ -940,10 +939,10 @@ TEST_CASE("CreateCategoryRecordTest") Counter* counter1 = counters.find(11)->second.get(); Counter* counter2 = counters.find(23)->second.get(); Counter* counter3 = counters.find(5670)->second.get(); - ARMNN_ASSERT(counter1); - ARMNN_ASSERT(counter2); - ARMNN_ASSERT(counter3); - uint16_t categoryEventCount = arm::pipe::numeric_cast(counters.size()); + ARM_PIPE_ASSERT(counter1); + ARM_PIPE_ASSERT(counter2); + ARM_PIPE_ASSERT(counter3); + uint16_t categoryEventCount = armnn::numeric_cast(counters.size()); // Create a category record SendCounterPacket::CategoryRecord categoryRecord; diff --git a/src/profiling/test/SendCounterPacketTests.hpp b/src/profiling/test/SendCounterPacketTests.hpp index 2584a65fdd..de731c8d7b 100644 --- a/src/profiling/test/SendCounterPacketTests.hpp +++ b/src/profiling/test/SendCounterPacketTests.hpp @@ -12,7 +12,6 @@ #include #include -#include #include #include -- cgit v1.2.1