Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2019 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
| 8 | #include "ProfilingUtils.hpp" |
Keith Davis | 33ed221 | 2020-03-30 10:43:41 +0100 | [diff] [blame^] | 9 | #include "Runtime.hpp" |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 10 | |
| 11 | #include <armnn/BackendId.hpp> |
| 12 | #include <armnn/Optional.hpp> |
| 13 | #include <armnn/Types.hpp> |
| 14 | #include <BufferManager.hpp> |
| 15 | #include <ProfilingService.hpp> |
| 16 | |
| 17 | using namespace armnn; |
| 18 | using namespace armnn::profiling; |
| 19 | |
| 20 | inline unsigned int OffsetToNextWord(unsigned int numberOfBytes); |
| 21 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 22 | void VerifyTimelineHeaderBinary(const unsigned char* readableData, |
| 23 | unsigned int& offset, |
| 24 | uint32_t packetDataLength); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 25 | |
Keith Davis | 97da5e2 | 2020-03-05 16:25:28 +0000 | [diff] [blame] | 26 | void VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid, |
| 27 | const std::string& label, |
| 28 | const unsigned char* readableData, |
| 29 | unsigned int& offset); |
| 30 | |
| 31 | void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid, |
| 32 | const unsigned char* readableData, |
| 33 | unsigned int& offset); |
| 34 | |
| 35 | void VerifyTimelineRelationshipBinaryPacketData(ProfilingRelationshipType relationshipType, |
| 36 | Optional<ProfilingGuid> relationshipGuid, |
| 37 | Optional<ProfilingGuid> headGuid, |
| 38 | Optional<ProfilingGuid> tailGuid, |
| 39 | const unsigned char* readableData, |
| 40 | unsigned int& offset); |
| 41 | |
| 42 | void VerifyTimelineEntityBinaryPacketData(Optional<ProfilingGuid> guid, |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 43 | const unsigned char* readableData, |
| 44 | unsigned int& offset); |
| 45 | |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 46 | void VerifyTimelineEventBinaryPacket(Optional<uint64_t> timestamp, |
| 47 | Optional<std::thread::id> threadId, |
| 48 | Optional<ProfilingGuid> eventGuid, |
| 49 | const unsigned char* readableData, |
| 50 | unsigned int& offset); |
| 51 | |
| 52 | void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId); |
| 53 | |
| 54 | namespace armnn |
| 55 | { |
| 56 | |
| 57 | namespace profiling |
| 58 | { |
| 59 | |
| 60 | class ProfilingServiceRuntimeHelper : public ProfilingService |
| 61 | { |
| 62 | public: |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 63 | ProfilingServiceRuntimeHelper(ProfilingService& profilingService) |
| 64 | : m_ProfilingService(profilingService) {} |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 65 | ~ProfilingServiceRuntimeHelper() = default; |
| 66 | |
| 67 | BufferManager& GetProfilingBufferManager() |
| 68 | { |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 69 | return GetBufferManager(m_ProfilingService); |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 70 | } |
Sadik Armagan | 3184c90 | 2020-03-18 10:57:30 +0000 | [diff] [blame] | 71 | armnn::profiling::ProfilingService& m_ProfilingService; |
Keith Davis | 33ed221 | 2020-03-30 10:43:41 +0100 | [diff] [blame^] | 72 | |
| 73 | void ForceTransitionToState(ProfilingState newState) |
| 74 | { |
| 75 | TransitionToState(m_ProfilingService, newState); |
| 76 | } |
Narumol Prangnawarat | df31cfe | 2019-11-22 11:26:06 +0000 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | } // namespace profiling |
| 80 | |
| 81 | } // namespace armnn |
| 82 | |