Sadik Armagan | b5f01b2 | 2019-09-18 17:29:00 +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 | fe5a24b | 2020-04-09 16:05:28 +0100 | [diff] [blame] | 8 | #include <armnn/backends/profiling/IBackendProfilingContext.hpp> |
Sadik Armagan | b5f01b2 | 2019-09-18 17:29:00 +0100 | [diff] [blame] | 9 | #include "CommandHandlerFunctor.hpp" |
Keith Davis | 3201eea | 2019-10-24 17:30:41 +0100 | [diff] [blame] | 10 | #include "ISendCounterPacket.hpp" |
Colm Donelan | 5ccb33d | 2020-01-24 16:27:02 +0000 | [diff] [blame] | 11 | #include "armnn/profiling/ISendTimelinePacket.hpp" |
Finn Williams | 0c8cb99 | 2020-05-07 10:38:15 +0100 | [diff] [blame^] | 12 | #include "common/include/Packet.hpp" |
Sadik Armagan | b5f01b2 | 2019-09-18 17:29:00 +0100 | [diff] [blame] | 13 | #include "ProfilingStateMachine.hpp" |
| 14 | |
| 15 | namespace armnn |
| 16 | { |
| 17 | |
| 18 | namespace profiling |
| 19 | { |
| 20 | |
Matteo Martincigh | c2728f9 | 2019-10-07 12:35:21 +0100 | [diff] [blame] | 21 | class ConnectionAcknowledgedCommandHandler final : public CommandHandlerFunctor |
Sadik Armagan | b5f01b2 | 2019-09-18 17:29:00 +0100 | [diff] [blame] | 22 | { |
| 23 | |
Finn Williams | fe5a24b | 2020-04-09 16:05:28 +0100 | [diff] [blame] | 24 | typedef const std::unordered_map<BackendId, std::shared_ptr<armnn::profiling::IBackendProfilingContext>>& |
| 25 | BackendProfilingContexts; |
| 26 | |
Sadik Armagan | b5f01b2 | 2019-09-18 17:29:00 +0100 | [diff] [blame] | 27 | public: |
Jim Flynn | 397043f | 2019-10-17 17:37:10 +0100 | [diff] [blame] | 28 | ConnectionAcknowledgedCommandHandler(uint32_t familyId, |
| 29 | uint32_t packetId, |
Sadik Armagan | b5f01b2 | 2019-09-18 17:29:00 +0100 | [diff] [blame] | 30 | uint32_t version, |
Keith Davis | 3201eea | 2019-10-24 17:30:41 +0100 | [diff] [blame] | 31 | ICounterDirectory& counterDirectory, |
| 32 | ISendCounterPacket& sendCounterPacket, |
Matteo Martincigh | cdfb941 | 2019-11-08 11:23:06 +0000 | [diff] [blame] | 33 | ISendTimelinePacket& sendTimelinePacket, |
Finn Williams | fe5a24b | 2020-04-09 16:05:28 +0100 | [diff] [blame] | 34 | ProfilingStateMachine& profilingStateMachine, |
| 35 | Optional<BackendProfilingContexts> backendProfilingContexts = EmptyOptional()) |
Jim Flynn | 397043f | 2019-10-17 17:37:10 +0100 | [diff] [blame] | 36 | : CommandHandlerFunctor(familyId, packetId, version) |
Keith Davis | 3201eea | 2019-10-24 17:30:41 +0100 | [diff] [blame] | 37 | , m_CounterDirectory(counterDirectory) |
| 38 | , m_SendCounterPacket(sendCounterPacket) |
Matteo Martincigh | cdfb941 | 2019-11-08 11:23:06 +0000 | [diff] [blame] | 39 | , m_SendTimelinePacket(sendTimelinePacket) |
Matteo Martincigh | c2728f9 | 2019-10-07 12:35:21 +0100 | [diff] [blame] | 40 | , m_StateMachine(profilingStateMachine) |
Finn Williams | fe5a24b | 2020-04-09 16:05:28 +0100 | [diff] [blame] | 41 | , m_BackendProfilingContext(backendProfilingContexts) |
Matteo Martincigh | c2728f9 | 2019-10-07 12:35:21 +0100 | [diff] [blame] | 42 | {} |
Sadik Armagan | b5f01b2 | 2019-09-18 17:29:00 +0100 | [diff] [blame] | 43 | |
| 44 | void operator()(const Packet& packet) override; |
| 45 | |
Finn Williams | d7fcafa | 2020-04-23 17:55:18 +0100 | [diff] [blame] | 46 | void setTimelineEnabled(bool timelineEnabled) |
| 47 | { |
| 48 | m_TimelineEnabled = timelineEnabled; |
| 49 | } |
| 50 | |
Sadik Armagan | b5f01b2 | 2019-09-18 17:29:00 +0100 | [diff] [blame] | 51 | private: |
Keith Davis | 3201eea | 2019-10-24 17:30:41 +0100 | [diff] [blame] | 52 | const ICounterDirectory& m_CounterDirectory; |
| 53 | ISendCounterPacket& m_SendCounterPacket; |
Matteo Martincigh | cdfb941 | 2019-11-08 11:23:06 +0000 | [diff] [blame] | 54 | ISendTimelinePacket& m_SendTimelinePacket; |
Keith Davis | 3201eea | 2019-10-24 17:30:41 +0100 | [diff] [blame] | 55 | ProfilingStateMachine& m_StateMachine; |
Finn Williams | fe5a24b | 2020-04-09 16:05:28 +0100 | [diff] [blame] | 56 | Optional<BackendProfilingContexts> m_BackendProfilingContext; |
Finn Williams | d7fcafa | 2020-04-23 17:55:18 +0100 | [diff] [blame] | 57 | bool m_TimelineEnabled = false; |
Sadik Armagan | b5f01b2 | 2019-09-18 17:29:00 +0100 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | } // namespace profiling |
| 61 | |
| 62 | } // namespace armnn |
| 63 | |