aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/CommandHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/profiling/CommandHandler.cpp')
-rw-r--r--src/profiling/CommandHandler.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/profiling/CommandHandler.cpp b/src/profiling/CommandHandler.cpp
index 86fa2571df..cc68dcf74d 100644
--- a/src/profiling/CommandHandler.cpp
+++ b/src/profiling/CommandHandler.cpp
@@ -5,6 +5,8 @@
#include "CommandHandler.hpp"
+#include <boost/log/trivial.hpp>
+
namespace armnn
{
@@ -39,7 +41,14 @@ void CommandHandler::HandleCommands(IProfilingConnection& profilingConnection)
{
try
{
- Packet packet = profilingConnection.ReadPacket(m_Timeout);
+ Packet packet = profilingConnection.ReadPacket(m_Timeout.load());
+
+ if (packet.IsEmpty())
+ {
+ // Nothing to do, continue
+ continue;
+ }
+
Version version = m_PacketVersionResolver.ResolvePacketVersion(packet.GetPacketId());
CommandHandlerFunctor* commandHandlerFunctor =
@@ -49,19 +58,15 @@ void CommandHandler::HandleCommands(IProfilingConnection& profilingConnection)
}
catch (const armnn::TimeoutException&)
{
- if (m_StopAfterTimeout)
+ if (m_StopAfterTimeout.load())
{
- m_KeepRunning.store(false, std::memory_order_relaxed);
+ m_KeepRunning.store(false);
}
}
catch (const Exception& e)
{
- // Log the error
- BOOST_LOG_TRIVIAL(warning) << "An error has occurred when handling a command: "
- << e.what();
-
- // Might want to differentiate the errors more
- m_KeepRunning.store(false);
+ // Log the error and continue
+ BOOST_LOG_TRIVIAL(warning) << "An error has occurred when handling a command: " << e.what() << std::endl;
}
}
while (m_KeepRunning.load());