MCPcopy Create free account
hub / github.com/ARM-software/armnn / HandleCommands

Method HandleCommands

profiling/client/src/CommandHandler.cpp:56–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56void CommandHandler::HandleCommands(IProfilingConnection& profilingConnection)
57{
58 do
59 {
60 try
61 {
62 arm::pipe::Packet packet = profilingConnection.ReadPacket(m_Timeout.load());
63
64 if (packet.IsEmpty())
65 {
66 // Nothing to do, continue
67 continue;
68 }
69
70 arm::pipe::Version version = m_PacketVersionResolver.ResolvePacketVersion(packet.GetPacketFamily(),
71 packet.GetPacketId());
72
73 arm::pipe::CommandHandlerFunctor* commandHandlerFunctor =
74 m_CommandHandlerRegistry.GetFunctor(packet.GetPacketFamily(),
75 packet.GetPacketId(),
76 version.GetEncodedValue());
77 ARM_PIPE_ASSERT(commandHandlerFunctor);
78 commandHandlerFunctor->operator()(packet);
79 }
80 catch (const arm::pipe::TimeoutException&)
81 {
82 if (m_StopAfterTimeout.load())
83 {
84 m_KeepRunning.store(false);
85 }
86 }
87 catch (const arm::pipe::ProfilingException& e)
88 {
89 // Log the error and continue
90 ARM_PIPE_LOG(warning) << "An error has occurred when handling a command: " << e.what();
91 // Did we get here because the socket failed?
92 if ( !profilingConnection.IsOpen() )
93 {
94 // We're going to stop processing commands.
95 // This will leave the thread idle. There is no mechanism to restart the profiling service when the
96 // connection is lost.
97 m_KeepRunning.store(false);
98 }
99 }
100 catch (...)
101 {
102 // Log the error and continue
103 ARM_PIPE_LOG(warning) << "An unknown error has occurred when handling a command";
104 // Did we get here because the socket failed?
105 if ( !profilingConnection.IsOpen() )
106 {
107 // We're going to stop processing commands.
108 // This will leave the thread idle. There is no mechanism to restart the profiling service when the
109 // connection is lost.
110 m_KeepRunning.store(false);
111 }
112 }
113 }

Callers

nothing calls this directly

Calls 12

loadMethod · 0.80
ResolvePacketVersionMethod · 0.80
GetPacketFamilyMethod · 0.80
GetFunctorMethod · 0.80
GetEncodedValueMethod · 0.80
storeMethod · 0.80
ReadPacketMethod · 0.45
IsEmptyMethod · 0.45
GetPacketIdMethod · 0.45
operator()Method · 0.45
whatMethod · 0.45
IsOpenMethod · 0.45

Tested by

no test coverage detected