diff options
author | Jim Flynn <jim.flynn@arm.com> | 2020-03-29 17:48:26 +0100 |
---|---|---|
committer | finn.williams <finn.williams@arm.com> | 2020-04-27 16:38:55 +0000 |
commit | 4e755a50e35a1f5ac1b011dc4baf89e6d97f116e (patch) | |
tree | 9660dba96819145e4f1bfe34e4482dca211ffc26 /src/profiling/ProfilingUtils.cpp | |
parent | 303980c502c721f13d65e7087be6c0758df65044 (diff) | |
download | armnn-4e755a50e35a1f5ac1b011dc4baf89e6d97f116e.tar.gz |
IVGCVSW-4595 Add IFileOnlyPacketHandlers to file only profiling connection
Change-Id: Ib49a8cbbf323da4109cdab9750e6c4d276e484b7
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src/profiling/ProfilingUtils.cpp')
-rw-r--r-- | src/profiling/ProfilingUtils.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/profiling/ProfilingUtils.cpp b/src/profiling/ProfilingUtils.cpp index fc70856e5c..6d2565c610 100644 --- a/src/profiling/ProfilingUtils.cpp +++ b/src/profiling/ProfilingUtils.cpp @@ -5,6 +5,8 @@ #include "ProfilingUtils.hpp" +#include "common/include/ProfilingException.hpp" + #include <armnn/Version.hpp> #include <WallClockTimer.hpp> @@ -1052,6 +1054,33 @@ uint64_t GetTimestamp() return static_cast<uint64_t>(timestamp.count()); } +Packet ReceivePacket(const unsigned char* buffer, uint32_t length) +{ + if (buffer == nullptr) + { + throw armnnProfiling::ProfilingException("data buffer is nullptr"); + } + if (length < 8) + { + throw armnnProfiling::ProfilingException("length of data buffer is less than 8"); + } + + uint32_t metadataIdentifier = 0; + std::memcpy(&metadataIdentifier, buffer, sizeof(metadataIdentifier)); + + uint32_t dataLength = 0; + std::memcpy(&dataLength, buffer + 4u, sizeof(dataLength)); + + std::unique_ptr<unsigned char[]> packetData; + if (dataLength > 0) + { + packetData = std::make_unique<unsigned char[]>(dataLength); + std::memcpy(packetData.get(), buffer + 8u, dataLength); + } + + return Packet(metadataIdentifier, dataLength, packetData); +} + } // namespace profiling } // namespace armnn |