diff options
author | Finn Williams <Finn.Williams@arm.com> | 2019-12-19 17:05:18 +0000 |
---|---|---|
committer | Finn Williams <Finn.Williams@arm.com> | 2020-01-14 12:39:05 +0000 |
commit | 09ad6f909f25aef02b7f53bba320b534b9260786 (patch) | |
tree | e69f6d9d4b15b0c7e106c5f6749dd77586247a75 /src/profiling/SendCounterPacket.hpp | |
parent | f90c56d72de4848a2dc5844a97458aaf09df07c2 (diff) | |
download | armnn-09ad6f909f25aef02b7f53bba320b534b9260786.tar.gz |
IVGCVSW-4229 Fix Intermittent failures in ExternalProfiling
* Added a BufferManager.Reset() method to prevent packets being retained after a test
* Fixed a bug causing the send thread to wait needlessly before moving to active state
* Refactored SendCoundPacketTests and ProfilingTests test helper classes
* Fixed issue where WaitForPacketSent could miss a notification and timeout
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: I353a652260c2f7dd465baa9e979e22f50f3ca6a7
Diffstat (limited to 'src/profiling/SendCounterPacket.hpp')
-rw-r--r-- | src/profiling/SendCounterPacket.hpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/profiling/SendCounterPacket.hpp b/src/profiling/SendCounterPacket.hpp index 11587552b8..80d6f8437a 100644 --- a/src/profiling/SendCounterPacket.hpp +++ b/src/profiling/SendCounterPacket.hpp @@ -63,13 +63,7 @@ public: void Start(IProfilingConnection& profilingConnection); void Stop(bool rethrowSendThreadExceptions = true); bool IsRunning() { return m_IsRunning.load(); } - - void WaitForPacketSent(uint32_t timeout = 1000) - { - std::unique_lock<std::mutex> lock(m_PacketSentWaitMutex); - // Blocks until notified that at least a packet has been sent or until timeout expires. - m_PacketSentWaitCondition.wait_for(lock, std::chrono::milliseconds(timeout)); - } + bool WaitForPacketSent(uint32_t timeout); private: void Send(IProfilingConnection& profilingConnection); @@ -111,6 +105,8 @@ private: std::atomic<bool> m_KeepRunning; // m_ReadyToRead will be protected by m_WaitMutex bool m_ReadyToRead; + // m_PacketSent will be protected by m_PacketSentWaitMutex + bool m_PacketSent; std::exception_ptr m_SendThreadException; std::mutex m_PacketSentWaitMutex; std::condition_variable m_PacketSentWaitCondition; |