ArmNN
 20.08
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 <boost/format.hpp>
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(boost::str(boost::format(
26  "Per-Job Counter Selection Command Handler invoked while in an incorrect state: %1%")
27  % GetProfilingStateName(currentState)));
29  // Process the packet
30  if (!(packet.GetPacketFamily() == 0u && packet.GetPacketId() == 5u))
31  {
32  throw armnn::InvalidArgumentException(boost::str(boost::format("Expected Packet family = 0, id = 5 but "
33  "received family = %1%, id = %2%")
34  % packet.GetPacketFamily()
35  % packet.GetPacketId()));
36  }
37 
38  // Silently drop the packet
39 
40  break;
41  default:
42  throw armnn::RuntimeException(boost::str(boost::format("Unknown profiling service state: %1%")
43  % static_cast<int>(currentState)));
44  }
45 }
46 
47 } // namespace profiling
48 
49 } // namespace armnn
Copyright (c) 2020 ARM Limited.
constexpr char const * GetProfilingStateName(ProfilingState state)