diff options
author | Sadik Armagan <sadik.armagan@arm.com> | 2020-02-10 12:24:15 +0000 |
---|---|---|
committer | Sadik Armagan <sadik.armagan@arm.com> | 2020-02-10 14:08:54 +0000 |
commit | 3896b47a3532aadcde43a3e7fed760a0f4a29e6b (patch) | |
tree | a22d1b6d5b2df7518c9116dd48a7ca1990b3ae66 /src/profiling/test/ProfilingTests.cpp | |
parent | 03181ff73f4b37d2132f15c4bd229a148840cc15 (diff) | |
download | armnn-3896b47a3532aadcde43a3e7fed760a0f4a29e6b.tar.gz |
IVGCVSW-4328 BufferManager running out of buffers crashes application
* Refactored SendCounterPacket classes, separated SendCounterPacket from Send thread
* Created ISendThread.hpp, IConsumer, SendThread.hpp and SendThread.cpp
* Injected IConsumer to BufferManager to notify SendThread when packet is ready to read
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: I80f0bb8b8401c6bfd1611f7760217c6fe35d7ad8
Diffstat (limited to 'src/profiling/test/ProfilingTests.cpp')
-rw-r--r-- | src/profiling/test/ProfilingTests.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index b15ddf7885..0bad66fb1c 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -26,6 +26,7 @@ #include <Runtime.hpp> #include <SocketProfilingConnection.hpp> #include <SendCounterPacket.hpp> +#include <SendThread.hpp> #include <SendTimelinePacket.hpp> #include <armnn/Conversion.hpp> @@ -135,7 +136,8 @@ BOOST_AUTO_TEST_CASE(CheckCommandHandler) TestProfilingConnectionArmnnError testProfilingConnectionArmnnError; CounterDirectory counterDirectory; MockBufferManager mockBuffer(1024); - SendCounterPacket sendCounterPacket(profilingStateMachine, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); + SendThread sendThread(profilingStateMachine, mockBuffer, sendCounterPacket); SendTimelinePacket sendTimelinePacket(mockBuffer); ConnectionAcknowledgedCommandHandler connectionAcknowledgedCommandHandler(0, 1, 4194304, counterDirectory, @@ -1766,7 +1768,8 @@ BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData) TestCaptureThread captureThread; TestReadCounterValues readCounterValues; MockBufferManager mockBuffer(512); - SendCounterPacket sendCounterPacket(profilingStateMachine, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); + SendThread sendThread(profilingStateMachine, mockBuffer, sendCounterPacket); uint32_t sizeOfUint32 = numeric_cast<uint32_t>(sizeof(uint32_t)); uint32_t sizeOfUint16 = numeric_cast<uint32_t>(sizeof(uint16_t)); @@ -1896,7 +1899,8 @@ BOOST_AUTO_TEST_CASE(CheckConnectionAcknowledged) BOOST_CHECK(profilingState.GetCurrentState() == ProfilingState::Uninitialised); CounterDirectory counterDirectory; MockBufferManager mockBuffer(1024); - SendCounterPacket sendCounterPacket(profilingState, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); + SendThread sendThread(profilingState, mockBuffer, sendCounterPacket); SendTimelinePacket sendTimelinePacket(mockBuffer); ConnectionAcknowledgedCommandHandler commandHandler(packetFamilyId, connectionPacketId, version, counterDirectory, @@ -2158,7 +2162,8 @@ BOOST_AUTO_TEST_CASE(CheckPeriodicCounterCaptureThread) std::vector<uint16_t> captureIds2; MockBufferManager mockBuffer(512); - SendCounterPacket sendCounterPacket(profilingStateMachine, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); + SendThread sendThread(profilingStateMachine, mockBuffer, sendCounterPacket); std::vector<uint16_t> counterIds; CaptureReader captureReader(2); @@ -2216,7 +2221,8 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest1) ProfilingStateMachine profilingStateMachine; CounterDirectory counterDirectory; MockBufferManager mockBuffer1(1024); - SendCounterPacket sendCounterPacket(profilingStateMachine, mockBuffer1); + SendCounterPacket sendCounterPacket(mockBuffer1); + SendThread sendThread(profilingStateMachine, mockBuffer1, sendCounterPacket); MockBufferManager mockBuffer2(1024); SendTimelinePacket sendTimelinePacket(mockBuffer2); RequestCounterDirectoryCommandHandler commandHandler(familyId, packetId, version, counterDirectory, @@ -2277,7 +2283,8 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest2) ProfilingStateMachine profilingStateMachine; CounterDirectory counterDirectory; MockBufferManager mockBuffer1(1024); - SendCounterPacket sendCounterPacket(profilingStateMachine, mockBuffer1); + SendCounterPacket sendCounterPacket(mockBuffer1); + SendThread sendThread(profilingStateMachine, mockBuffer1, sendCounterPacket); MockBufferManager mockBuffer2(1024); SendTimelinePacket sendTimelinePacket(mockBuffer2); RequestCounterDirectoryCommandHandler commandHandler(familyId, packetId, version, counterDirectory, |