• 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 "ProfilingStateMachine.hpp"
9 
10 #include <client/include/IProfilingServiceStatus.hpp>
11 #include <client/include/ISendCounterPacket.hpp>
12 #include <client/include/ISendTimelinePacket.hpp>
13 
14 #include <client/include/backends/IBackendProfilingContext.hpp>
15 
16 #include <common/include/CommandHandlerFunctor.hpp>
17 #include <common/include/Packet.hpp>
18 
19 namespace arm
20 {
21 
22 namespace pipe
23 {
24 
25 class ConnectionAcknowledgedCommandHandler final : public arm::pipe::CommandHandlerFunctor
26 {
27 
28 typedef const std::unordered_map<std::string, std::shared_ptr<IBackendProfilingContext>>&
29     BackendProfilingContexts;
30 
31 public:
ConnectionAcknowledgedCommandHandler(uint32_t familyId,uint32_t packetId,uint32_t version,ICounterDirectory & counterDirectory,ISendCounterPacket & sendCounterPacket,ISendTimelinePacket & sendTimelinePacket,ProfilingStateMachine & profilingStateMachine,IProfilingServiceStatus & profilingServiceStatus,arm::pipe::Optional<BackendProfilingContexts> backendProfilingContexts=arm::pipe::EmptyOptional ())32     ConnectionAcknowledgedCommandHandler(uint32_t familyId,
33                                          uint32_t packetId,
34                                          uint32_t version,
35                                          ICounterDirectory& counterDirectory,
36                                          ISendCounterPacket& sendCounterPacket,
37                                          ISendTimelinePacket& sendTimelinePacket,
38                                          ProfilingStateMachine& profilingStateMachine,
39                                          IProfilingServiceStatus& profilingServiceStatus,
40                                          arm::pipe::Optional<BackendProfilingContexts> backendProfilingContexts =
41                                          arm::pipe::EmptyOptional())
42         : CommandHandlerFunctor(familyId, packetId, version)
43         , m_CounterDirectory(counterDirectory)
44         , m_SendCounterPacket(sendCounterPacket)
45         , m_SendTimelinePacket(sendTimelinePacket)
46         , m_StateMachine(profilingStateMachine)
47         , m_ProfilingServiceStatus(profilingServiceStatus)
48         , m_BackendProfilingContext(backendProfilingContexts)
49         , m_TimelineEnabled(false)
50     {}
51 
52     void operator()(const arm::pipe::Packet& packet) override;
53 
setTimelineEnabled(bool timelineEnabled)54     void setTimelineEnabled(bool timelineEnabled)
55     {
56         m_TimelineEnabled = timelineEnabled;
57     }
58 
59 private:
60     const ICounterDirectory& m_CounterDirectory;
61     ISendCounterPacket&      m_SendCounterPacket;
62     ISendTimelinePacket&     m_SendTimelinePacket;
63     ProfilingStateMachine&   m_StateMachine;
64     IProfilingServiceStatus& m_ProfilingServiceStatus;
65     arm::pipe::Optional<BackendProfilingContexts> m_BackendProfilingContext;
66     std::atomic<bool> m_TimelineEnabled;
67 };
68 
69 } // namespace pipe
70 
71 } // namespace arm
72