aboutsummaryrefslogtreecommitdiff
path: root/src/profiling
diff options
context:
space:
mode:
Diffstat (limited to 'src/profiling')
-rw-r--r--src/profiling/CommandHandler.cpp2
-rw-r--r--src/profiling/CommandHandlerRegistry.cpp7
-rw-r--r--src/profiling/CounterDirectory.cpp57
-rw-r--r--src/profiling/FileOnlyProfilingConnection.cpp2
-rw-r--r--src/profiling/ProfilingService.cpp26
-rw-r--r--src/profiling/ProfilingService.hpp4
-rw-r--r--src/profiling/ProfilingUtils.cpp48
-rw-r--r--src/profiling/SendCounterPacket.cpp23
-rw-r--r--src/profiling/SendTimelinePacket.hpp4
-rw-r--r--src/profiling/test/ProfilingMocks.hpp24
-rw-r--r--src/profiling/test/ProfilingTestUtils.cpp12
-rw-r--r--src/profiling/test/SendCounterPacketTests.cpp18
-rw-r--r--src/profiling/test/SendCounterPacketTests.hpp2
13 files changed, 116 insertions, 113 deletions
diff --git a/src/profiling/CommandHandler.cpp b/src/profiling/CommandHandler.cpp
index bb60ac18f0..cae7037327 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());
- BOOST_ASSERT(commandHandlerFunctor);
+ ARMNN_ASSERT(commandHandlerFunctor);
commandHandlerFunctor->operator()(packet);
}
catch (const armnn::TimeoutException&)
diff --git a/src/profiling/CommandHandlerRegistry.cpp b/src/profiling/CommandHandlerRegistry.cpp
index 8070afe623..c2fef7a597 100644
--- a/src/profiling/CommandHandlerRegistry.cpp
+++ b/src/profiling/CommandHandlerRegistry.cpp
@@ -5,7 +5,8 @@
#include "CommandHandlerRegistry.hpp"
-#include <boost/assert.hpp>
+#include <armnn/utility/Assert.hpp>
+
#include <boost/format.hpp>
namespace armnn
@@ -19,7 +20,7 @@ void CommandHandlerRegistry::RegisterFunctor(CommandHandlerFunctor* functor,
uint32_t packetId,
uint32_t version)
{
- BOOST_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
+ ARMNN_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
CommandHandlerKey key(familyId, packetId, version);
registry[key] = functor;
@@ -27,7 +28,7 @@ void CommandHandlerRegistry::RegisterFunctor(CommandHandlerFunctor* functor,
void CommandHandlerRegistry::RegisterFunctor(CommandHandlerFunctor* functor)
{
- BOOST_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
+ ARMNN_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
RegisterFunctor(functor, functor->GetFamilyId(), functor->GetPacketId(), functor->GetVersion());
}
diff --git a/src/profiling/CounterDirectory.cpp b/src/profiling/CounterDirectory.cpp
index c84da10506..415a66072f 100644
--- a/src/profiling/CounterDirectory.cpp
+++ b/src/profiling/CounterDirectory.cpp
@@ -8,6 +8,7 @@
#include <armnn/Exceptions.hpp>
#include <armnn/Conversion.hpp>
+#include <armnn/utility/Assert.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
#include <boost/format.hpp>
@@ -37,11 +38,11 @@ const Category* CounterDirectory::RegisterCategory(const std::string& categoryNa
// Create the category
CategoryPtr category = std::make_unique<Category>(categoryName);
- BOOST_ASSERT(category);
+ ARMNN_ASSERT(category);
// Get the raw category pointer
const Category* categoryPtr = category.get();
- BOOST_ASSERT(categoryPtr);
+ ARMNN_ASSERT(categoryPtr);
// Register the category
m_Categories.insert(std::move(category));
@@ -99,11 +100,11 @@ const Device* CounterDirectory::RegisterDevice(const std::string& deviceName,
// Create the device
DevicePtr device = std::make_unique<Device>(deviceUid, deviceName, cores);
- BOOST_ASSERT(device);
+ ARMNN_ASSERT(device);
// Get the raw device pointer
const Device* devicePtr = device.get();
- BOOST_ASSERT(devicePtr);
+ ARMNN_ASSERT(devicePtr);
// Register the device
m_Devices.insert(std::make_pair(deviceUid, std::move(device)));
@@ -162,15 +163,15 @@ const CounterSet* CounterDirectory::RegisterCounterSet(const std::string& counte
// Get the counter set UID
uint16_t counterSetUid = GetNextUid();
- BOOST_ASSERT(counterSetUid == counterSetUidPeek);
+ ARMNN_ASSERT(counterSetUid == counterSetUidPeek);
// Create the counter set
CounterSetPtr counterSet = std::make_unique<CounterSet>(counterSetUid, counterSetName, count);
- BOOST_ASSERT(counterSet);
+ ARMNN_ASSERT(counterSet);
// Get the raw counter set pointer
const CounterSet* counterSetPtr = counterSet.get();
- BOOST_ASSERT(counterSetPtr);
+ ARMNN_ASSERT(counterSetPtr);
// Register the counter set
m_CounterSets.insert(std::make_pair(counterSetUid, std::move(counterSet)));
@@ -251,14 +252,14 @@ const Counter* CounterDirectory::RegisterCounter(const BackendId& backendId,
// Get the parent category
const CategoryPtr& parentCategory = *categoryIt;
- BOOST_ASSERT(parentCategory);
+ ARMNN_ASSERT(parentCategory);
// Check that a counter with the given name is not already registered within the parent category
const std::vector<uint16_t>& parentCategoryCounters = parentCategory->m_Counters;
for (uint16_t parentCategoryCounterUid : parentCategoryCounters)
{
const Counter* parentCategoryCounter = GetCounter(parentCategoryCounterUid);
- BOOST_ASSERT(parentCategoryCounter);
+ ARMNN_ASSERT(parentCategoryCounter);
if (parentCategoryCounter->m_Name == name)
{
@@ -290,7 +291,7 @@ const Counter* CounterDirectory::RegisterCounter(const BackendId& backendId,
// Get the counter UIDs and calculate the max counter UID
std::vector<uint16_t> counterUids = GetNextCounterUids(uid, deviceCores);
- BOOST_ASSERT(!counterUids.empty());
+ ARMNN_ASSERT(!counterUids.empty());
uint16_t maxCounterUid = deviceCores <= 1 ? counterUids.front() : counterUids.back();
// Get the counter units
@@ -308,11 +309,11 @@ const Counter* CounterDirectory::RegisterCounter(const BackendId& backendId,
unitsValue,
deviceUidValue,
counterSetUidValue);
- BOOST_ASSERT(counter);
+ ARMNN_ASSERT(counter);
// Get the raw counter pointer
const Counter* counterPtr = counter.get();
- BOOST_ASSERT(counterPtr);
+ ARMNN_ASSERT(counterPtr);
// Process multiple counters if necessary
for (uint16_t counterUid : counterUids)
@@ -336,7 +337,7 @@ const Category* CounterDirectory::GetCategory(const std::string& categoryName) c
}
const Category* category = it->get();
- BOOST_ASSERT(category);
+ ARMNN_ASSERT(category);
return category;
}
@@ -350,8 +351,8 @@ const Device* CounterDirectory::GetDevice(uint16_t deviceUid) const
}
const Device* device = it->second.get();
- BOOST_ASSERT(device);
- BOOST_ASSERT(device->m_Uid == deviceUid);
+ ARMNN_ASSERT(device);
+ ARMNN_ASSERT(device->m_Uid == deviceUid);
return device;
}
@@ -365,8 +366,8 @@ const CounterSet* CounterDirectory::GetCounterSet(uint16_t counterSetUid) const
}
const CounterSet* counterSet = it->second.get();
- BOOST_ASSERT(counterSet);
- BOOST_ASSERT(counterSet->m_Uid == counterSetUid);
+ ARMNN_ASSERT(counterSet);
+ ARMNN_ASSERT(counterSet->m_Uid == counterSetUid);
return counterSet;
}
@@ -380,9 +381,9 @@ const Counter* CounterDirectory::GetCounter(uint16_t counterUid) const
}
const Counter* counter = it->second.get();
- BOOST_ASSERT(counter);
- BOOST_ASSERT(counter->m_Uid <= counterUid);
- BOOST_ASSERT(counter->m_Uid <= counter->m_MaxCounterUid);
+ ARMNN_ASSERT(counter);
+ ARMNN_ASSERT(counter->m_Uid <= counterUid);
+ ARMNN_ASSERT(counter->m_Uid <= counter->m_MaxCounterUid);
return counter;
}
@@ -449,7 +450,7 @@ CategoriesIt CounterDirectory::FindCategory(const std::string& categoryName) con
{
return std::find_if(m_Categories.begin(), m_Categories.end(), [&categoryName](const CategoryPtr& category)
{
- BOOST_ASSERT(category);
+ ARMNN_ASSERT(category);
return category->m_Name == categoryName;
});
@@ -464,8 +465,8 @@ DevicesIt CounterDirectory::FindDevice(const std::string& deviceName) const
{
return std::find_if(m_Devices.begin(), m_Devices.end(), [&deviceName](const auto& pair)
{
- BOOST_ASSERT(pair.second);
- BOOST_ASSERT(pair.second->m_Uid == pair.first);
+ ARMNN_ASSERT(pair.second);
+ ARMNN_ASSERT(pair.second->m_Uid == pair.first);
return pair.second->m_Name == deviceName;
});
@@ -480,8 +481,8 @@ CounterSetsIt CounterDirectory::FindCounterSet(const std::string& counterSetName
{
return std::find_if(m_CounterSets.begin(), m_CounterSets.end(), [&counterSetName](const auto& pair)
{
- BOOST_ASSERT(pair.second);
- BOOST_ASSERT(pair.second->m_Uid == pair.first);
+ ARMNN_ASSERT(pair.second);
+ ARMNN_ASSERT(pair.second->m_Uid == pair.first);
return pair.second->m_Name == counterSetName;
});
@@ -496,8 +497,8 @@ CountersIt CounterDirectory::FindCounter(const std::string& counterName) const
{
return std::find_if(m_Counters.begin(), m_Counters.end(), [&counterName](const auto& pair)
{
- BOOST_ASSERT(pair.second);
- BOOST_ASSERT(pair.second->m_Uid == pair.first);
+ ARMNN_ASSERT(pair.second);
+ ARMNN_ASSERT(pair.second->m_Uid == pair.first);
return pair.second->m_Name == counterName;
});
@@ -536,7 +537,7 @@ uint16_t CounterDirectory::GetNumberOfCores(const Optional<uint16_t>& numberOfCo
// Get the associated device
const DevicePtr& device = deviceIt->second;
- BOOST_ASSERT(device);
+ ARMNN_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 83229caad7..f9bdde961f 100644
--- a/src/profiling/FileOnlyProfilingConnection.cpp
+++ b/src/profiling/FileOnlyProfilingConnection.cpp
@@ -111,7 +111,7 @@ bool FileOnlyProfilingConnection::SendCounterSelectionPacket()
bool FileOnlyProfilingConnection::WritePacket(const unsigned char* buffer, uint32_t length)
{
- BOOST_ASSERT(buffer);
+ ARMNN_ASSERT(buffer);
// Read Header and determine case
uint32_t outgoingHeaderAsWords[2];
diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
index 3a8f3f83a3..4d7241e7db 100644
--- a/src/profiling/ProfilingService.cpp
+++ b/src/profiling/ProfilingService.cpp
@@ -134,7 +134,7 @@ void ProfilingService::Update()
try
{
// Setup the profiling connection
- BOOST_ASSERT(m_ProfilingConnectionFactory);
+ ARMNN_ASSERT(m_ProfilingConnectionFactory);
m_ProfilingConnection = m_ProfilingConnectionFactory->GetProfilingConnection(m_Options);
}
catch (const Exception& e)
@@ -155,7 +155,7 @@ void ProfilingService::Update()
// "NotConnected" state
break;
case ProfilingState::WaitingForAck:
- BOOST_ASSERT(m_ProfilingConnection);
+ ARMNN_ASSERT(m_ProfilingConnection);
// Start the command thread
m_CommandHandler.Start(*m_ProfilingConnection);
@@ -204,7 +204,7 @@ void ProfilingService::Disconnect()
void ProfilingService::AddBackendProfilingContext(const BackendId backendId,
std::shared_ptr<armnn::profiling::IBackendProfilingContext> profilingContext)
{
- BOOST_ASSERT(profilingContext != nullptr);
+ ARMNN_ASSERT(profilingContext != nullptr);
// Register the backend counters
m_MaxGlobalCounterId = profilingContext->RegisterCounters(m_MaxGlobalCounterId);
m_BackendProfilingContexts.emplace(backendId, std::move(profilingContext));
@@ -238,7 +238,7 @@ uint32_t ProfilingService::GetCounterValue(uint16_t counterUid) const
{
CheckCounterUid(counterUid);
std::atomic<uint32_t>* counterValuePtr = m_CounterIndex.at(counterUid);
- BOOST_ASSERT(counterValuePtr);
+ ARMNN_ASSERT(counterValuePtr);
return counterValuePtr->load(std::memory_order::memory_order_relaxed);
}
@@ -268,7 +268,7 @@ void ProfilingService::SetCounterValue(uint16_t counterUid, uint32_t value)
{
CheckCounterUid(counterUid);
std::atomic<uint32_t>* counterValuePtr = m_CounterIndex.at(counterUid);
- BOOST_ASSERT(counterValuePtr);
+ ARMNN_ASSERT(counterValuePtr);
counterValuePtr->store(value, std::memory_order::memory_order_relaxed);
}
@@ -276,7 +276,7 @@ uint32_t ProfilingService::AddCounterValue(uint16_t counterUid, uint32_t value)
{
CheckCounterUid(counterUid);
std::atomic<uint32_t>* counterValuePtr = m_CounterIndex.at(counterUid);
- BOOST_ASSERT(counterValuePtr);
+ ARMNN_ASSERT(counterValuePtr);
return counterValuePtr->fetch_add(value, std::memory_order::memory_order_relaxed);
}
@@ -284,7 +284,7 @@ uint32_t ProfilingService::SubtractCounterValue(uint16_t counterUid, uint32_t va
{
CheckCounterUid(counterUid);
std::atomic<uint32_t>* counterValuePtr = m_CounterIndex.at(counterUid);
- BOOST_ASSERT(counterValuePtr);
+ ARMNN_ASSERT(counterValuePtr);
return counterValuePtr->fetch_sub(value, std::memory_order::memory_order_relaxed);
}
@@ -292,7 +292,7 @@ uint32_t ProfilingService::IncrementCounterValue(uint16_t counterUid)
{
CheckCounterUid(counterUid);
std::atomic<uint32_t>* counterValuePtr = m_CounterIndex.at(counterUid);
- BOOST_ASSERT(counterValuePtr);
+ ARMNN_ASSERT(counterValuePtr);
return counterValuePtr->operator++(std::memory_order::memory_order_relaxed);
}
@@ -332,7 +332,7 @@ void ProfilingService::Initialize()
"Network loads",
"The number of networks loaded at runtime",
std::string("networks"));
- BOOST_ASSERT(loadedNetworksCounter);
+ ARMNN_ASSERT(loadedNetworksCounter);
InitializeCounterValue(loadedNetworksCounter->m_Uid);
}
// Register a counter for the number of unloaded networks
@@ -348,7 +348,7 @@ void ProfilingService::Initialize()
"Network unloads",
"The number of networks unloaded at runtime",
std::string("networks"));
- BOOST_ASSERT(unloadedNetworksCounter);
+ ARMNN_ASSERT(unloadedNetworksCounter);
InitializeCounterValue(unloadedNetworksCounter->m_Uid);
}
// Register a counter for the number of registered backends
@@ -364,7 +364,7 @@ void ProfilingService::Initialize()
"Backends registered",
"The number of registered backends",
std::string("backends"));
- BOOST_ASSERT(registeredBackendsCounter);
+ ARMNN_ASSERT(registeredBackendsCounter);
InitializeCounterValue(registeredBackendsCounter->m_Uid);
}
// Register a counter for the number of registered backends
@@ -380,7 +380,7 @@ void ProfilingService::Initialize()
"Backends unregistered",
"The number of unregistered backends",
std::string("backends"));
- BOOST_ASSERT(unregisteredBackendsCounter);
+ ARMNN_ASSERT(unregisteredBackendsCounter);
InitializeCounterValue(unregisteredBackendsCounter->m_Uid);
}
// Register a counter for the number of inferences run
@@ -396,7 +396,7 @@ void ProfilingService::Initialize()
"Inferences run",
"The number of inferences run",
std::string("inferences"));
- BOOST_ASSERT(inferencesRunCounter);
+ ARMNN_ASSERT(inferencesRunCounter);
InitializeCounterValue(inferencesRunCounter->m_Uid);
}
}
diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp
index df7bd8f857..a6c5e29767 100644
--- a/src/profiling/ProfilingService.hpp
+++ b/src/profiling/ProfilingService.hpp
@@ -264,8 +264,8 @@ protected:
IProfilingConnectionFactory* other,
IProfilingConnectionFactory*& backup)
{
- BOOST_ASSERT(instance.m_ProfilingConnectionFactory);
- BOOST_ASSERT(other);
+ ARMNN_ASSERT(instance.m_ProfilingConnectionFactory);
+ ARMNN_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 e419769600..e542b6945b 100644
--- a/src/profiling/ProfilingUtils.cpp
+++ b/src/profiling/ProfilingUtils.cpp
@@ -9,7 +9,7 @@
#include <WallClockTimer.hpp>
-#include <boost/assert.hpp>
+#include <armnn/utility/Assert.hpp>
#include <fstream>
#include <iostream>
@@ -88,7 +88,7 @@ std::vector<uint16_t> GetNextCounterUids(uint16_t firstUid, uint16_t cores)
void WriteBytes(const IPacketBufferPtr& packetBuffer, unsigned int offset, const void* value, unsigned int valueSize)
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
WriteBytes(packetBuffer->GetWritableData(), offset, value, valueSize);
}
@@ -102,36 +102,36 @@ uint32_t ConstructHeader(uint32_t packetFamily,
void WriteUint64(const std::unique_ptr<IPacketBuffer>& packetBuffer, unsigned int offset, uint64_t value)
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
WriteUint64(packetBuffer->GetWritableData(), offset, value);
}
void WriteUint32(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint32_t value)
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
WriteUint32(packetBuffer->GetWritableData(), offset, value);
}
void WriteUint16(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint16_t value)
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
WriteUint16(packetBuffer->GetWritableData(), offset, value);
}
void WriteUint8(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint8_t value)
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
WriteUint8(packetBuffer->GetWritableData(), offset, value);
}
void WriteBytes(unsigned char* buffer, unsigned int offset, const void* value, unsigned int valueSize)
{
- BOOST_ASSERT(buffer);
- BOOST_ASSERT(value);
+ ARMNN_ASSERT(buffer);
+ ARMNN_ASSERT(value);
for (unsigned int i = 0; i < valueSize; i++, offset++)
{
@@ -141,7 +141,7 @@ void WriteBytes(unsigned char* buffer, unsigned int offset, const void* value, u
void WriteUint64(unsigned char* buffer, unsigned int offset, uint64_t value)
{
- BOOST_ASSERT(buffer);
+ ARMNN_ASSERT(buffer);
buffer[offset] = static_cast<unsigned char>(value & 0xFF);
buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
@@ -155,7 +155,7 @@ void WriteUint64(unsigned char* buffer, unsigned int offset, uint64_t value)
void WriteUint32(unsigned char* buffer, unsigned int offset, uint32_t value)
{
- BOOST_ASSERT(buffer);
+ ARMNN_ASSERT(buffer);
buffer[offset] = static_cast<unsigned char>(value & 0xFF);
buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
@@ -165,7 +165,7 @@ void WriteUint32(unsigned char* buffer, unsigned int offset, uint32_t value)
void WriteUint16(unsigned char* buffer, unsigned int offset, uint16_t value)
{
- BOOST_ASSERT(buffer);
+ ARMNN_ASSERT(buffer);
buffer[offset] = static_cast<unsigned char>(value & 0xFF);
buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
@@ -173,50 +173,50 @@ void WriteUint16(unsigned char* buffer, unsigned int offset, uint16_t value)
void WriteUint8(unsigned char* buffer, unsigned int offset, uint8_t value)
{
- BOOST_ASSERT(buffer);
+ ARMNN_ASSERT(buffer);
buffer[offset] = static_cast<unsigned char>(value);
}
void ReadBytes(const IPacketBufferPtr& packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
ReadBytes(packetBuffer->GetReadableData(), offset, valueSize, outValue);
}
uint64_t ReadUint64(const IPacketBufferPtr& packetBuffer, unsigned int offset)
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
return ReadUint64(packetBuffer->GetReadableData(), offset);
}
uint32_t ReadUint32(const IPacketBufferPtr& packetBuffer, unsigned int offset)
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
return ReadUint32(packetBuffer->GetReadableData(), offset);
}
uint16_t ReadUint16(const IPacketBufferPtr& packetBuffer, unsigned int offset)
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
return ReadUint16(packetBuffer->GetReadableData(), offset);
}
uint8_t ReadUint8(const IPacketBufferPtr& packetBuffer, unsigned int offset)
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
return ReadUint8(packetBuffer->GetReadableData(), offset);
}
void ReadBytes(const unsigned char* buffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
{
- BOOST_ASSERT(buffer);
- BOOST_ASSERT(outValue);
+ ARMNN_ASSERT(buffer);
+ ARMNN_ASSERT(outValue);
for (unsigned int i = 0; i < valueSize; i++, offset++)
{
@@ -226,7 +226,7 @@ void ReadBytes(const unsigned char* buffer, unsigned int offset, unsigned int va
uint64_t ReadUint64(const unsigned char* buffer, unsigned int offset)
{
- BOOST_ASSERT(buffer);
+ ARMNN_ASSERT(buffer);
uint64_t value = 0;
value = static_cast<uint64_t>(buffer[offset]);
@@ -243,7 +243,7 @@ uint64_t ReadUint64(const unsigned char* buffer, unsigned int offset)
uint32_t ReadUint32(const unsigned char* buffer, unsigned int offset)
{
- BOOST_ASSERT(buffer);
+ ARMNN_ASSERT(buffer);
uint32_t value = 0;
value = static_cast<uint32_t>(buffer[offset]);
@@ -255,7 +255,7 @@ uint32_t ReadUint32(const unsigned char* buffer, unsigned int offset)
uint16_t ReadUint16(const unsigned char* buffer, unsigned int offset)
{
- BOOST_ASSERT(buffer);
+ ARMNN_ASSERT(buffer);
uint32_t value = 0;
value = static_cast<uint32_t>(buffer[offset]);
@@ -265,7 +265,7 @@ uint16_t ReadUint16(const unsigned char* buffer, unsigned int offset)
uint8_t ReadUint8(const unsigned char* buffer, unsigned int offset)
{
- BOOST_ASSERT(buffer);
+ ARMNN_ASSERT(buffer);
return buffer[offset];
}
@@ -310,7 +310,7 @@ uint32_t CalculateSizeOfPaddedSwString(const std::string& str)
// Read TimelineMessageDirectoryPacket from given IPacketBuffer and offset
SwTraceMessage ReadSwTraceMessage(const unsigned char* packetBuffer, unsigned int& offset)
{
- BOOST_ASSERT(packetBuffer);
+ ARMNN_ASSERT(packetBuffer);
unsigned int uint32_t_size = sizeof(uint32_t);
diff --git a/src/profiling/SendCounterPacket.cpp b/src/profiling/SendCounterPacket.cpp
index ae4bab91e7..24b86d4427 100644
--- a/src/profiling/SendCounterPacket.cpp
+++ b/src/profiling/SendCounterPacket.cpp
@@ -9,6 +9,7 @@
#include <armnn/Exceptions.hpp>
#include <armnn/Conversion.hpp>
#include <Processes.hpp>
+#include <armnn/utility/Assert.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
#include <boost/format.hpp>
@@ -178,10 +179,10 @@ bool SendCounterPacket::CreateCategoryRecord(const CategoryPtr& category,
{
using namespace boost::numeric;
- BOOST_ASSERT(category);
+ ARMNN_ASSERT(category);
const std::string& categoryName = category->m_Name;
- BOOST_ASSERT(!categoryName.empty());
+ ARMNN_ASSERT(!categoryName.empty());
// Remove any duplicate counters
std::vector<uint16_t> categoryCounters;
@@ -299,13 +300,13 @@ bool SendCounterPacket::CreateDeviceRecord(const DevicePtr& device,
DeviceRecord& deviceRecord,
std::string& errorMessage)
{
- BOOST_ASSERT(device);
+ ARMNN_ASSERT(device);
uint16_t deviceUid = device->m_Uid;
const std::string& deviceName = device->m_Name;
uint16_t deviceCores = device->m_Cores;
- BOOST_ASSERT(!deviceName.empty());
+ ARMNN_ASSERT(!deviceName.empty());
// Device record word 0:
// 16:31 [16] uid: the unique identifier for the device
@@ -349,13 +350,13 @@ bool SendCounterPacket::CreateCounterSetRecord(const CounterSetPtr& counterSet,
CounterSetRecord& counterSetRecord,
std::string& errorMessage)
{
- BOOST_ASSERT(counterSet);
+ ARMNN_ASSERT(counterSet);
uint16_t counterSetUid = counterSet->m_Uid;
const std::string& counterSetName = counterSet->m_Name;
uint16_t counterSetCount = counterSet->m_Count;
- BOOST_ASSERT(!counterSetName.empty());
+ ARMNN_ASSERT(!counterSetName.empty());
// Counter set record word 0:
// 16:31 [16] uid: the unique identifier for the counter_set
@@ -402,7 +403,7 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter,
{
using namespace boost::numeric;
- BOOST_ASSERT(counter);
+ ARMNN_ASSERT(counter);
uint16_t counterUid = counter->m_Uid;
uint16_t maxCounterUid = counter->m_MaxCounterUid;
@@ -415,9 +416,9 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter,
const std::string& counterDescription = counter->m_Description;
const std::string& counterUnits = counter->m_Units;
- BOOST_ASSERT(counterClass == 0 || counterClass == 1);
- BOOST_ASSERT(counterInterpolation == 0 || counterInterpolation == 1);
- BOOST_ASSERT(counterMultiplier);
+ ARMNN_ASSERT(counterClass == 0 || counterClass == 1);
+ ARMNN_ASSERT(counterInterpolation == 0 || counterInterpolation == 1);
+ ARMNN_ASSERT(counterMultiplier);
// Utils
size_t uint32_t_size = sizeof(uint32_t);
@@ -450,7 +451,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 };
- BOOST_ASSERT(sizeof(counterMultiplier) == sizeof(multiplier));
+ ARMNN_ASSERT(sizeof(counterMultiplier) == sizeof(multiplier));
std::memcpy(multiplier, &counterMultiplier, sizeof(multiplier));
uint32_t eventRecordWord3 = multiplier[0];
uint32_t eventRecordWord4 = multiplier[1];
diff --git a/src/profiling/SendTimelinePacket.hpp b/src/profiling/SendTimelinePacket.hpp
index 3e52c9758b..9954bd9a04 100644
--- a/src/profiling/SendTimelinePacket.hpp
+++ b/src/profiling/SendTimelinePacket.hpp
@@ -9,7 +9,7 @@
#include "armnn/profiling/ISendTimelinePacket.hpp"
#include "ProfilingUtils.hpp"
-#include <boost/assert.hpp>
+#include <armnn/utility/Assert.hpp>
#include <memory>
@@ -78,7 +78,7 @@ void SendTimelinePacket::ForwardWriteBinaryFunction(Func& func, Params&& ... par
try
{
ReserveBuffer();
- BOOST_ASSERT(m_WriteBuffer);
+ ARMNN_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 ada55d8dff..2cd44c40a2 100644
--- a/src/profiling/test/ProfilingMocks.hpp
+++ b/src/profiling/test/ProfilingMocks.hpp
@@ -16,9 +16,9 @@
#include <armnn/Exceptions.hpp>
#include <armnn/Optional.hpp>
#include <armnn/Conversion.hpp>
+#include <armnn/utility/Assert.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
-#include <boost/assert.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <atomic>
@@ -449,11 +449,11 @@ public:
{
// Create the category
CategoryPtr category = std::make_unique<Category>(categoryName);
- BOOST_ASSERT(category);
+ ARMNN_ASSERT(category);
// Get the raw category pointer
const Category* categoryPtr = category.get();
- BOOST_ASSERT(categoryPtr);
+ ARMNN_ASSERT(categoryPtr);
// Register the category
m_Categories.insert(std::move(category));
@@ -469,11 +469,11 @@ public:
// Create the device
DevicePtr device = std::make_unique<Device>(deviceUid, deviceName, cores);
- BOOST_ASSERT(device);
+ ARMNN_ASSERT(device);
// Get the raw device pointer
const Device* devicePtr = device.get();
- BOOST_ASSERT(devicePtr);
+ ARMNN_ASSERT(devicePtr);
// Register the device
m_Devices.insert(std::make_pair(deviceUid, std::move(device)));
@@ -490,11 +490,11 @@ public:
// Create the counter set
CounterSetPtr counterSet = std::make_unique<CounterSet>(counterSetUid, counterSetName, count);
- BOOST_ASSERT(counterSet);
+ ARMNN_ASSERT(counterSet);
// Get the raw counter set pointer
const CounterSet* counterSetPtr = counterSet.get();
- BOOST_ASSERT(counterSetPtr);
+ ARMNN_ASSERT(counterSetPtr);
// Register the counter set
m_CounterSets.insert(std::make_pair(counterSetUid, std::move(counterSet)));
@@ -528,7 +528,7 @@ public:
// Get the counter UIDs and calculate the max counter UID
std::vector<uint16_t> counterUids = GetNextCounterUids(uid, deviceCores);
- BOOST_ASSERT(!counterUids.empty());
+ ARMNN_ASSERT(!counterUids.empty());
uint16_t maxCounterUid = deviceCores <= 1 ? counterUids.front() : counterUids.back();
// Get the counter units
@@ -546,18 +546,18 @@ public:
unitsValue,
deviceUidValue,
counterSetUidValue);
- BOOST_ASSERT(counter);
+ ARMNN_ASSERT(counter);
// Get the raw counter pointer
const Counter* counterPtr = counter.get();
- BOOST_ASSERT(counterPtr);
+ ARMNN_ASSERT(counterPtr);
// Process multiple counters if necessary
for (uint16_t counterUid : counterUids)
{
// Connect the counter to the parent category
Category* parentCategory = const_cast<Category*>(GetCategory(parentCategoryName));
- BOOST_ASSERT(parentCategory);
+ ARMNN_ASSERT(parentCategory);
parentCategory->m_Counters.push_back(counterUid);
// Register the counter
@@ -584,7 +584,7 @@ public:
{
auto it = std::find_if(m_Categories.begin(), m_Categories.end(), [&name](const CategoryPtr& category)
{
- BOOST_ASSERT(category);
+ ARMNN_ASSERT(category);
return category->m_Name == name;
});
diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp
index 8de69f14ec..5c63b54b8f 100644
--- a/src/profiling/test/ProfilingTestUtils.cpp
+++ b/src/profiling/test/ProfilingTestUtils.cpp
@@ -31,7 +31,7 @@ void VerifyTimelineHeaderBinary(const unsigned char* readableData,
unsigned int& offset,
uint32_t packetDataLength)
{
- BOOST_ASSERT(readableData);
+ ARMNN_ASSERT(readableData);
// Utils
unsigned int uint32_t_size = sizeof(uint32_t);
@@ -60,7 +60,7 @@ void VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid,
const unsigned char* readableData,
unsigned int& offset)
{
- BOOST_ASSERT(readableData);
+ ARMNN_ASSERT(readableData);
// Utils
unsigned int uint32_t_size = sizeof(uint32_t);
@@ -101,7 +101,7 @@ void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid,
const unsigned char* readableData,
unsigned int& offset)
{
- BOOST_ASSERT(readableData);
+ ARMNN_ASSERT(readableData);
// Utils
unsigned int uint32_t_size = sizeof(uint32_t);
@@ -127,7 +127,7 @@ void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relati
const unsigned char* readableData,
unsigned int& offset)
{
- BOOST_ASSERT(readableData);
+ ARMNN_ASSERT(readableData);
uint32_t relationshipTypeUint = 0;
switch (relationshipType)
@@ -205,7 +205,7 @@ void VerifyTimelineEntityBinaryPacketData(Optional<ProfilingGuid> guid,
const unsigned char* readableData,
unsigned int& offset)
{
- BOOST_ASSERT(readableData);
+ ARMNN_ASSERT(readableData);
// Utils
unsigned int uint32_t_size = sizeof(uint32_t);
@@ -238,7 +238,7 @@ void VerifyTimelineEventBinaryPacket(Optional<uint64_t> timestamp,
const unsigned char* readableData,
unsigned int& offset)
{
- BOOST_ASSERT(readableData);
+ ARMNN_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 51f049ddc6..a3c237faba 100644
--- a/src/profiling/test/SendCounterPacketTests.cpp
+++ b/src/profiling/test/SendCounterPacketTests.cpp
@@ -536,7 +536,7 @@ BOOST_AUTO_TEST_CASE(CreateEventRecordTest)
counterUnits,
deviceUid,
counterSetUid);
- BOOST_ASSERT(counter);
+ ARMNN_ASSERT(counter);
// Create an event record
SendCounterPacket::EventRecord eventRecord;
@@ -656,7 +656,7 @@ BOOST_AUTO_TEST_CASE(CreateEventRecordNoUnitsTest)
"",
deviceUid,
counterSetUid);
- BOOST_ASSERT(counter);
+ ARMNN_ASSERT(counter);
// Create an event record
SendCounterPacket::EventRecord eventRecord;
@@ -761,7 +761,7 @@ BOOST_AUTO_TEST_CASE(CreateInvalidEventRecordTest1)
counterUnits,
deviceUid,
counterSetUid);
- BOOST_ASSERT(counter);
+ ARMNN_ASSERT(counter);
// Create an event record
SendCounterPacket::EventRecord eventRecord;
@@ -800,7 +800,7 @@ BOOST_AUTO_TEST_CASE(CreateInvalidEventRecordTest2)
counterUnits,
deviceUid,
counterSetUid);
- BOOST_ASSERT(counter);
+ ARMNN_ASSERT(counter);
// Create an event record
SendCounterPacket::EventRecord eventRecord;
@@ -839,7 +839,7 @@ BOOST_AUTO_TEST_CASE(CreateInvalidEventRecordTest3)
counterUnits,
deviceUid,
counterSetUid);
- BOOST_ASSERT(counter);
+ ARMNN_ASSERT(counter);
// Create an event record
SendCounterPacket::EventRecord eventRecord;
@@ -859,7 +859,7 @@ BOOST_AUTO_TEST_CASE(CreateCategoryRecordTest)
// Create a category for testing
const std::string categoryName = "some_category";
const CategoryPtr category = std::make_unique<Category>(categoryName);
- BOOST_ASSERT(category);
+ ARMNN_ASSERT(category);
category->m_Counters = { 11u, 23u, 5670u };
// Create a collection of counters
@@ -903,9 +903,9 @@ BOOST_AUTO_TEST_CASE(CreateCategoryRecordTest)
Counter* counter1 = counters.find(11)->second.get();
Counter* counter2 = counters.find(23)->second.get();
Counter* counter3 = counters.find(5670)->second.get();
- BOOST_ASSERT(counter1);
- BOOST_ASSERT(counter2);
- BOOST_ASSERT(counter3);
+ ARMNN_ASSERT(counter1);
+ ARMNN_ASSERT(counter2);
+ ARMNN_ASSERT(counter3);
uint16_t categoryEventCount = boost::numeric_cast<uint16_t>(counters.size());
// Create a category record
diff --git a/src/profiling/test/SendCounterPacketTests.hpp b/src/profiling/test/SendCounterPacketTests.hpp
index 7a5f7962e6..84c88ad9ae 100644
--- a/src/profiling/test/SendCounterPacketTests.hpp
+++ b/src/profiling/test/SendCounterPacketTests.hpp
@@ -13,9 +13,9 @@
#include <armnn/Exceptions.hpp>
#include <armnn/Optional.hpp>
#include <armnn/Conversion.hpp>
+#include <armnn/utility/Assert.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
-#include <boost/assert.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <atomic>