diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-10-07 13:05:13 +0100 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-10-08 10:43:50 +0100 |
commit | 5d737fb3b06c17ff6b65fb307343ca1c0c680401 (patch) | |
tree | 91c5548fd4e84ff086e57020a017982124b06c50 /src/profiling/test/SendCounterPacketTests.hpp | |
parent | c2728f95086c54aa842e4c1dae8f3b5c290a72fa (diff) | |
download | armnn-5d737fb3b06c17ff6b65fb307343ca1c0c680401.tar.gz |
IVGCVSW-3937 Update the Send thread to send out the Metadata packet
* The Send thread now automatically sends out Stream Metadata packets when
the Profiling Service is in WaitingForAck state
* Added a reference to the profiling state in the SendCounterPacket class
* Moving the RuntimeException thrown in the Send thread to the main thread
for rethrowing
* The Stop method now rethrows the exception occurred in the send thread
* The Stop method does not rethrow when destructing the object
* Added unit tests
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Change-Id: Ice7080bff63199eac84fc4fa1d37fb1a6fcdff89
Diffstat (limited to 'src/profiling/test/SendCounterPacketTests.hpp')
-rw-r--r-- | src/profiling/test/SendCounterPacketTests.hpp | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/src/profiling/test/SendCounterPacketTests.hpp b/src/profiling/test/SendCounterPacketTests.hpp index 0323f62d80..cae02b064d 100644 --- a/src/profiling/test/SendCounterPacketTests.hpp +++ b/src/profiling/test/SendCounterPacketTests.hpp @@ -19,7 +19,6 @@ namespace armnn namespace profiling { - class MockProfilingConnection : public IProfilingConnection { public: @@ -33,38 +32,20 @@ public: bool WritePacket(const unsigned char* buffer, uint32_t length) override { - return buffer != nullptr && length > 0; - } - - Packet ReadPacket(uint32_t timeout) override { return Packet(); } - -private: - bool m_IsOpen; -}; - -class MockWriteProfilingConnection : public IProfilingConnection -{ -public: - MockWriteProfilingConnection() - : m_IsOpen(true) - {} - - bool IsOpen() override { return m_IsOpen; } - - void Close() override { m_IsOpen = false; } + if (buffer == nullptr || length == 0) + { + return false; + } - bool WritePacket(const unsigned char* buffer, uint32_t length) override - { m_WrittenData.push_back(length); - return buffer != nullptr && length > 0; + return true; } Packet ReadPacket(uint32_t timeout) override { return Packet(); } - std::vector<uint32_t> GetWrittenData() - { - return m_WrittenData; - } + const std::vector<uint32_t>& GetWrittenData() const { return m_WrittenData; } + + void Clear() { m_WrittenData.clear(); } private: bool m_IsOpen; @@ -497,8 +478,8 @@ private: class SendCounterPacketTest : public SendCounterPacket { public: - SendCounterPacketTest(IBufferManager& buffer) - : SendCounterPacket(buffer) + SendCounterPacketTest(ProfilingStateMachine& profilingStateMachine, IBufferManager& buffer) + : SendCounterPacket(profilingStateMachine, buffer) {} bool CreateDeviceRecordTest(const DevicePtr& device, |