ArmNN
 20.05
CommandHandler.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
11 
12 #include <atomic>
13 #include <thread>
14 
15 namespace armnn
16 {
17 
18 namespace profiling
19 {
20 
22 {
23 public:
24  CommandHandler(uint32_t timeout,
25  bool stopAfterTimeout,
26  CommandHandlerRegistry& commandHandlerRegistry,
27  PacketVersionResolver& packetVersionResolver)
28  : m_Timeout(timeout),
29  m_StopAfterTimeout(stopAfterTimeout),
30  m_IsRunning(false),
31  m_KeepRunning(false),
32  m_CommandThread(),
33  m_CommandHandlerRegistry(commandHandlerRegistry),
34  m_PacketVersionResolver(packetVersionResolver)
35  {}
37 
38  void SetTimeout(uint32_t timeout) { m_Timeout.store(timeout); }
39  void SetStopAfterTimeout(bool stopAfterTimeout) { m_StopAfterTimeout.store(stopAfterTimeout); }
40 
41  void Start(IProfilingConnection& profilingConnection);
42  void Stop();
43  bool IsRunning() const { return m_IsRunning.load(); }
44 
45 private:
46  void HandleCommands(IProfilingConnection& profilingConnection);
47 
48  std::atomic<uint32_t> m_Timeout;
49  std::atomic<bool> m_StopAfterTimeout;
50  std::atomic<bool> m_IsRunning;
51  std::atomic<bool> m_KeepRunning;
52  std::thread m_CommandThread;
53 
54  CommandHandlerRegistry& m_CommandHandlerRegistry;
55  PacketVersionResolver& m_PacketVersionResolver;
56 };
57 
58 } // namespace profiling
59 
60 } // namespace armnn
void Start(IProfilingConnection &profilingConnection)
DataLayout::NHWC false
Copyright (c) 2020 ARM Limited.
void SetTimeout(uint32_t timeout)
void SetStopAfterTimeout(bool stopAfterTimeout)
CommandHandler(uint32_t timeout, bool stopAfterTimeout, CommandHandlerRegistry &commandHandlerRegistry, PacketVersionResolver &packetVersionResolver)