• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include "ITimelineDecoder.hpp"
9 
10 #include <common/include/CommandHandlerFunctor.hpp>
11 #include <common/include/Packet.hpp>
12 
13 namespace arm
14 {
15 
16 namespace pipe
17 {
18 
19 class TimelineCaptureCommandHandler : public arm::pipe::CommandHandlerFunctor
20 {
21     // Utils
22     uint32_t uint32_t_size = sizeof(uint32_t);
23     uint32_t uint64_t_size = sizeof(uint64_t);
24 
25     using ReadFunction = ITimelineDecoder::TimelineStatus (TimelineCaptureCommandHandler::*)(
26         const unsigned char*, uint32_t&);
27 
28 public:
TimelineCaptureCommandHandler(uint32_t familyId,uint32_t packetId,uint32_t version,ITimelineDecoder & timelineDecoder,uint32_t threadIdSize=0)29     TimelineCaptureCommandHandler(uint32_t familyId,
30                                   uint32_t packetId,
31                                   uint32_t version,
32                                   ITimelineDecoder& timelineDecoder,
33                                   uint32_t threadIdSize = 0)
34         : CommandHandlerFunctor(familyId, packetId, version)
35         , m_TimelineDecoder(timelineDecoder)
36         , m_ThreadIdSize(threadIdSize)
37         , m_PacketLength(0)
38     {}
39 
40     void operator()(const arm::pipe::Packet& packet) override;
41 
42 
43     void SetThreadIdSize(uint32_t size);
44 
45 private:
46     void ParseData(const arm::pipe::Packet& packet);
47 
48     ITimelineDecoder::TimelineStatus ReadLabel(const unsigned char* data, uint32_t& offset);
49     ITimelineDecoder::TimelineStatus ReadEntity(const unsigned char* data, uint32_t& offset);
50     ITimelineDecoder::TimelineStatus ReadEventClass(const unsigned char* data, uint32_t& offset);
51     ITimelineDecoder::TimelineStatus ReadRelationship(const unsigned char* data, uint32_t& offset);
52     ITimelineDecoder::TimelineStatus ReadEvent(const unsigned char* data, uint32_t& offset);
53 
54     ITimelineDecoder& m_TimelineDecoder;
55     uint32_t m_ThreadIdSize;
56     unsigned int              m_PacketLength;
57     static const ReadFunction m_ReadFunctions[];
58 
59 };
60 
61 } //namespace pipe
62 
63 } //namespace arm
64