14 #include <boost/numeric/conversion/cast.hpp> 59 return c < 128 && (std::isalnum(c) || c ==
'_');
86 template <
typename SwTracePolicy>
90 return std::all_of(s.begin(), s.end(), [](
unsigned char c) {
return SwTracePolicy::IsValidChar(c); });
93 template <
typename SwTracePolicy>
100 outputBuffer.clear();
103 if (!IsValidSwTraceString<SwTracePolicy>(s))
109 size_t s_size = s.size() + 1;
114 size_t outBufferSize = 1 + (s_size /
uint32_t_size) + (s_size % uint32_t_size != 0 ? 1 : 0);
115 outputBuffer.resize(outBufferSize,
'\0');
119 std::memcpy(outputBuffer.data() + 1, s.data(), s_size);
124 template <
typename SwTracePolicy,
125 typename SwTraceBuffer = std::vector<uint32_t>>
129 SwTraceBuffer tempSwTraceBuffer;
130 bool result = StringToSwTraceString<SwTracePolicy>(directoryComponent, tempSwTraceBuffer);
136 swTraceBuffer.insert(swTraceBuffer.end(), tempSwTraceBuffer.begin(), tempSwTraceBuffer.end());
145 void WriteBytes(
const IPacketBuffer& packetBuffer,
unsigned int offset,
const void* value,
unsigned int valueSize);
149 uint32_t
ConstructHeader(uint32_t packetFamily, uint32_t packetClass, uint32_t packetType);
159 void WriteBytes(
unsigned char* buffer,
unsigned int offset,
const void* value,
unsigned int valueSize);
161 void WriteUint64(
unsigned char* buffer,
unsigned int offset, uint64_t value);
163 void WriteUint32(
unsigned char* buffer,
unsigned int offset, uint32_t value);
165 void WriteUint16(
unsigned char* buffer,
unsigned int offset, uint16_t value);
167 void WriteUint8(
unsigned char* buffer,
unsigned int offset, uint8_t value);
179 void ReadBytes(
const unsigned char* buffer,
unsigned int offset,
unsigned int valueSize, uint8_t outValue[]);
181 uint64_t
ReadUint64(
unsigned const char* buffer,
unsigned int offset);
183 uint32_t
ReadUint32(
unsigned const char* buffer,
unsigned int offset);
185 uint16_t
ReadUint16(
unsigned const char* buffer,
unsigned int offset);
187 uint8_t
ReadUint8(
unsigned const char* buffer,
unsigned int offset);
190 uint32_t packetClass,
193 uint32_t sequenceNumbered,
194 uint32_t dataLength);
216 const std::string& label,
217 unsigned char* buffer,
218 unsigned int bufferSize,
219 unsigned int& numberOfBytesWritten);
222 unsigned char* buffer,
223 unsigned int bufferSize,
224 unsigned int& numberOfBytesWritten);
227 uint64_t relationshipGuid,
230 unsigned char* buffer,
231 unsigned int bufferSize,
232 unsigned int& numberOfBytesWritten);
235 unsigned int bufferSize,
236 unsigned int& numberOfBytesWritten);
239 unsigned char* buffer,
240 unsigned int bufferSize,
241 unsigned int& numberOfBytesWritten);
244 std::thread::id threadId,
245 uint64_t profilingGuid,
246 unsigned char* buffer,
247 unsigned int bufferSize,
248 unsigned int& numberOfBytesWritten);
268 bool operator==(
const std::vector<uint8_t>& left, std::thread::id right);
bool StringToSwTraceString(const std::string &s, std::vector< uint32_t > &outputBuffer)
TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char *buffer, unsigned int remainingBufferSize, unsigned int &numberOfBytesWritten)
std::string GetHardwareVersion()
void WriteUint16(const IPacketBufferPtr &packetBuffer, unsigned int offset, uint16_t value)
void ReadBytes(const IPacketBufferPtr &packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
void WriteUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset, uint32_t value)
uint64_t ReadUint64(const IPacketBufferPtr &packetBuffer, unsigned int offset)
std::pair< uint32_t, uint32_t > CreateTimelinePacketHeader(uint32_t packetFamily, uint32_t packetClass, uint32_t packetType, uint32_t streamId, uint32_t sequenceNumbered, uint32_t dataLength)
Creates a timeline packet header.
std::string GetProcessName()
Exception(const std::string &message)
uint16_t ReadUint16(const IPacketBufferPtr &packetBuffer, unsigned int offset)
uint8_t ReadUint8(const IPacketBufferPtr &packetBuffer, unsigned int offset)
Copyright (c) 2020 ARM Limited.
std::string GetSoftwareInfo()
TimelinePacketStatus WriteTimelineRelationshipBinary(ProfilingRelationshipType relationshipType, uint64_t relationshipGuid, uint64_t headGuid, uint64_t tailGuid, unsigned char *buffer, unsigned int remainingBufferSize, unsigned int &numberOfBytesWritten)
uint16_t GetNextUid(bool peekOnly)
SwTraceMessage ReadSwTraceMessage(const unsigned char *packetBuffer, unsigned int &offset)
bool operator==(const armnn::DataLayout &dataLayout, const DataLayoutIndexed &indexed)
Equality methods.
std::vector< std::string > m_ArgNames
bool IsValidSwTraceString(const std::string &s)
std::vector< uint16_t > GetNextCounterUids(uint16_t firstUid, uint16_t cores)
std::vector< char > m_ArgTypes
void WriteBytes(const IPacketBufferPtr &packetBuffer, unsigned int offset, const void *value, unsigned int valueSize)
uint32_t ConstructHeader(uint32_t packetFamily, uint32_t packetId)
ProfilingRelationshipType
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
void WriteUint8(const IPacketBufferPtr &packetBuffer, unsigned int offset, uint8_t value)
void WriteUint64(const std::unique_ptr< IPacketBuffer > &packetBuffer, unsigned int offset, uint64_t value)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
static bool IsValidChar(unsigned char c)
std::string GetSoftwareVersion()
TimelinePacketStatus WriteTimelineEventClassBinary(uint64_t profilingGuid, unsigned char *buffer, unsigned int remainingBufferSize, unsigned int &numberOfBytesWritten)
uint32_t CalculateSizeOfPaddedSwString(const std::string &str)
Base class for all ArmNN exceptions so that users can filter to just those.
static bool IsValidChar(unsigned char c)
TimelinePacketStatus WriteTimelineLabelBinaryPacket(uint64_t profilingGuid, const std::string &label, unsigned char *buffer, unsigned int remainingBufferSize, unsigned int &numberOfBytesWritten)
TimelinePacketStatus WriteTimelineEventBinary(uint64_t timestamp, std::thread::id threadId, uint64_t profilingGuid, unsigned char *buffer, unsigned int remainingBufferSize, unsigned int &numberOfBytesWritten)
std::string CentreAlignFormatting(const std::string &stringToPass, const int spacingWidth)
bool ConvertDirectoryComponent(const std::string &directoryComponent, SwTraceBuffer &swTraceBuffer)
TimelinePacketStatus WriteTimelineEntityBinary(uint64_t profilingGuid, unsigned char *buffer, unsigned int remainingBufferSize, unsigned int &numberOfBytesWritten)
void PrintCounterDirectory(ICounterDirectory &counterDirectory)
std::unique_ptr< IPacketBuffer > IPacketBufferPtr
static bool IsValidChar(unsigned char c)