blob: 3f3240491f05a27e77f3e563e5a2461c0210ee22 [file] [log] [blame]
Finn Williamse63a0262019-10-22 10:30:49 +01001//
2// Copyright © 2019 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include "ITimelineDecoder.h"
9
10#include <CommandHandlerFunctor.hpp>
11#include <Packet.hpp>
12#include <ProfilingUtils.hpp>
13
14namespace armnn
15{
16
17namespace gatordmock
18{
19
20class 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);
25 uint32_t threadId_size = sizeof(std::thread::id);
26
27 using ReadFunction = void (TimelineCaptureCommandHandler::*)(const unsigned char*, uint32_t);
28
29public:
30 TimelineCaptureCommandHandler(uint32_t familyId,
31 uint32_t packetId,
32 uint32_t version,
33 Model* model,
34 bool quietOperation = false)
35 : CommandHandlerFunctor(familyId, packetId, version)
36 , m_Model(model)
37 , m_QuietOperation(quietOperation)
38 {}
39
40 void operator()(const armnn::profiling::Packet& packet) override;
41
42 void ReadLabel(const unsigned char* data, uint32_t offset);
43 void ReadEntity(const unsigned char* data, uint32_t offset);
44 void ReadEventClass(const unsigned char* data, uint32_t offset);
45 void ReadRelationship(const unsigned char* data, uint32_t offset);
46 void ReadEvent(const unsigned char* data, uint32_t offset);
47
48 void print();
49
50private:
51 void ParseData(const armnn::profiling::Packet& packet);
52
53 Model* m_Model;
54 bool m_QuietOperation;
55 static const ReadFunction m_ReadFunctions[];
56
57 void printLabels();
58 void printEntities();
59 void printEventClasses();
60 void printRelationships();
61 void printEvents();
62};
63
64} //namespace gatordmock
65
66} //namespace armnn