From 3201eea0565ce2bb0418d1936fec71bdeb14c084 Mon Sep 17 00:00:00 2001 From: Keith Davis Date: Thu, 24 Oct 2019 17:30:41 +0100 Subject: IVGCVSW-3444 File Only Profiling Connection * Add FileOnlyProfilingConnection Decorator * Fix bug where Conn Ack not automatically sent back * Modify GatordMock to use the Counter Directory class. * Promote DirectoryCaptureCommandHandler from GatordMock into ArmNN. * Remove MockUtils as it's contents were moved or deleted. * Rewrite GatordMockTests to use Counter Directory class. * Flush streams in ProfilingConnectionDumpToFileDecorator::Close. Signed-off-by: Keith Davis Signed-off-by: Colm Donelan Change-Id: I77b2aedece24150dd31691b577f3b5d81b2e226f --- src/profiling/ProfilingUtils.hpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src/profiling/ProfilingUtils.hpp') diff --git a/src/profiling/ProfilingUtils.hpp b/src/profiling/ProfilingUtils.hpp index 3e0a8a2cec..fae1a83024 100644 --- a/src/profiling/ProfilingUtils.hpp +++ b/src/profiling/ProfilingUtils.hpp @@ -7,6 +7,7 @@ #include +#include "ICounterDirectory.hpp" #include "IPacketBuffer.hpp" #include @@ -55,10 +56,7 @@ template bool IsValidSwTraceString(const std::string& s) { // Check that all the characters in the given string conform to the given policy - return std::all_of(s.begin(), s.end(), [](unsigned char c) - { - return SwTracePolicy::IsValidChar(c); - }); + return std::all_of(s.begin(), s.end(), [](unsigned char c) { return SwTracePolicy::IsValidChar(c); }); } template @@ -77,7 +75,7 @@ bool StringToSwTraceString(const std::string& s, std::vector& outputBu } // Prepare the output buffer - size_t s_size = s.size() + 1; // The size of the string (in chars) plus the null-terminator + size_t s_size = s.size() + 1; // The size of the string (in chars) plus the null-terminator size_t uint32_t_size = sizeof(uint32_t); size_t outBufferSize = 1 + s_size / uint32_t_size + (s_size % uint32_t_size != 0 ? 1 : 0); outputBuffer.resize(outBufferSize, '\0'); @@ -95,6 +93,10 @@ std::vector GetNextCounterUids(uint16_t cores); void WriteBytes(const IPacketBuffer& packetBuffer, unsigned int offset, const void* value, unsigned int valueSize); +uint32_t ConstructHeader(uint32_t packetFamily, uint32_t packetId); + +uint32_t ConstructHeader(uint32_t packetFamily, uint32_t packetClass, uint32_t packetType); + void WriteUint64(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint64_t value); void WriteUint32(const IPacketBufferPtr& packetBuffer, unsigned int offset, uint32_t value); @@ -146,10 +148,10 @@ enum class TimelinePacketStatus enum class ProfilingRelationshipType { - RetentionLink, /// Head retains(parents) Tail - ExecutionLink, /// Head execution start depends on Tail execution completion - DataLink, /// Head uses data of Tail - LabelLink /// Head uses label Tail (Tail MUST be a guid of a label). + RetentionLink, /// Head retains(parents) Tail + ExecutionLink, /// Head execution start depends on Tail execution completion + DataLink, /// Head uses data of Tail + LabelLink /// Head uses label Tail (Tail MUST be a guid of a label). }; uint32_t CalculateSizeOfPaddedSwString(const std::string& str); @@ -191,14 +193,18 @@ TimelinePacketStatus WriteTimelineEventBinaryPacket(uint64_t timestamp, unsigned int bufferSize, unsigned int& numberOfBytesWritten); +std::string CentreAlignFormatting(const std::string& stringToPass, const int spacingWidth); + +void PrintCounterDirectory(ICounterDirectory& counterDirectory); + class BufferExhaustion : public armnn::Exception { using Exception::Exception; }; -} // namespace profiling +} // namespace profiling -} // namespace armnn +} // namespace armnn namespace std { -- cgit v1.2.1