aboutsummaryrefslogtreecommitdiff
path: root/src/profiling
diff options
context:
space:
mode:
authorMatthew Sloyan <matthew.sloyan@arm.com>2020-09-11 10:14:57 +0100
committerMatthew Sloyan <matthew.sloyan@arm.com>2020-09-29 08:01:57 +0000
commit371b70e39390618cbd791b441adcf3923964b8df (patch)
treeb869b0b3e5064e9c5abab8a02b111a497a6326d2 /src/profiling
parent1f0e2f9dbf14a719aef09649b19a656a6b03c7ce (diff)
downloadarmnn-371b70e39390618cbd791b441adcf3923964b8df.tar.gz
IVGCVSW-5301 Remove all boost::numeric_cast from armnn/src/profiling
* Replaced with armnn/utility/NumericCast.hpp Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com> Change-Id: I14e89c00cd1dd607315113d5b8ca56c2e9f6c363
Diffstat (limited to 'src/profiling')
-rw-r--r--src/profiling/FileOnlyProfilingConnection.cpp1
-rw-r--r--src/profiling/ICounterDirectory.hpp2
-rw-r--r--src/profiling/PeriodicCounterSelectionCommandHandler.cpp7
-rw-r--r--src/profiling/ProfilingConnectionDumpToFileDecorator.cpp7
-rw-r--r--src/profiling/ProfilingService.cpp4
-rw-r--r--src/profiling/ProfilingUtils.cpp14
-rw-r--r--src/profiling/ProfilingUtils.hpp4
-rw-r--r--src/profiling/SendCounterPacket.cpp75
-rw-r--r--src/profiling/SendThread.cpp7
-rw-r--r--src/profiling/test/FileOnlyProfilingDecoratorTests.cpp1
-rw-r--r--src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp4
-rw-r--r--src/profiling/test/ProfilingMocks.hpp11
-rw-r--r--src/profiling/test/ProfilingTestUtils.cpp12
-rw-r--r--src/profiling/test/ProfilingTests.cpp27
-rw-r--r--src/profiling/test/RequestCountersPacketHandler.cpp6
-rw-r--r--src/profiling/test/SendCounterPacketTests.cpp26
-rw-r--r--src/profiling/test/SendCounterPacketTests.hpp3
-rw-r--r--src/profiling/test/TimelinePacketTests.cpp43
18 files changed, 119 insertions, 135 deletions
diff --git a/src/profiling/FileOnlyProfilingConnection.cpp b/src/profiling/FileOnlyProfilingConnection.cpp
index 24f2cc7ede..a21ec2ff02 100644
--- a/src/profiling/FileOnlyProfilingConnection.cpp
+++ b/src/profiling/FileOnlyProfilingConnection.cpp
@@ -11,7 +11,6 @@
#include <common/include/ProfilingException.hpp>
#include <algorithm>
-#include <boost/numeric/conversion/cast.hpp>
#include <iostream>
#include <thread>
diff --git a/src/profiling/ICounterDirectory.hpp b/src/profiling/ICounterDirectory.hpp
index b19f7d306d..4492f854bf 100644
--- a/src/profiling/ICounterDirectory.hpp
+++ b/src/profiling/ICounterDirectory.hpp
@@ -13,8 +13,6 @@
#include <unordered_set>
#include <unordered_map>
-#include <boost/numeric/conversion/cast.hpp>
-
namespace armnn
{
diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
index 1b10643fca..e622123296 100644
--- a/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
+++ b/src/profiling/PeriodicCounterSelectionCommandHandler.cpp
@@ -7,7 +7,8 @@
#include "ProfilingUtils.hpp"
#include <armnn/Types.hpp>
-#include <boost/numeric/conversion/cast.hpp>
+#include <armnn/utility/NumericCast.hpp>
+
#include <boost/format.hpp>
#include <vector>
@@ -21,8 +22,8 @@ namespace profiling
void PeriodicCounterSelectionCommandHandler::ParseData(const arm::pipe::Packet& packet, CaptureData& captureData)
{
std::vector<uint16_t> counterIds;
- uint32_t sizeOfUint32 = boost::numeric_cast<uint32_t>(sizeof(uint32_t));
- uint32_t sizeOfUint16 = boost::numeric_cast<uint32_t>(sizeof(uint16_t));
+ uint32_t sizeOfUint32 = armnn::numeric_cast<uint32_t>(sizeof(uint32_t));
+ uint32_t sizeOfUint16 = armnn::numeric_cast<uint32_t>(sizeof(uint16_t));
uint32_t offset = 0;
if (packet.GetLength() < 4)
diff --git a/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp b/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp
index 5768566178..84aae9d39f 100644
--- a/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp
+++ b/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp
@@ -6,11 +6,10 @@
#include "ProfilingConnectionDumpToFileDecorator.hpp"
#include <armnn/Exceptions.hpp>
+#include <armnn/utility/NumericCast.hpp>
#include <fstream>
-#include <boost/numeric/conversion/cast.hpp>
-
namespace armnn
{
@@ -110,7 +109,7 @@ void ProfilingConnectionDumpToFileDecorator::DumpIncomingToFile(const arm::pipe:
m_IncomingDumpFileStream.write(reinterpret_cast<const char*>(&header), sizeof header);
m_IncomingDumpFileStream.write(reinterpret_cast<const char*>(&packetLength), sizeof packetLength);
m_IncomingDumpFileStream.write(reinterpret_cast<const char*>(packet.GetData()),
- boost::numeric_cast<std::streamsize>(packetLength));
+ armnn::numeric_cast<std::streamsize>(packetLength));
success &= m_IncomingDumpFileStream.good();
if (!(success || m_IgnoreFileErrors))
@@ -142,7 +141,7 @@ bool ProfilingConnectionDumpToFileDecorator::DumpOutgoingToFile(const unsigned c
// attempt to write binary data
m_OutgoingDumpFileStream.write(reinterpret_cast<const char*>(buffer),
- boost::numeric_cast<std::streamsize>(length));
+ armnn::numeric_cast<std::streamsize>(length));
success &= m_OutgoingDumpFileStream.good();
if (!(success || m_IgnoreFileErrors))
{
diff --git a/src/profiling/ProfilingService.cpp b/src/profiling/ProfilingService.cpp
index b673993846..3521fc0884 100644
--- a/src/profiling/ProfilingService.cpp
+++ b/src/profiling/ProfilingService.cpp
@@ -7,6 +7,8 @@
#include <armnn/BackendId.hpp>
#include <armnn/Logging.hpp>
+#include <armnn/utility/NumericCast.hpp>
+
#include <common/include/SocketConnectionException.hpp>
#include <boost/format.hpp>
@@ -426,7 +428,7 @@ void ProfilingService::InitializeCounterValue(uint16_t counterUid)
// Increase the size of the counter index if necessary
if (counterUid >= m_CounterIndex.size())
{
- m_CounterIndex.resize(boost::numeric_cast<size_t>(counterUid) + 1);
+ m_CounterIndex.resize(armnn::numeric_cast<size_t>(counterUid) + 1);
}
// Create a new atomic counter and add it to the list
diff --git a/src/profiling/ProfilingUtils.cpp b/src/profiling/ProfilingUtils.cpp
index 4767f3e746..f00f15667b 100644
--- a/src/profiling/ProfilingUtils.cpp
+++ b/src/profiling/ProfilingUtils.cpp
@@ -338,7 +338,7 @@ TimelinePacketStatus WriteTimelineLabelBinaryPacket(uint64_t profilingGuid,
}
// Calculate the size of the SWTrace string label (in bytes)
- unsigned int swTraceLabelSize = boost::numeric_cast<unsigned int>(swTraceLabel.size()) * uint32_t_size;
+ unsigned int swTraceLabelSize = armnn::numeric_cast<unsigned int>(swTraceLabel.size()) * uint32_t_size;
// Calculate the length of the data (in bytes)
unsigned int timelineLabelPacketDataLength = uint32_t_size + // decl_Id
@@ -541,7 +541,7 @@ TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
uint32_t declId = 0;
try
{
- declId = boost::numeric_cast<uint32_t>(std::stoul(directoryComponent[0]));
+ declId = armnn::numeric_cast<uint32_t>(std::stoul(directoryComponent[0]));
}
catch (const std::exception&)
{
@@ -565,7 +565,7 @@ TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
}
unsigned int dataLength = 3 * uint8_t_size + // Stream header (3 bytes)
- boost::numeric_cast<unsigned int>(swTraceBuffer.size()) *
+ armnn::numeric_cast<unsigned int>(swTraceBuffer.size()) *
uint32_t_size; // Trace directory (5 messages)
// Calculate the timeline directory binary packet size (in bytes)
@@ -579,7 +579,7 @@ TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
}
// Create packet header
- auto packetHeader = CreateTimelinePacketHeader(1, 0, 0, 0, 0, boost::numeric_cast<uint32_t>(dataLength));
+ auto packetHeader = CreateTimelinePacketHeader(1, 0, 0, 0, 0, armnn::numeric_cast<uint32_t>(dataLength));
// Initialize the offset for writing in the buffer
unsigned int offset = 0;
@@ -592,8 +592,8 @@ TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
// Write the stream header
uint8_t streamVersion = 4;
- uint8_t pointerBytes = boost::numeric_cast<uint8_t>(uint64_t_size); // All GUIDs are uint64_t
- uint8_t threadIdBytes = boost::numeric_cast<uint8_t>(ThreadIdSize);
+ uint8_t pointerBytes = armnn::numeric_cast<uint8_t>(uint64_t_size); // All GUIDs are uint64_t
+ uint8_t threadIdBytes = armnn::numeric_cast<uint8_t>(ThreadIdSize);
switch (threadIdBytes)
{
case 4: // Typically Windows and Android
@@ -610,7 +610,7 @@ TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char* buffer,
offset += uint8_t_size;
// Write the SWTrace directory
- uint32_t numberOfDeclarations = boost::numeric_cast<uint32_t>(timelineDirectoryMessages.size());
+ uint32_t numberOfDeclarations = armnn::numeric_cast<uint32_t>(timelineDirectoryMessages.size());
WriteUint32(buffer, offset, numberOfDeclarations); // Number of declarations
offset += uint32_t_size;
for (uint32_t i : swTraceBuffer)
diff --git a/src/profiling/ProfilingUtils.hpp b/src/profiling/ProfilingUtils.hpp
index 79fa6c7bb0..b9c8327b0d 100644
--- a/src/profiling/ProfilingUtils.hpp
+++ b/src/profiling/ProfilingUtils.hpp
@@ -8,13 +8,13 @@
#include <armnn/Exceptions.hpp>
#include <armnn/profiling/ISendTimelinePacket.hpp>
+#include <armnn/utility/NumericCast.hpp>
+
#include "ICounterDirectory.hpp"
#include "IPacketBuffer.hpp"
#include <common/include/Packet.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-
#include <algorithm>
#include <cstring>
#include <memory>
diff --git a/src/profiling/SendCounterPacket.cpp b/src/profiling/SendCounterPacket.cpp
index 79123f0c5e..121ced9241 100644
--- a/src/profiling/SendCounterPacket.cpp
+++ b/src/profiling/SendCounterPacket.cpp
@@ -10,11 +10,11 @@
#include <armnn/Conversion.hpp>
#include <Processes.hpp>
#include <armnn/utility/Assert.hpp>
+#include <armnn/utility/NumericCast.hpp>
#include <common/include/Constants.hpp>
#include <common/include/SwTrace.hpp>
#include <boost/format.hpp>
-#include <boost/numeric/conversion/cast.hpp>
#include <cstring>
@@ -24,8 +24,6 @@ namespace armnn
namespace profiling
{
-using boost::numeric_cast;
-
void SendCounterPacket::SendStreamMetaDataPacket()
{
const std::string info(GetSoftwareInfo());
@@ -33,10 +31,10 @@ void SendCounterPacket::SendStreamMetaDataPacket()
const std::string softwareVersion(GetSoftwareVersion());
const std::string processName = GetProcessName().substr(0, 60);
- const uint32_t infoSize = numeric_cast<uint32_t>(info.size()) + 1;
- const uint32_t hardwareVersionSize = numeric_cast<uint32_t>(hardwareVersion.size()) + 1;
- const uint32_t softwareVersionSize = numeric_cast<uint32_t>(softwareVersion.size()) + 1;
- const uint32_t processNameSize = numeric_cast<uint32_t>(processName.size()) + 1;
+ const uint32_t infoSize = armnn::numeric_cast<uint32_t>(info.size()) + 1;
+ const uint32_t hardwareVersionSize = armnn::numeric_cast<uint32_t>(hardwareVersion.size()) + 1;
+ const uint32_t softwareVersionSize = armnn::numeric_cast<uint32_t>(softwareVersion.size()) + 1;
+ const uint32_t processNameSize = armnn::numeric_cast<uint32_t>(processName.size()) + 1;
const uint32_t sizeUint32 = sizeof(uint32_t);
@@ -75,11 +73,12 @@ void SendCounterPacket::SendStreamMetaDataPacket()
packetVersions.push_back(std::make_pair(ConstructHeader(3, 1, 1), arm::pipe::EncodeVersion(1, 0, 0)));
packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 0), arm::pipe::EncodeVersion(1, 0, 0)));
packetVersions.push_back(std::make_pair(ConstructHeader(1, 0, 1), arm::pipe::EncodeVersion(1, 0, 0)));
- uint32_t numberOfVersions = numeric_cast<uint32_t>(packetVersions.size());
- uint32_t packetVersionSize = numeric_cast<uint32_t>(numberOfVersions * 2 * sizeUint32);
+ uint32_t numberOfVersions = armnn::numeric_cast<uint32_t>(packetVersions.size());
+ uint32_t packetVersionSize = armnn::numeric_cast<uint32_t>(numberOfVersions * 2 * sizeUint32);
- const uint32_t payloadSize = numeric_cast<uint32_t>(infoSize + hardwareVersionSize + softwareVersionSize +
- processNameSize + packetVersionCountSize + packetVersionSize);
+ const uint32_t payloadSize = armnn::numeric_cast<uint32_t>(infoSize + hardwareVersionSize +
+ softwareVersionSize + processNameSize +
+ packetVersionCountSize + packetVersionSize);
const uint32_t totalSize = headerSize + bodySize + payloadSize;
uint32_t offset = 0;
@@ -112,7 +111,7 @@ void SendCounterPacket::SendStreamMetaDataPacket()
WriteUint32(writeBuffer, offset, MAX_METADATA_PACKET_LENGTH); // max_data_length
offset += sizeUint32;
int pid = armnnUtils::Processes::GetCurrentId();
- WriteUint32(writeBuffer, offset, numeric_cast<uint32_t>(pid)); // pid
+ WriteUint32(writeBuffer, offset, armnn::numeric_cast<uint32_t>(pid)); // pid
offset += sizeUint32;
uint32_t poolOffset = bodySize;
WriteUint32(writeBuffer, offset, poolOffset); // offset_info
@@ -176,8 +175,6 @@ bool SendCounterPacket::CreateCategoryRecord(const CategoryPtr& category,
CategoryRecord& categoryRecord,
std::string& errorMessage)
{
- using namespace boost::numeric;
-
ARMNN_ASSERT(category);
const std::string& categoryName = category->m_Name;
@@ -236,8 +233,8 @@ bool SendCounterPacket::CreateCategoryRecord(const CategoryPtr& category,
std::vector<EventRecord> eventRecords(counterCount);
std::vector<uint32_t> eventRecordOffsets(counterCount, 0);
size_t eventRecordsSize = 0;
- uint32_t eventRecordsOffset =
- numeric_cast<uint32_t>((eventRecords.size() + categoryNameBuffer.size()) * uint32_t_size);
+ uint32_t eventRecordsOffset = armnn::numeric_cast<uint32_t>(
+ (eventRecords.size() + categoryNameBuffer.size()) * uint32_t_size);
for (size_t counterIndex = 0, eventRecordIndex = 0, eventRecordOffsetIndex = 0;
counterIndex < counterCount;
counterIndex++, eventRecordIndex++, eventRecordOffsetIndex++)
@@ -257,12 +254,13 @@ bool SendCounterPacket::CreateCategoryRecord(const CategoryPtr& category,
// Add the event record offset to the event pointer table offset field
eventRecordOffsets[eventRecordOffsetIndex] = eventRecordsOffset;
- eventRecordsOffset += numeric_cast<uint32_t>(eventRecord.size() * uint32_t_size);
+ eventRecordsOffset += armnn::numeric_cast<uint32_t>(eventRecord.size() * uint32_t_size);
}
// Category record word 3:
// 0:31 [32] name_offset (offset from the beginning of the category data pool to the name field)
- const uint32_t categoryRecordWord3 = numeric_cast<uint32_t>((3u + eventRecordOffsets.size()) * uint32_t_size);
+ const uint32_t categoryRecordWord3 = armnn::numeric_cast<uint32_t>(
+ (3u + eventRecordOffsets.size()) * uint32_t_size);
// Calculate the size in words of the category record
const size_t categoryRecordSize = 3u +// The size of the fixed part (device + counter_set + event_count +
@@ -399,8 +397,6 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter,
EventRecord& eventRecord,
std::string& errorMessage)
{
- using namespace boost::numeric;
-
ARMNN_ASSERT(counter);
uint16_t counterUid = counter->m_Uid;
@@ -499,7 +495,7 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter,
// The size of the description buffer in bytes
const uint32_t eventRecordWord7 = includeUnits ?
eventRecordWord6 +
- numeric_cast<uint32_t>(counterDescriptionBuffer.size()
+ armnn::numeric_cast<uint32_t>(counterDescriptionBuffer.size()
* uint32_t_size) :
0;
@@ -553,8 +549,6 @@ bool SendCounterPacket::CreateEventRecord(const CounterPtr& counter,
void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& counterDirectory)
{
- using namespace boost::numeric;
-
// Get the amount of data that needs to be put into the packet
const uint16_t categoryCount = counterDirectory.GetCategoryCount();
const uint16_t deviceCount = counterDirectory.GetDeviceCount();
@@ -581,9 +575,9 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
size_t deviceIndex = 0;
size_t deviceRecordOffsetIndex = 0;
- pointerTableOffset = numeric_cast<uint32_t>(deviceCount * uint32_t_size +
- counterSetCount * uint32_t_size +
- categoryCount * uint32_t_size);
+ pointerTableOffset = armnn::numeric_cast<uint32_t>(deviceCount * uint32_t_size +
+ counterSetCount * uint32_t_size +
+ categoryCount * uint32_t_size);
for (auto it = devices.begin(); it != devices.end(); it++)
{
const DevicePtr& device = it->second;
@@ -600,7 +594,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
// Add the device record offset to the device records pointer table offset field
deviceRecordOffsets[deviceRecordOffsetIndex] = pointerTableOffset;
- pointerTableOffset += numeric_cast<uint32_t>(deviceRecord.size() * uint32_t_size);
+ pointerTableOffset += armnn::numeric_cast<uint32_t>(deviceRecord.size() * uint32_t_size);
deviceIndex++;
deviceRecordOffsetIndex++;
@@ -618,7 +612,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
size_t counterSetIndex = 0;
size_t counterSetRecordOffsetIndex = 0;
- pointerTableOffset -= numeric_cast<uint32_t>(deviceCount * uint32_t_size);
+ pointerTableOffset -= armnn::numeric_cast<uint32_t>(deviceCount * uint32_t_size);
for (auto it = counterSets.begin(); it != counterSets.end(); it++)
{
const CounterSetPtr& counterSet = it->second;
@@ -635,7 +629,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
// Add the counter set record offset to the counter set records pointer table offset field
counterSetRecordOffsets[counterSetRecordOffsetIndex] = pointerTableOffset;
- pointerTableOffset += numeric_cast<uint32_t>(counterSetRecord.size() * uint32_t_size);
+ pointerTableOffset += armnn::numeric_cast<uint32_t>(counterSetRecord.size() * uint32_t_size);
counterSetIndex++;
counterSetRecordOffsetIndex++;
@@ -653,7 +647,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
size_t categoryIndex = 0;
size_t categoryRecordOffsetIndex = 0;
- pointerTableOffset -= numeric_cast<uint32_t>(counterSetCount * uint32_t_size);
+ pointerTableOffset -= armnn::numeric_cast<uint32_t>(counterSetCount * uint32_t_size);
for (auto it = categories.begin(); it != categories.end(); it++)
{
const CategoryPtr& category = *it;
@@ -670,7 +664,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
// Add the category record offset to the category records pointer table offset field
categoryRecordOffsets[categoryRecordOffsetIndex] = pointerTableOffset;
- pointerTableOffset += numeric_cast<uint32_t>(categoryRecord.size() * uint32_t_size);
+ pointerTableOffset += armnn::numeric_cast<uint32_t>(categoryRecord.size() * uint32_t_size);
categoryIndex++;
categoryRecordOffsetIndex++;
@@ -708,7 +702,8 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
// Packet header word 1:
// 0:31 [32] data_length: length of data, in bytes
- uint32_t packetHeaderWord1 = numeric_cast<uint32_t>(counterDirectoryPacketDataLength * uint32_t_size);
+ uint32_t packetHeaderWord1 = armnn::numeric_cast<uint32_t>(
+ counterDirectoryPacketDataLength * uint32_t_size);
// Create the packet header
uint32_t packetHeader[2]
@@ -739,9 +734,9 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
// Body header word 3:
// 0:31 [32] counter_set_pointer_table_offset: offset to the counter_set_pointer_table
- const uint32_t bodyHeaderWord3 =
- numeric_cast<uint32_t>(deviceRecordOffsets.size() * uint32_t_size // The size of the
- + bodyHeaderSizeBytes); // device records pointer table
+ const uint32_t bodyHeaderWord3 = armnn::numeric_cast<uint32_t>(deviceRecordOffsets.size() *
+ uint32_t_size + // The size of the
+ bodyHeaderSizeBytes); // device records pointer table
// Body header word 4:
// 16:31 [16] categories_count: number of entries in the categories_pointer_table
@@ -751,7 +746,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
// Body header word 3:
// 0:31 [32] categories_pointer_table_offset: offset to the categories_pointer_table
const uint32_t bodyHeaderWord5 =
- numeric_cast<uint32_t>(
+ armnn::numeric_cast<uint32_t>(
deviceRecordOffsets.size() * uint32_t_size + // The size of the device records
counterSetRecordOffsets.size() * uint32_t_size // pointer table, plus the size of
+ bodyHeaderSizeBytes); // the counter set pointer table
@@ -806,7 +801,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
ARMNN_NO_CONVERSION_WARN_END
// Calculate the total size in bytes of the counter directory packet
- uint32_t totalSize = numeric_cast<uint32_t>(counterDirectoryPacketSize * uint32_t_size);
+ uint32_t totalSize = armnn::numeric_cast<uint32_t>(counterDirectoryPacketSize * uint32_t_size);
// Reserve space in the buffer for the packet
uint32_t reserved = 0;
@@ -826,7 +821,7 @@ void SendCounterPacket::SendCounterDirectoryPacket(const ICounterDirectory& coun
for (uint32_t counterDirectoryPacketWord : counterDirectoryPacket)
{
WriteUint32(writeBuffer, offset, counterDirectoryPacketWord);
- offset += numeric_cast<uint32_t>(uint32_t_size);
+ offset += armnn::numeric_cast<uint32_t>(uint32_t_size);
}
m_BufferManager.Commit(writeBuffer, totalSize);
@@ -842,7 +837,7 @@ void SendCounterPacket::SendPeriodicCounterCapturePacket(uint64_t timestamp, con
uint32_t packetClass = 0;
uint32_t packetType = 0;
uint32_t headerSize = 2 * uint32_t_size;
- uint32_t bodySize = uint64_t_size + numeric_cast<uint32_t>(values.size()) * (uint16_t_size + uint32_t_size);
+ uint32_t bodySize = uint64_t_size + armnn::numeric_cast<uint32_t>(values.size()) * (uint16_t_size + uint32_t_size);
uint32_t totalSize = headerSize + bodySize;
uint32_t offset = 0;
uint32_t reserved = 0;
@@ -891,7 +886,7 @@ void SendCounterPacket::SendPeriodicCounterSelectionPacket(uint32_t capturePerio
uint32_t packetFamily = 0;
uint32_t packetId = 4;
uint32_t headerSize = 2 * uint32_t_size;
- uint32_t bodySize = uint32_t_size + numeric_cast<uint32_t>(selectedCounterIds.size()) * uint16_t_size;
+ uint32_t bodySize = uint32_t_size + armnn::numeric_cast<uint32_t>(selectedCounterIds.size()) * uint16_t_size;
uint32_t totalSize = headerSize + bodySize;
uint32_t offset = 0;
uint32_t reserved = 0;
diff --git a/src/profiling/SendThread.cpp b/src/profiling/SendThread.cpp
index 86e6c05a02..16ef2399f7 100644
--- a/src/profiling/SendThread.cpp
+++ b/src/profiling/SendThread.cpp
@@ -8,10 +8,11 @@
#include <armnn/Exceptions.hpp>
#include <armnn/Conversion.hpp>
+#include <armnn/utility/NumericCast.hpp>
+
#include <Processes.hpp>
#include <boost/format.hpp>
-#include <boost/numeric/conversion/cast.hpp>
#include <cstring>
@@ -21,8 +22,6 @@ namespace armnn
namespace profiling
{
-using boost::numeric_cast;
-
SendThread::SendThread(armnn::profiling::ProfilingStateMachine& profilingStateMachine,
armnn::profiling::IBufferManager& buffer,
armnn::profiling::ISendCounterPacket& sendCounterPacket,
@@ -235,7 +234,7 @@ void SendThread::FlushBuffer(IProfilingConnection& profilingConnection, bool not
if (profilingConnection.IsOpen())
{
// Write a packet to the profiling connection. Silently ignore any write error and continue
- profilingConnection.WritePacket(readBuffer, boost::numeric_cast<uint32_t>(readBufferSize));
+ profilingConnection.WritePacket(readBuffer, armnn::numeric_cast<uint32_t>(readBufferSize));
// Set the flag that indicates whether at least a packet has been sent
packetsSent = true;
diff --git a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
index f9df633a1c..943650a8f1 100644
--- a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
+++ b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp
@@ -11,7 +11,6 @@
#include <Runtime.hpp>
#include "TestTimelinePacketHandler.hpp"
-#include <boost/numeric/conversion/cast.hpp>
#include <boost/test/unit_test.hpp>
#include <cstdio>
diff --git a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
index d6700bc41a..0feed4138f 100644
--- a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
+++ b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp
@@ -7,11 +7,11 @@
#include <Filesystem.hpp>
#include <Runtime.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
+#include <armnn/utility/NumericCast.hpp>
#include <fstream>
#include <sstream>
-#include <boost/numeric/conversion/cast.hpp>
#include <boost/test/unit_test.hpp>
using namespace armnn::profiling;
@@ -20,7 +20,7 @@ namespace
{
const std::vector<char> g_Data = { 'd', 'u', 'm', 'm', 'y' };
-const uint32_t g_DataLength = boost::numeric_cast<uint32_t>(g_Data.size());
+const uint32_t g_DataLength = armnn::numeric_cast<uint32_t>(g_Data.size());
const unsigned char* g_DataPtr = reinterpret_cast<const unsigned char*>(g_Data.data());
class DummyProfilingConnection : public IProfilingConnection
diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp
index 8bcf27a8d1..19d79e25e7 100644
--- a/src/profiling/test/ProfilingMocks.hpp
+++ b/src/profiling/test/ProfilingMocks.hpp
@@ -19,8 +19,7 @@
#include <armnn/Conversion.hpp>
#include <armnn/utility/Assert.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
-
-#include <boost/numeric/conversion/cast.hpp>
+#include <armnn/utility/NumericCast.hpp>
#include <atomic>
#include <condition_variable>
@@ -571,10 +570,10 @@ public:
}
// Getters for counts
- uint16_t GetCategoryCount() const override { return boost::numeric_cast<uint16_t>(m_Categories.size()); }
- uint16_t GetDeviceCount() const override { return boost::numeric_cast<uint16_t>(m_Devices.size()); }
- uint16_t GetCounterSetCount() const override { return boost::numeric_cast<uint16_t>(m_CounterSets.size()); }
- uint16_t GetCounterCount() const override { return boost::numeric_cast<uint16_t>(m_Counters.size()); }
+ uint16_t GetCategoryCount() const override { return armnn::numeric_cast<uint16_t>(m_Categories.size()); }
+ uint16_t GetDeviceCount() const override { return armnn::numeric_cast<uint16_t>(m_Devices.size()); }
+ uint16_t GetCounterSetCount() const override { return armnn::numeric_cast<uint16_t>(m_CounterSets.size()); }
+ uint16_t GetCounterCount() const override { return armnn::numeric_cast<uint16_t>(m_Counters.size()); }
// Getters for collections
const Categories& GetCategories() const override { return m_Categories; }
diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp
index 8050eaa508..09639bfae7 100644
--- a/src/profiling/test/ProfilingTestUtils.cpp
+++ b/src/profiling/test/ProfilingTestUtils.cpp
@@ -7,6 +7,8 @@
#include "ProfilingUtils.hpp"
#include <armnn/Descriptors.hpp>
+#include <armnn/utility/NumericCast.hpp>
+
#include <LabelsAndEventClasses.hpp>
#include <Processes.hpp>
#include <ProfilingService.hpp>
@@ -20,10 +22,10 @@ uint32_t GetStreamMetaDataPacketSize()
{
uint32_t sizeUint32 = sizeof(uint32_t);
uint32_t payloadSize = 0;
- payloadSize += boost::numeric_cast<uint32_t>(GetSoftwareInfo().size()) + 1;
- payloadSize += boost::numeric_cast<uint32_t>(GetHardwareVersion().size()) + 1;
- payloadSize += boost::numeric_cast<uint32_t>(GetSoftwareVersion().size()) + 1;
- payloadSize += boost::numeric_cast<uint32_t>(GetProcessName().size()) + 1;
+ payloadSize += armnn::numeric_cast<uint32_t>(GetSoftwareInfo().size()) + 1;
+ payloadSize += armnn::numeric_cast<uint32_t>(GetHardwareVersion().size()) + 1;
+ payloadSize += armnn::numeric_cast<uint32_t>(GetSoftwareVersion().size()) + 1;
+ payloadSize += armnn::numeric_cast<uint32_t>(GetProcessName().size()) + 1;
// Add packetVersionEntries
payloadSize += 13 * 2 * sizeUint32;
@@ -105,7 +107,7 @@ ProfilingGuid VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid,
// Utils
unsigned int uint32_t_size = sizeof(uint32_t);
unsigned int uint64_t_size = sizeof(uint64_t);
- unsigned int label_size = boost::numeric_cast<unsigned int>(label.size());
+ unsigned int label_size = armnn::numeric_cast<unsigned int>(label.size());
// Check the decl id
uint32_t eventClassDeclId = ReadUint32(readableData, offset);
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp
index f616442df0..b06d3b0bc6 100644
--- a/src/profiling/test/ProfilingTests.cpp
+++ b/src/profiling/test/ProfilingTests.cpp
@@ -33,14 +33,13 @@
#include <armnn/Utils.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
+#include <armnn/utility/NumericCast.hpp>
#include <common/include/CommandHandlerKey.hpp>
#include <common/include/CommandHandlerRegistry.hpp>
#include <common/include/SocketConnectionException.hpp>
#include <common/include/Packet.hpp>
-#include <boost/numeric/conversion/cast.hpp>
-
#include <cstdint>
#include <cstring>
#include <iostream>
@@ -1750,8 +1749,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter)
BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData)
{
- using boost::numeric_cast;
-
ProfilingStateMachine profilingStateMachine;
class TestCaptureThread : public IPeriodicCounterCapture
@@ -1798,8 +1795,8 @@ BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData)
SendCounterPacket sendCounterPacket(mockBuffer);
SendThread sendThread(profilingStateMachine, mockBuffer, sendCounterPacket);
- uint32_t sizeOfUint32 = numeric_cast<uint32_t>(sizeof(uint32_t));
- uint32_t sizeOfUint16 = numeric_cast<uint32_t>(sizeof(uint16_t));
+ uint32_t sizeOfUint32 = armnn::numeric_cast<uint32_t>(sizeof(uint32_t));
+ uint32_t sizeOfUint16 = armnn::numeric_cast<uint32_t>(sizeof(uint16_t));
// Data with period and counters
uint32_t period1 = armnn::LOWEST_CAPTURE_PERIOD;
@@ -2024,14 +2021,12 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceNotActive)
BOOST_AUTO_TEST_CASE(CheckConnectionAcknowledged)
{
- using boost::numeric_cast;
-
const uint32_t packetFamilyId = 0;
const uint32_t connectionPacketId = 0x10000;
const uint32_t version = 1;
- uint32_t sizeOfUint32 = numeric_cast<uint32_t>(sizeof(uint32_t));
- uint32_t sizeOfUint16 = numeric_cast<uint32_t>(sizeof(uint16_t));
+ uint32_t sizeOfUint32 = armnn::numeric_cast<uint32_t>(sizeof(uint32_t));
+ uint32_t sizeOfUint16 = armnn::numeric_cast<uint32_t>(sizeof(uint16_t));
// Data with period and counters
uint32_t period1 = 10;
@@ -2407,8 +2402,6 @@ BOOST_AUTO_TEST_CASE(CheckPeriodicCounterCaptureThread)
BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest1)
{
- using boost::numeric_cast;
-
const uint32_t familyId = 0;
const uint32_t packetId = 3;
const uint32_t version = 1;
@@ -2453,7 +2446,7 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest1)
BOOST_TEST(header1Word1 == 24); // data length
uint32_t bodyHeader1Word0 = ReadUint32(readBuffer1, 8);
- uint16_t deviceRecordCount = numeric_cast<uint16_t>(bodyHeader1Word0 >> 16);
+ uint16_t deviceRecordCount = armnn::numeric_cast<uint16_t>(bodyHeader1Word0 >> 16);
BOOST_TEST(deviceRecordCount == 0); // device_records_count
auto readBuffer2 = mockBuffer2.GetReadableBuffer();
@@ -2469,8 +2462,6 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest1)
BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest2)
{
- using boost::numeric_cast;
-
const uint32_t familyId = 0;
const uint32_t packetId = 3;
const uint32_t version = 1;
@@ -2522,9 +2513,9 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest2)
const uint32_t bodyHeader1Word3 = ReadUint32(readBuffer1, 20);
const uint32_t bodyHeader1Word4 = ReadUint32(readBuffer1, 24);
const uint32_t bodyHeader1Word5 = ReadUint32(readBuffer1, 28);
- const uint16_t deviceRecordCount = numeric_cast<uint16_t>(bodyHeader1Word0 >> 16);
- const uint16_t counterSetRecordCount = numeric_cast<uint16_t>(bodyHeader1Word2 >> 16);
- const uint16_t categoryRecordCount = numeric_cast<uint16_t>(bodyHeader1Word4 >> 16);
+ const uint16_t deviceRecordCount = armnn::numeric_cast<uint16_t>(bodyHeader1Word0 >> 16);
+ const uint16_t counterSetRecordCount = armnn::numeric_cast<uint16_t>(bodyHeader1Word2 >> 16);
+ const uint16_t categoryRecordCount = armnn::numeric_cast<uint16_t>(bodyHeader1Word4 >> 16);
BOOST_TEST(deviceRecordCount == 1); // device_records_count
BOOST_TEST(bodyHeader1Word1 == 0 + bodyHeaderSizeBytes); // device_records_pointer_table_offset
BOOST_TEST(counterSetRecordCount == 1); // counter_set_count
diff --git a/src/profiling/test/RequestCountersPacketHandler.cpp b/src/profiling/test/RequestCountersPacketHandler.cpp
index 230c38857f..3ba50503a1 100644
--- a/src/profiling/test/RequestCountersPacketHandler.cpp
+++ b/src/profiling/test/RequestCountersPacketHandler.cpp
@@ -6,8 +6,10 @@
#include "RequestCountersPacketHandler.hpp"
#include "DirectoryCaptureCommandHandler.hpp"
-#include <common/include/PacketVersionResolver.hpp>
+#include <armnn/utility/NumericCast.hpp>
+
+#include <common/include/PacketVersionResolver.hpp>
#include <common/include/ProfilingException.hpp>
namespace armnn
@@ -53,7 +55,7 @@ void RequestCountersPacketHandler::SendCounterSelectionPacket()
uint32_t uint32_t_size = sizeof(uint32_t);
uint32_t offset = 0;
- uint32_t bodySize = uint32_t_size + boost::numeric_cast<uint32_t>(m_IdList.size()) * uint16_t_size;
+ uint32_t bodySize = uint32_t_size + armnn::numeric_cast<uint32_t>(m_IdList.size()) * uint16_t_size;
auto uniqueData = std::make_unique<unsigned char[]>(bodySize);
auto data = reinterpret_cast<unsigned char*>(uniqueData.get());
diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp
index 87cfb5bf58..950f8ffad0 100644
--- a/src/profiling/test/SendCounterPacketTests.cpp
+++ b/src/profiling/test/SendCounterPacketTests.cpp
@@ -20,9 +20,7 @@
#include <common/include/Constants.hpp>
-
#include <boost/test/unit_test.hpp>
-#include <boost/numeric/conversion/cast.hpp>
#include <chrono>
@@ -289,9 +287,7 @@ BOOST_AUTO_TEST_CASE(SendPeriodicCounterCapturePacketTest)
BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest)
{
- using boost::numeric_cast;
-
- uint32_t sizeUint32 = numeric_cast<uint32_t>(sizeof(uint32_t));
+ uint32_t sizeUint32 = armnn::numeric_cast<uint32_t>(sizeof(uint32_t));
// Error no space left in buffer
MockBufferManager mockBuffer1(10);
@@ -302,10 +298,10 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest)
std::string processName = GetProcessName().substr(0, 60);
- uint32_t infoSize = numeric_cast<uint32_t>(GetSoftwareInfo().size()) + 1;
- uint32_t hardwareVersionSize = numeric_cast<uint32_t>(GetHardwareVersion().size()) + 1;
- uint32_t softwareVersionSize = numeric_cast<uint32_t>(GetSoftwareVersion().size()) + 1;
- uint32_t processNameSize = numeric_cast<uint32_t>(processName.size()) + 1;
+ uint32_t infoSize = armnn::numeric_cast<uint32_t>(GetSoftwareInfo().size()) + 1;
+ uint32_t hardwareVersionSize = armnn::numeric_cast<uint32_t>(GetHardwareVersion().size()) + 1;
+ uint32_t softwareVersionSize = armnn::numeric_cast<uint32_t>(GetSoftwareVersion().size()) + 1;
+ uint32_t processNameSize = armnn::numeric_cast<uint32_t>(processName.size()) + 1;
// Supported Packets
// Packet Encoding version 1.0.0
@@ -352,9 +348,11 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest)
BOOST_TEST(((headerWord0 >> 26) & 0x3F) == 0); // packet family
BOOST_TEST(((headerWord0 >> 16) & 0x3FF) == 0); // packet id
- uint32_t totalLength = numeric_cast<uint32_t>(2 * sizeUint32 + 10 * sizeUint32 + infoSize + hardwareVersionSize +
- softwareVersionSize + processNameSize + sizeUint32 +
- 2 * packetEntries * sizeUint32);
+ uint32_t totalLength = armnn::numeric_cast<uint32_t>(2 * sizeUint32 +
+ 10 * sizeUint32 + infoSize +
+ hardwareVersionSize + softwareVersionSize +
+ processNameSize + sizeUint32 +
+ 2 * packetEntries * sizeUint32);
BOOST_TEST(headerWord1 == totalLength - (2 * sizeUint32)); // data length
@@ -366,7 +364,7 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest)
BOOST_TEST(ReadUint32(readBuffer2, offset) == MAX_METADATA_PACKET_LENGTH); // max_data_len
offset += sizeUint32;
int pid = armnnUtils::Processes::GetCurrentId();
- BOOST_TEST(ReadUint32(readBuffer2, offset) == numeric_cast<uint32_t>(pid));
+ BOOST_TEST(ReadUint32(readBuffer2, offset) == armnn::numeric_cast<uint32_t>(pid));
offset += sizeUint32;
uint32_t poolOffset = 10 * sizeUint32;
BOOST_TEST(ReadUint32(readBuffer2, offset) == poolOffset); // offset_info
@@ -942,7 +940,7 @@ BOOST_AUTO_TEST_CASE(CreateCategoryRecordTest)
ARMNN_ASSERT(counter1);
ARMNN_ASSERT(counter2);
ARMNN_ASSERT(counter3);
- uint16_t categoryEventCount = boost::numeric_cast<uint16_t>(counters.size());
+ uint16_t categoryEventCount = armnn::numeric_cast<uint16_t>(counters.size());
// Create a category record
SendCounterPacket::CategoryRecord categoryRecord;
diff --git a/src/profiling/test/SendCounterPacketTests.hpp b/src/profiling/test/SendCounterPacketTests.hpp
index ef8f63de0f..2eac395ecf 100644
--- a/src/profiling/test/SendCounterPacketTests.hpp
+++ b/src/profiling/test/SendCounterPacketTests.hpp
@@ -15,8 +15,7 @@
#include <armnn/Conversion.hpp>
#include <armnn/utility/Assert.hpp>
#include <armnn/utility/IgnoreUnused.hpp>
-
-#include <boost/numeric/conversion/cast.hpp>
+#include <armnn/utility/NumericCast.hpp>
#include <atomic>
#include <condition_variable>
diff --git a/src/profiling/test/TimelinePacketTests.cpp b/src/profiling/test/TimelinePacketTests.cpp
index 4f056ce761..811918a3e3 100644
--- a/src/profiling/test/TimelinePacketTests.cpp
+++ b/src/profiling/test/TimelinePacketTests.cpp
@@ -6,10 +6,11 @@
#include <Threads.hpp>
#include <ProfilingUtils.hpp>
+#include <armnn/utility/NumericCast.hpp>
+
#include <common/include/SwTrace.hpp>
#include <boost/test/unit_test.hpp>
-#include <boost/numeric/conversion/cast.hpp>
using namespace armnn::profiling;
@@ -55,7 +56,7 @@ BOOST_AUTO_TEST_CASE(TimelineLabelPacketTestBufferExhaustionFixedValue)
TimelinePacketStatus result = WriteTimelineLabelBinaryPacket(profilingGuid,
label,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
BOOST_CHECK(numberOfBytesWritten == 0);
@@ -71,7 +72,7 @@ BOOST_AUTO_TEST_CASE(TimelineLabelPacketTestInvalidLabel)
TimelinePacketStatus result = WriteTimelineLabelBinaryPacket(profilingGuid,
label,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Error);
BOOST_CHECK(numberOfBytesWritten == 0);
@@ -87,7 +88,7 @@ BOOST_AUTO_TEST_CASE(TimelineLabelPacketTestSingleConstructionOfData)
TimelinePacketStatus result = WriteTimelineLabelBinaryPacket(profilingGuid,
label,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Ok);
BOOST_CHECK(numberOfBytesWritten == 28);
@@ -178,7 +179,7 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketSmallBufferSizeTest)
tailGuid,
attributeGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
BOOST_CHECK(numberOfBytesWritten == 0);
@@ -201,7 +202,7 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketInvalidRelationTest)
tailGuid,
attributeGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten),
armnn::InvalidArgumentException);
@@ -225,7 +226,7 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketTestDataConstruction)
tailGuid,
attributeGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Ok);
BOOST_CHECK(numberOfBytesWritten == 40);
@@ -282,7 +283,7 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketExecutionLinkTestDataConstruction
tailGuid,
attributeGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Ok);
BOOST_CHECK(numberOfBytesWritten == 40);
@@ -338,7 +339,7 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketDataLinkTestDataConstruction)
tailGuid,
attributeGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Ok);
BOOST_CHECK(numberOfBytesWritten == 40);
@@ -394,7 +395,7 @@ BOOST_AUTO_TEST_CASE(TimelineRelationshipPacketLabelLinkTestDataConstruction)
tailGuid,
attributeGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Ok);
BOOST_CHECK(numberOfBytesWritten == 40);
@@ -460,7 +461,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestFullConstruction)
std::vector<unsigned char> buffer(512, 0);
unsigned int numberOfBytesWritten = 789u;
TimelinePacketStatus result = WriteTimelineMessageDirectoryPackage(buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Ok);
@@ -527,7 +528,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestFullConstruction)
// Check the ui_name
std::vector<uint32_t> swTraceString;
arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
- offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
+ offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
uint32_t swTraceUINameLength = ReadUint32(buffer.data(), offset);
BOOST_CHECK(swTraceUINameLength == 14); // ui_name length including the null-terminator
@@ -539,7 +540,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestFullConstruction)
// Check arg_types
arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
- offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
+ offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
uint32_t swTraceArgTypesLength = ReadUint32(buffer.data(), offset);
BOOST_CHECK(swTraceArgTypesLength == 3); // arg_types length including the null-terminator
@@ -551,7 +552,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestFullConstruction)
// Check arg_names
arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
- offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
+ offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
uint32_t swTraceArgNamesLength = ReadUint32(buffer.data(), offset);
BOOST_CHECK(swTraceArgNamesLength == 11); // arg_names length including the null-terminator
@@ -563,7 +564,7 @@ BOOST_AUTO_TEST_CASE(TimelineMessageDirectoryPacketTestFullConstruction)
// Check second message decl_id
arm::pipe::StringToSwTraceString<arm::pipe::SwTraceCharPolicy>(label, swTraceString);
- offset += (boost::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
+ offset += (armnn::numeric_cast<unsigned int>(swTraceString.size()) - 1) * uint32_t_size;
readDeclId = ReadUint32(buffer.data(), offset);
BOOST_CHECK(readDeclId == 1);
@@ -613,7 +614,7 @@ BOOST_AUTO_TEST_CASE(TimelineEntityPacketTestBufferExhaustedWithFixedBufferSize)
unsigned int numberOfBytesWritten = 789u;
TimelinePacketStatus result = WriteTimelineEntityBinary(profilingGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
BOOST_CHECK(numberOfBytesWritten == 0);
@@ -627,7 +628,7 @@ BOOST_AUTO_TEST_CASE(TimelineEntityPacketTestFullConstructionOfData)
unsigned int numberOfBytesWritten = 789u;
TimelinePacketStatus result = WriteTimelineEntityBinary(profilingGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Ok);
BOOST_CHECK(numberOfBytesWritten == 12);
@@ -685,7 +686,7 @@ BOOST_AUTO_TEST_CASE(TimelineEventClassTestBufferExhaustionFixedValue)
TimelinePacketStatus result = WriteTimelineEventClassBinary(profilingGuid,
profilingNameGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
BOOST_CHECK(numberOfBytesWritten == 0);
@@ -701,7 +702,7 @@ BOOST_AUTO_TEST_CASE(TimelineEventClassTestFullConstructionOfData)
TimelinePacketStatus result = WriteTimelineEventClassBinary(profilingGuid,
profilingNameGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Ok);
BOOST_CHECK(numberOfBytesWritten == 20);
@@ -770,7 +771,7 @@ BOOST_AUTO_TEST_CASE(TimelineEventPacketTestBufferExhaustionFixedValue)
threadId,
profilingGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::BufferExhaustion);
BOOST_CHECK(numberOfBytesWritten == 0);
@@ -788,7 +789,7 @@ BOOST_AUTO_TEST_CASE(TimelineEventPacketTestFullConstructionOfData)
threadId,
profilingGuid,
buffer.data(),
- boost::numeric_cast<unsigned int>(buffer.size()),
+ armnn::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Ok);