ArmNN
 21.05
RequestCounterDirectoryCommandHandler.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 <fmt/format.h>
9 
10 namespace armnn
11 {
12 
13 namespace profiling
14 {
15 
16 void RequestCounterDirectoryCommandHandler::operator()(const arm::pipe::Packet& packet)
17 {
18  ProfilingState currentState = m_StateMachine.GetCurrentState();
19  switch (currentState)
20  {
24  throw RuntimeException(fmt::format("Request Counter Directory Comand Handler invoked while in an "
25  "wrong state: {}",
26  GetProfilingStateName(currentState)));
28  // Process the packet
29  if (!(packet.GetPacketFamily() == 0u && packet.GetPacketId() == 3u))
30  {
31  throw armnn::InvalidArgumentException(fmt::format("Expected Packet family = 0, id = 3 but "
32  "received family = {}, id = {}",
33  packet.GetPacketFamily(),
34  packet.GetPacketId()));
35  }
36 
37  // Send all the packet required for the handshake with the external profiling service
38  m_SendCounterPacket.SendCounterDirectoryPacket(m_CounterDirectory);
39  m_SendTimelinePacket.SendTimelineMessageDirectoryPackage();
40 
41  break;
42  default:
43  throw RuntimeException(fmt::format("Unknown profiling service state: {}",
44  static_cast<int>(currentState)));
45  }
46 }
47 
48 } // namespace profiling
49 
50 } // namespace armnn
Copyright (c) 2021 ARM Limited and Contributors.
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)