2 // Copyright © 2019 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
8 #include "ProfilingUtils.hpp"
11 #include <armnn/BackendId.hpp>
12 #include <armnn/Optional.hpp>
13 #include <armnn/Types.hpp>
14 #include <BufferManager.hpp>
15 #include <ProfilingService.hpp>
17 using namespace armnn;
18 using namespace armnn::profiling;
20 const static uint32_t bodyHeaderSize = 6;
22 uint32_t GetStreamMetaDataPacketSize();
24 inline unsigned int OffsetToNextWord(unsigned int numberOfBytes);
26 void VerifyTimelineHeaderBinary(const unsigned char* readableData,
28 uint32_t packetDataLength);
30 void VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid,
31 const std::string& label,
32 const unsigned char* readableData,
33 unsigned int& offset);
35 void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid,
36 const unsigned char* readableData,
37 unsigned int& offset);
39 void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relationshipType,
40 Optional<ProfilingGuid> relationshipGuid,
41 Optional<ProfilingGuid> headGuid,
42 Optional<ProfilingGuid> tailGuid,
43 const unsigned char* readableData,
44 unsigned int& offset);
46 void VerifyTimelineEntityBinaryPacketData(Optional<ProfilingGuid> guid,
47 const unsigned char* readableData,
48 unsigned int& offset);
50 void VerifyTimelineEventBinaryPacket(Optional<uint64_t> timestamp,
51 Optional<std::thread::id> threadId,
52 Optional<ProfilingGuid> eventGuid,
53 const unsigned char* readableData,
54 unsigned int& offset);
56 void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId);
64 class ProfilingServiceRuntimeHelper : public ProfilingService
67 ProfilingServiceRuntimeHelper(ProfilingService& profilingService)
68 : m_ProfilingService(profilingService) {}
69 ~ProfilingServiceRuntimeHelper() = default;
71 BufferManager& GetProfilingBufferManager()
73 return GetBufferManager(m_ProfilingService);
75 armnn::profiling::ProfilingService& m_ProfilingService;
77 void ForceTransitionToState(ProfilingState newState)
79 TransitionToState(m_ProfilingService, newState);
83 } // namespace profiling