ArmNN
 21.08
ProfilingTestUtils.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include "ProfilingUtils.hpp"
9 #include "Runtime.hpp"
10 
11 #include <armnn/BackendId.hpp>
12 #include <armnn/Optional.hpp>
13 #include <BufferManager.hpp>
14 #include <ProfilingService.hpp>
15 
16 #include <common/include/ProfilingGuid.hpp>
17 
18 using namespace armnn;
19 using namespace armnn::profiling;
20 
21 const static uint32_t bodyHeaderSize = 6;
22 
24 
25 /// Returns a vector of CpuRef, CpuAcc or GpuAcc backends if they where registered
26 std::vector<BackendId> GetSuitableBackendRegistered();
27 
28 inline unsigned int OffsetToNextWord(unsigned int numberOfBytes);
29 
30 void VerifyTimelineHeaderBinary(const unsigned char* readableData,
31  unsigned int& offset,
32  uint32_t packetDataLength);
33 
35  const std::string& label,
36  const unsigned char* readableData,
37  unsigned int& offset);
38 
39 void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid,
40  ProfilingGuid nameGuid,
41  const unsigned char* readableData,
42  unsigned int& offset);
43 
45  Optional<ProfilingGuid> relationshipGuid,
46  Optional<ProfilingGuid> headGuid,
47  Optional<ProfilingGuid> tailGuid,
48  Optional<ProfilingGuid> attributeGuid,
49  const unsigned char* readableData,
50  unsigned int& offset);
51 
53  const unsigned char* readableData,
54  unsigned int& offset);
55 
57  Optional<int> threadId,
58  Optional<ProfilingGuid> eventGuid,
59  const unsigned char* readableData,
60  unsigned int& offset);
61 
63 
64 bool CompareOutput(std::vector<std::string> output, std::vector<std::string> expectedOutput);
65 
66 namespace armnn
67 {
68 
69 namespace profiling
70 {
71 
73 {
74 public:
76  : m_ProfilingService(profilingService) {}
77  ~ProfilingServiceRuntimeHelper() = default;
78 
80  {
81  return GetBufferManager(m_ProfilingService);
82  }
84 
86  {
87  TransitionToState(m_ProfilingService, newState);
88  }
89 };
90 
91 } // namespace profiling
92 
93 } // namespace armnn
94 
ProfilingGuid VerifyTimelineEntityBinaryPacketData(Optional< ProfilingGuid > guid, const unsigned char *readableData, unsigned int &offset)
void ForceTransitionToState(ProfilingState newState)
unsigned int OffsetToNextWord(unsigned int numberOfBytes)
uint32_t GetStreamMetaDataPacketSize()
void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId)
Copyright (c) 2021 ARM Limited and Contributors.
std::vector< BackendId > GetSuitableBackendRegistered()
Returns a vector of CpuRef, CpuAcc or GpuAcc backends if they where registered.
bool CompareOutput(std::vector< std::string > output, std::vector< std::string > expectedOutput)
void VerifyTimelineHeaderBinary(const unsigned char *readableData, unsigned int &offset, uint32_t packetDataLength)
void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relationshipType, Optional< ProfilingGuid > relationshipGuid, Optional< ProfilingGuid > headGuid, Optional< ProfilingGuid > tailGuid, Optional< ProfilingGuid > attributeGuid, const unsigned char *readableData, unsigned int &offset)
ProfilingGuid VerifyTimelineLabelBinaryPacketData(Optional< ProfilingGuid > guid, const std::string &label, const unsigned char *readableData, unsigned int &offset)
ProfilingGuid VerifyTimelineEventBinaryPacket(Optional< uint64_t > timestamp, Optional< int > threadId, Optional< ProfilingGuid > eventGuid, const unsigned char *readableData, unsigned int &offset)
ProfilingServiceRuntimeHelper(ProfilingService &profilingService)
armnn::profiling::ProfilingService & m_ProfilingService
void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid, ProfilingGuid nameGuid, const unsigned char *readableData, unsigned int &offset)