diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-09-19 11:57:46 +0100 |
---|---|---|
committer | Narumol Prangnawarat <narumol.prangnawarat@arm.com> | 2019-09-25 12:01:22 +0100 |
commit | 24e8f9209249c9d41e57748a1b9d2f5f978db4ee (patch) | |
tree | 8b5cd94a7196e1c5cf88dfa79e61569d36119caf /src/profiling/test/ProfilingTests.cpp | |
parent | f6e534a82d167403c5980e3ea3b67135ff9be78b (diff) | |
download | armnn-24e8f9209249c9d41e57748a1b9d2f5f978db4ee.tar.gz |
IVGCVSW-3905 Create a first implementation of the send thread
* Added the send thread directly to the SendCounterPacket class
* Updated the SendCounterPacket class constructor to also take a
reference of a IProfilingConnection object, used to send packets out
* Added Start and Stop methods to SendCounterPacket to start and
stop the send thread
* Added mutex and wait condition to make the send thread waiting for
something to send
* This implementation used the old IBufferWrapper interface
* Added defult (empty) constructor for the Packet class
* Refactoring of IPeriodicCounterCapture and SocketProfilingConnection
* Modified WritePacket to make it match IBufferWrapper::GetReadBuffer
* Added unit test for regular and stress testing of the send thread
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Change-Id: I8175619ff4e65c0d5be99bcd8bd9d8dd87f717c6
Diffstat (limited to 'src/profiling/test/ProfilingTests.cpp')
-rw-r--r-- | src/profiling/test/ProfilingTests.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index b90d469424..1741160f96 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -36,6 +36,7 @@ #include <map> #include <random> #include <thread> +#include <chrono> BOOST_AUTO_TEST_SUITE(ExternalProfiling) @@ -101,7 +102,7 @@ public: void Close(){} - bool WritePacket(const char* buffer, uint32_t length) + bool WritePacket(const unsigned char* buffer, uint32_t length) { return false; } @@ -1754,8 +1755,9 @@ BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData) uint32_t version = 1; Holder holder; TestCaptureThread captureThread; + MockProfilingConnection mockProfilingConnection; MockBuffer mockBuffer(512); - SendCounterPacket sendCounterPacket(mockBuffer); + SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); uint32_t sizeOfUint32 = numeric_cast<uint32_t>(sizeof(uint32_t)); uint32_t sizeOfUint16 = numeric_cast<uint32_t>(sizeof(uint16_t)); @@ -2112,8 +2114,9 @@ BOOST_AUTO_TEST_CASE(CheckPeriodicCounterCaptureThread) std::vector<uint16_t> captureIds1 = { 0, 1 }; std::vector<uint16_t> captureIds2; + MockProfilingConnection mockProfilingConnection; MockBuffer mockBuffer(512); - SendCounterPacket sendCounterPacket(mockBuffer); + SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); std::vector<uint16_t> counterIds; CaptureReader captureReader; @@ -2183,8 +2186,9 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest0) Packet packetA(packetId, 0, packetData); + MockProfilingConnection mockProfilingConnection; MockBuffer mockBuffer(1024); - SendCounterPacket sendCounterPacket(mockBuffer); + SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); CounterDirectory counterDirectory; @@ -2217,8 +2221,9 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest1) Packet packetA(packetId, 0, packetData); + MockProfilingConnection mockProfilingConnection; MockBuffer mockBuffer(1024); - SendCounterPacket sendCounterPacket(mockBuffer); + SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); CounterDirectory counterDirectory; const Device* device = counterDirectory.RegisterDevice("deviceA", 1); |