ArmNN
 21.11
PerJobCounterSelectionCommandHandler.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 #include <armnn/Exceptions.hpp>
8 
9 #include <fmt/format.h>
10 
11 namespace armnn
12 {
13 
14 namespace profiling
15 {
16 
17 void PerJobCounterSelectionCommandHandler::operator()(const arm::pipe::Packet& packet)
18 {
19  ProfilingState currentState = m_StateMachine.GetCurrentState();
20  switch (currentState)
21  {
25  throw armnn::RuntimeException(fmt::format(
26  "Per-Job Counter Selection Command Handler invoked while in an incorrect state: {}",
27  GetProfilingStateName(currentState)));
29  // Process the packet
30  if (!(packet.GetPacketFamily() == 0u && packet.GetPacketId() == 5u))
31  {
32  throw armnn::InvalidArgumentException(fmt::format("Expected Packet family = 0, id = 5 but "
33  "received family = {}, id = {}",
34  packet.GetPacketFamily(),
35  packet.GetPacketId()));
36  }
37 
38  // Silently drop the packet
39 
40  break;
41  default:
42  throw armnn::RuntimeException(fmt::format("Unknown profiling service state: {}",
43  static_cast<int>(currentState)));
44  }
45 }
46 
47 } // namespace profiling
48 
49 } // namespace armnn
Copyright (c) 2021 ARM Limited and Contributors.
constexpr char const * GetProfilingStateName(ProfilingState state)