ArmNN
 20.02
ConnectionAcknowledgedCommandHandler.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include <armnn/Exceptions.hpp>
9 
10 #include <boost/format.hpp>
11 
12 namespace armnn
13 {
14 
15 namespace profiling
16 {
17 
19 {
20  ProfilingState currentState = m_StateMachine.GetCurrentState();
21  switch (currentState)
22  {
25  throw RuntimeException(boost::str(boost::format("Connection Acknowledged Command Handler invoked while in an "
26  "wrong state: %1%")
27  % GetProfilingStateName(currentState)));
29  // Process the packet
30  if (!(packet.GetPacketFamily() == 0u && packet.GetPacketId() == 1u))
31  {
32  throw armnn::InvalidArgumentException(boost::str(boost::format("Expected Packet family = 0, id = 1 but "
33  "received family = %1%, id = %2%")
34  % packet.GetPacketFamily()
35  % packet.GetPacketId()));
36  }
37 
38  // Once a Connection Acknowledged packet has been received, move to the Active state immediately
40  // Send the counter directory packet.
41  m_SendCounterPacket.SendCounterDirectoryPacket(m_CounterDirectory);
42  m_SendTimelinePacket.SendTimelineMessageDirectoryPackage();
43 
44  break;
46  return; // NOP
47  default:
48  throw RuntimeException(boost::str(boost::format("Unknown profiling service state: %1%")
49  % static_cast<int>(currentState)));
50  }
51 }
52 
53 } // namespace profiling
54 
55 } // namespace armnn
56 
Copyright (c) 2020 ARM Limited.
uint32_t GetPacketFamily() const
Definition: Packet.hpp:70
uint32_t GetPacketId() const
Definition: Packet.hpp:71
void TransitionToState(ProfilingState newState)
virtual void SendCounterDirectoryPacket(const ICounterDirectory &counterDirectory)=0
Create and write a CounterDirectoryPacket from the parameters to the buffer.
virtual void SendTimelineMessageDirectoryPackage()=0
Create and write a TimelineMessageDirectoryPackage in the buffer.
constexpr char const * GetProfilingStateName(ProfilingState state)