2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
6 #include "ProfilingUtils.hpp"
8 #include <armnn/Version.hpp>
10 #include <boost/assert.hpp>
20 void WriteUint64(unsigned char* buffer, unsigned int offset, uint64_t value)
24 buffer[offset] = static_cast<unsigned char>(value & 0xFF);
25 buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
26 buffer[offset + 2] = static_cast<unsigned char>((value >> 16) & 0xFF);
27 buffer[offset + 3] = static_cast<unsigned char>((value >> 24) & 0xFF);
28 buffer[offset + 4] = static_cast<unsigned char>((value >> 32) & 0xFF);
29 buffer[offset + 5] = static_cast<unsigned char>((value >> 40) & 0xFF);
30 buffer[offset + 6] = static_cast<unsigned char>((value >> 48) & 0xFF);
31 buffer[offset + 7] = static_cast<unsigned char>((value >> 56) & 0xFF);
34 void WriteUint32(unsigned char* buffer, unsigned int offset, uint32_t value)
38 buffer[offset] = static_cast<unsigned char>(value & 0xFF);
39 buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
40 buffer[offset + 2] = static_cast<unsigned char>((value >> 16) & 0xFF);
41 buffer[offset + 3] = static_cast<unsigned char>((value >> 24) & 0xFF);
44 void WriteUint16(unsigned char* buffer, unsigned int offset, uint16_t value)
48 buffer[offset] = static_cast<unsigned char>(value & 0xFF);
49 buffer[offset + 1] = static_cast<unsigned char>((value >> 8) & 0xFF);
52 uint64_t ReadUint64(const unsigned char* buffer, unsigned int offset)
57 value = static_cast<uint64_t>(buffer[offset]);
58 value |= static_cast<uint64_t>(buffer[offset + 1]) << 8;
59 value |= static_cast<uint64_t>(buffer[offset + 2]) << 16;
60 value |= static_cast<uint64_t>(buffer[offset + 3]) << 24;
61 value |= static_cast<uint64_t>(buffer[offset + 4]) << 32;
62 value |= static_cast<uint64_t>(buffer[offset + 5]) << 40;
63 value |= static_cast<uint64_t>(buffer[offset + 6]) << 48;
64 value |= static_cast<uint64_t>(buffer[offset + 7]) << 56;
69 uint32_t ReadUint32(const unsigned char* buffer, unsigned int offset)
74 value = static_cast<uint32_t>(buffer[offset]);
75 value |= static_cast<uint32_t>(buffer[offset + 1]) << 8;
76 value |= static_cast<uint32_t>(buffer[offset + 2]) << 16;
77 value |= static_cast<uint32_t>(buffer[offset + 3]) << 24;
81 uint16_t ReadUint16(const unsigned char* buffer, unsigned int offset)
86 value = static_cast<uint32_t>(buffer[offset]);
87 value |= static_cast<uint32_t>(buffer[offset + 1]) << 8;
88 return static_cast<uint16_t>(value);
91 std::string GetSoftwareInfo()
93 return std::string("ArmNN");
96 std::string GetHardwareVersion()
101 std::string GetSoftwareVersion()
103 std::string armnnVersion(ARMNN_VERSION);
104 std::string result = "Armnn " + armnnVersion.substr(2,2) + "." + armnnVersion.substr(4,2);
108 std::string GetProcessName()
110 std::ifstream comm("/proc/self/comm");
116 } // namespace profiling