Finn Williams | e63a026 | 2019-10-22 10:30:49 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2019 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
Finn Williams | e63a026 | 2019-10-22 10:30:49 +0100 | [diff] [blame] | 8 | #include <CommandHandlerFunctor.hpp> |
Finn Williams | 8a2b468 | 2020-02-26 10:25:26 +0000 | [diff] [blame^] | 9 | #include "armnn/profiling/ITimelineDecoder.hpp" |
| 10 | |
Finn Williams | e63a026 | 2019-10-22 10:30:49 +0100 | [diff] [blame] | 11 | #include <Packet.hpp> |
| 12 | #include <ProfilingUtils.hpp> |
| 13 | |
| 14 | namespace armnn |
| 15 | { |
| 16 | |
Finn Williams | 8a2b468 | 2020-02-26 10:25:26 +0000 | [diff] [blame^] | 17 | namespace timelinedecoder |
Finn Williams | e63a026 | 2019-10-22 10:30:49 +0100 | [diff] [blame] | 18 | { |
| 19 | |
| 20 | class TimelineCaptureCommandHandler : public profiling::CommandHandlerFunctor |
| 21 | { |
| 22 | // Utils |
| 23 | uint32_t uint32_t_size = sizeof(uint32_t); |
| 24 | uint32_t uint64_t_size = sizeof(uint64_t); |
Finn Williams | e63a026 | 2019-10-22 10:30:49 +0100 | [diff] [blame] | 25 | |
| 26 | using ReadFunction = void (TimelineCaptureCommandHandler::*)(const unsigned char*, uint32_t); |
| 27 | |
| 28 | public: |
| 29 | TimelineCaptureCommandHandler(uint32_t familyId, |
| 30 | uint32_t packetId, |
| 31 | uint32_t version, |
Finn Williams | 510f618 | 2020-02-21 11:14:08 +0000 | [diff] [blame] | 32 | ITimelineDecoder& timelineDecoder, |
| 33 | uint32_t threadId_size) |
Finn Williams | e63a026 | 2019-10-22 10:30:49 +0100 | [diff] [blame] | 34 | : CommandHandlerFunctor(familyId, packetId, version) |
Finn Williams | 510f618 | 2020-02-21 11:14:08 +0000 | [diff] [blame] | 35 | , m_TimelineDecoder(timelineDecoder) |
| 36 | , m_ThreadIdSize(threadId_size) |
Finn Williams | e63a026 | 2019-10-22 10:30:49 +0100 | [diff] [blame] | 37 | {} |
| 38 | |
| 39 | void operator()(const armnn::profiling::Packet& packet) override; |
| 40 | |
| 41 | void ReadLabel(const unsigned char* data, uint32_t offset); |
| 42 | void ReadEntity(const unsigned char* data, uint32_t offset); |
| 43 | void ReadEventClass(const unsigned char* data, uint32_t offset); |
| 44 | void ReadRelationship(const unsigned char* data, uint32_t offset); |
| 45 | void ReadEvent(const unsigned char* data, uint32_t offset); |
| 46 | |
Finn Williams | e63a026 | 2019-10-22 10:30:49 +0100 | [diff] [blame] | 47 | private: |
| 48 | void ParseData(const armnn::profiling::Packet& packet); |
| 49 | |
Finn Williams | 510f618 | 2020-02-21 11:14:08 +0000 | [diff] [blame] | 50 | ITimelineDecoder& m_TimelineDecoder; |
| 51 | const uint32_t m_ThreadIdSize; |
Finn Williams | e63a026 | 2019-10-22 10:30:49 +0100 | [diff] [blame] | 52 | static const ReadFunction m_ReadFunctions[]; |
Finn Williams | e63a026 | 2019-10-22 10:30:49 +0100 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | } //namespace gatordmock |
| 56 | |
| 57 | } //namespace armnn |