From e61ffd00a37f02338129e92d65be2f01600014c0 Mon Sep 17 00:00:00 2001 From: Matteo Martincigh Date: Mon, 7 Oct 2019 10:19:35 +0100 Subject: IVGCVSW-3937 Make dynamic use the of the profiling connection in the SendCounterPacket class * Passing the profiling connection as an argument to the pertinent methods of the SendCounterPacket class, as the connection is created dynamically by the ProfilingService * Updated the unit tests accordingly Signed-off-by: Matteo Martincigh Change-Id: Ibe72bdbad814a201c4f1505cff4badbb9b03b13e --- src/profiling/SendCounterPacket.cpp | 20 ++--- src/profiling/SendCounterPacket.hpp | 16 ++-- src/profiling/test/ProfilingTests.cpp | 12 +-- src/profiling/test/SendCounterPacketTests.cpp | 108 ++++++++++---------------- src/profiling/test/SendCounterPacketTests.hpp | 4 +- 5 files changed, 66 insertions(+), 94 deletions(-) diff --git a/src/profiling/SendCounterPacket.cpp b/src/profiling/SendCounterPacket.cpp index 813cccfe6a..dc5a950bea 100644 --- a/src/profiling/SendCounterPacket.cpp +++ b/src/profiling/SendCounterPacket.cpp @@ -901,7 +901,7 @@ void SendCounterPacket::SetReadyToRead() m_WaitCondition.notify_one(); } -void SendCounterPacket::Start() +void SendCounterPacket::Start(IProfilingConnection& profilingConnection) { // Check if the send thread is already running if (m_IsRunning.load()) @@ -917,7 +917,7 @@ void SendCounterPacket::Start() m_KeepRunning.store(true); // Start the send thread - m_SendThread = std::thread(&SendCounterPacket::Send, this); + m_SendThread = std::thread(&SendCounterPacket::Send, this, std::ref(profilingConnection)); } void SendCounterPacket::Stop() @@ -936,7 +936,7 @@ void SendCounterPacket::Stop() } } -void SendCounterPacket::Send() +void SendCounterPacket::Send(IProfilingConnection& profilingConnection) { // Keep the sending procedure looping until the thread is signalled to stop while (m_KeepRunning.load()) @@ -954,23 +954,23 @@ void SendCounterPacket::Send() else { // Wait until the thread is notified of something to read from the buffer, - // or check anyway after a second - m_WaitCondition.wait_for(lock, std::chrono::seconds(m_Timeout)); + // or check anyway after the specified number of milliseconds + m_WaitCondition.wait_for(lock, std::chrono::milliseconds(m_Timeout)); } } // Wait condition lock scope - End - FlushBuffer(); + FlushBuffer(profilingConnection); } // Ensure that all readable data got written to the profiling connection before the thread is stopped - FlushBuffer(); + FlushBuffer(profilingConnection); // Mark the send thread as not running m_IsRunning.store(false); } -void SendCounterPacket::FlushBuffer() +void SendCounterPacket::FlushBuffer(IProfilingConnection& profilingConnection) { // Get the first available readable buffer std::unique_ptr packetBuffer = m_BufferManager.GetReadableBuffer(); @@ -991,10 +991,10 @@ void SendCounterPacket::FlushBuffer() } // Check that the profiling connection is open, silently drop the data and continue if it's closed - if (m_ProfilingConnection.IsOpen()) + if (profilingConnection.IsOpen()) { // Write a packet to the profiling connection. Silently ignore any write error and continue - m_ProfilingConnection.WritePacket(readBuffer, boost::numeric_cast(readBufferSize)); + profilingConnection.WritePacket(readBuffer, boost::numeric_cast(readBufferSize)); } // Mark the packet buffer as read diff --git a/src/profiling/SendCounterPacket.hpp b/src/profiling/SendCounterPacket.hpp index 748371b9fa..ed76937cc3 100644 --- a/src/profiling/SendCounterPacket.hpp +++ b/src/profiling/SendCounterPacket.hpp @@ -33,12 +33,11 @@ public: using IndexValuePairsVector = std::vector>; - SendCounterPacket(IProfilingConnection& profilingConnection, IBufferManager& buffer, int timeout = 1) - : m_ProfilingConnection(profilingConnection) - , m_BufferManager(buffer) + SendCounterPacket(IBufferManager& buffer, int timeout = 1000) + : m_BufferManager(buffer) + , m_Timeout(timeout) , m_IsRunning(false) , m_KeepRunning(false) - , m_Timeout(timeout) {} ~SendCounterPacket() { Stop(); } @@ -56,12 +55,12 @@ public: static const unsigned int PIPE_MAGIC = 0x45495434; static const unsigned int MAX_METADATA_PACKET_LENGTH = 4096; - void Start(); + void Start(IProfilingConnection& profilingConnection); void Stop(); bool IsRunning() { return m_IsRunning.load(); } private: - void Send(); + void Send(IProfilingConnection& profilingConnection); template void CancelOperationAndThrow(const std::string& errorMessage) @@ -87,16 +86,15 @@ private: throw ExceptionType(errorMessage); } - void FlushBuffer(); + void FlushBuffer(IProfilingConnection& profilingConnection); - IProfilingConnection& m_ProfilingConnection; IBufferManager& m_BufferManager; + int m_Timeout; std::mutex m_WaitMutex; std::condition_variable m_WaitCondition; std::thread m_SendThread; std::atomic m_IsRunning; std::atomic m_KeepRunning; - int m_Timeout; protected: // Helper methods, protected for testing diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index 71d9dcf381..ba1e6cfa5a 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -1778,9 +1778,8 @@ BOOST_AUTO_TEST_CASE(CounterSelectionCommandHandlerParseData) uint32_t version = 1; Holder holder; TestCaptureThread captureThread; - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(512); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); uint32_t sizeOfUint32 = numeric_cast(sizeof(uint32_t)); uint32_t sizeOfUint16 = numeric_cast(sizeof(uint16_t)); @@ -2140,9 +2139,8 @@ BOOST_AUTO_TEST_CASE(CheckPeriodicCounterCaptureThread) std::vector captureIds1 = { 0, 1 }; std::vector captureIds2; - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(512); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); std::vector counterIds; CaptureReader captureReader; @@ -2210,9 +2208,8 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest0) Packet packetA(packetId, 0, packetData); - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); CounterDirectory counterDirectory; @@ -2244,9 +2241,8 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest1) Packet packetA(packetId, 0, packetData); - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); CounterDirectory counterDirectory; const Device* device = counterDirectory.RegisterDevice("deviceA", 1); diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp index 0d21ec0b5d..16302bcd0a 100644 --- a/src/profiling/test/SendCounterPacketTests.cpp +++ b/src/profiling/test/SendCounterPacketTests.cpp @@ -74,9 +74,8 @@ BOOST_AUTO_TEST_CASE(MockSendCounterPacketTest) BOOST_AUTO_TEST_CASE(SendPeriodicCounterSelectionPacketTest) { // Error no space left in buffer - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer1(10); - SendCounterPacket sendPacket1(mockProfilingConnection, mockBuffer1); + SendCounterPacket sendPacket1(mockBuffer1); uint32_t capturePeriod = 1000; std::vector selectedCounterIds; @@ -85,7 +84,7 @@ BOOST_AUTO_TEST_CASE(SendPeriodicCounterSelectionPacketTest) // Packet without any counters MockBufferManager mockBuffer2(512); - SendCounterPacket sendPacket2(mockProfilingConnection, mockBuffer2); + SendCounterPacket sendPacket2(mockBuffer2); sendPacket2.SendPeriodicCounterSelectionPacket(capturePeriod, selectedCounterIds); auto readBuffer2 = mockBuffer2.GetReadableBuffer(); @@ -101,7 +100,7 @@ BOOST_AUTO_TEST_CASE(SendPeriodicCounterSelectionPacketTest) // Full packet message MockBufferManager mockBuffer3(512); - SendCounterPacket sendPacket3(mockProfilingConnection, mockBuffer3); + SendCounterPacket sendPacket3(mockBuffer3); selectedCounterIds.reserve(5); selectedCounterIds.emplace_back(100); @@ -136,9 +135,8 @@ BOOST_AUTO_TEST_CASE(SendPeriodicCounterSelectionPacketTest) BOOST_AUTO_TEST_CASE(SendPeriodicCounterCapturePacketTest) { // Error no space left in buffer - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer1(10); - SendCounterPacket sendPacket1(mockProfilingConnection, mockBuffer1); + SendCounterPacket sendPacket1(mockBuffer1); auto captureTimestamp = std::chrono::steady_clock::now(); uint64_t time = static_cast(captureTimestamp.time_since_epoch().count()); @@ -149,7 +147,7 @@ BOOST_AUTO_TEST_CASE(SendPeriodicCounterCapturePacketTest) // Packet without any counters MockBufferManager mockBuffer2(512); - SendCounterPacket sendPacket2(mockProfilingConnection, mockBuffer2); + SendCounterPacket sendPacket2(mockBuffer2); sendPacket2.SendPeriodicCounterCapturePacket(time, indexValuePairs); auto readBuffer2 = mockBuffer2.GetReadableBuffer(); @@ -166,7 +164,7 @@ BOOST_AUTO_TEST_CASE(SendPeriodicCounterCapturePacketTest) // Full packet message MockBufferManager mockBuffer3(512); - SendCounterPacket sendPacket3(mockProfilingConnection, mockBuffer3); + SendCounterPacket sendPacket3(mockBuffer3); indexValuePairs.reserve(5); indexValuePairs.emplace_back(std::make_pair(0, 100)); @@ -216,9 +214,8 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest) uint32_t sizeUint32 = numeric_cast(sizeof(uint32_t)); // Error no space left in buffer - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer1(10); - SendCounterPacket sendPacket1(mockProfilingConnection, mockBuffer1); + SendCounterPacket sendPacket1(mockBuffer1); BOOST_CHECK_THROW(sendPacket1.SendStreamMetaDataPacket(), armnn::profiling::BufferExhaustion); // Full metadata packet @@ -237,7 +234,7 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest) uint32_t packetEntries = 6; MockBufferManager mockBuffer2(512); - SendCounterPacket sendPacket2(mockProfilingConnection, mockBuffer2); + SendCounterPacket sendPacket2(mockBuffer2); sendPacket2.SendStreamMetaDataPacket(); auto readBuffer2 = mockBuffer2.GetReadableBuffer(); @@ -331,9 +328,8 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest) BOOST_AUTO_TEST_CASE(CreateDeviceRecordTest) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a device for testing uint16_t deviceUid = 27; @@ -364,9 +360,8 @@ BOOST_AUTO_TEST_CASE(CreateDeviceRecordTest) BOOST_AUTO_TEST_CASE(CreateInvalidDeviceRecordTest) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a device for testing uint16_t deviceUid = 27; @@ -386,9 +381,8 @@ BOOST_AUTO_TEST_CASE(CreateInvalidDeviceRecordTest) BOOST_AUTO_TEST_CASE(CreateCounterSetRecordTest) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a counter set for testing uint16_t counterSetUid = 27; @@ -419,9 +413,8 @@ BOOST_AUTO_TEST_CASE(CreateCounterSetRecordTest) BOOST_AUTO_TEST_CASE(CreateInvalidCounterSetRecordTest) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a counter set for testing uint16_t counterSetUid = 27; @@ -441,9 +434,8 @@ BOOST_AUTO_TEST_CASE(CreateInvalidCounterSetRecordTest) BOOST_AUTO_TEST_CASE(CreateEventRecordTest) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a counter for testing uint16_t counterUid = 7256; @@ -562,9 +554,8 @@ BOOST_AUTO_TEST_CASE(CreateEventRecordTest) BOOST_AUTO_TEST_CASE(CreateEventRecordNoUnitsTest) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a counter for testing uint16_t counterUid = 44312; @@ -666,9 +657,8 @@ BOOST_AUTO_TEST_CASE(CreateEventRecordNoUnitsTest) BOOST_AUTO_TEST_CASE(CreateInvalidEventRecordTest1) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a counter for testing uint16_t counterUid = 7256; @@ -705,9 +695,8 @@ BOOST_AUTO_TEST_CASE(CreateInvalidEventRecordTest1) BOOST_AUTO_TEST_CASE(CreateInvalidEventRecordTest2) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a counter for testing uint16_t counterUid = 7256; @@ -744,9 +733,8 @@ BOOST_AUTO_TEST_CASE(CreateInvalidEventRecordTest2) BOOST_AUTO_TEST_CASE(CreateInvalidEventRecordTest3) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a counter for testing uint16_t counterUid = 7256; @@ -783,9 +771,8 @@ BOOST_AUTO_TEST_CASE(CreateInvalidEventRecordTest3) BOOST_AUTO_TEST_CASE(CreateCategoryRecordTest) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a category for testing const std::string categoryName = "some_category"; @@ -985,9 +972,8 @@ BOOST_AUTO_TEST_CASE(CreateCategoryRecordTest) BOOST_AUTO_TEST_CASE(CreateInvalidCategoryRecordTest1) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a category for testing const std::string categoryName = "some invalid category"; @@ -1009,9 +995,8 @@ BOOST_AUTO_TEST_CASE(CreateInvalidCategoryRecordTest1) BOOST_AUTO_TEST_CASE(CreateInvalidCategoryRecordTest2) { - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(0); - SendCounterPacketTest sendCounterPacketTest(mockProfilingConnection, mockBuffer); + SendCounterPacketTest sendCounterPacketTest(mockBuffer); // Create a category for testing const std::string categoryName = "some_category"; @@ -1068,9 +1053,8 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest1) BOOST_CHECK(device2); // Buffer with not enough space - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(10); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); BOOST_CHECK_THROW(sendCounterPacket.SendCounterDirectoryPacket(counterDirectory), armnn::profiling::BufferExhaustion); } @@ -1161,9 +1145,8 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest2) BOOST_CHECK(counter3); // Buffer with enough space - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); BOOST_CHECK_NO_THROW(sendCounterPacket.SendCounterDirectoryPacket(counterDirectory)); // Get the readable buffer @@ -1563,9 +1546,8 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest3) BOOST_CHECK(device); // Buffer with enough space - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); BOOST_CHECK_THROW(sendCounterPacket.SendCounterDirectoryPacket(counterDirectory), armnn::RuntimeException); } @@ -1582,9 +1564,8 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest4) BOOST_CHECK(counterSet); // Buffer with enough space - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); BOOST_CHECK_THROW(sendCounterPacket.SendCounterDirectoryPacket(counterDirectory), armnn::RuntimeException); } @@ -1601,9 +1582,8 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest5) BOOST_CHECK(category); // Buffer with enough space - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); BOOST_CHECK_THROW(sendCounterPacket.SendCounterDirectoryPacket(counterDirectory), armnn::RuntimeException); } @@ -1636,9 +1616,8 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest6) BOOST_CHECK(category); // Buffer with enough space - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); BOOST_CHECK_THROW(sendCounterPacket.SendCounterDirectoryPacket(counterDirectory), armnn::RuntimeException); } @@ -1686,9 +1665,8 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest7) BOOST_CHECK(counter); // Buffer with enough space - MockProfilingConnection mockProfilingConnection; MockBufferManager mockBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockBuffer); + SendCounterPacket sendCounterPacket(mockBuffer); BOOST_CHECK_THROW(sendCounterPacket.SendCounterDirectoryPacket(counterDirectory), armnn::RuntimeException); } @@ -1696,16 +1674,16 @@ BOOST_AUTO_TEST_CASE(SendThreadTest0) { MockProfilingConnection mockProfilingConnection; MockStreamCounterBuffer mockStreamCounterBuffer(0); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockStreamCounterBuffer); + SendCounterPacket sendCounterPacket(mockStreamCounterBuffer); // Try to start the send thread many times, it must only start once - sendCounterPacket.Start(); + sendCounterPacket.Start(mockProfilingConnection); BOOST_CHECK(sendCounterPacket.IsRunning()); - sendCounterPacket.Start(); - sendCounterPacket.Start(); - sendCounterPacket.Start(); - sendCounterPacket.Start(); + sendCounterPacket.Start(mockProfilingConnection); + sendCounterPacket.Start(mockProfilingConnection); + sendCounterPacket.Start(mockProfilingConnection); + sendCounterPacket.Start(mockProfilingConnection); BOOST_CHECK(sendCounterPacket.IsRunning()); std::this_thread::sleep_for(std::chrono::seconds(1)); @@ -1720,8 +1698,8 @@ BOOST_AUTO_TEST_CASE(SendThreadTest1) MockProfilingConnection mockProfilingConnection; MockStreamCounterBuffer mockStreamCounterBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockStreamCounterBuffer); - sendCounterPacket.Start(); + SendCounterPacket sendCounterPacket(mockStreamCounterBuffer); + sendCounterPacket.Start(mockProfilingConnection); // Interleaving writes and reads to/from the buffer with pauses to test that the send thread actually waits for // something to become available for reading @@ -1828,8 +1806,8 @@ BOOST_AUTO_TEST_CASE(SendThreadTest2) MockProfilingConnection mockProfilingConnection; MockStreamCounterBuffer mockStreamCounterBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockStreamCounterBuffer); - sendCounterPacket.Start(); + SendCounterPacket sendCounterPacket(mockStreamCounterBuffer); + sendCounterPacket.Start(mockProfilingConnection); // Adding many spurious "ready to read" signals throughout the test to check that the send thread is // capable of handling unnecessary read requests @@ -1948,8 +1926,8 @@ BOOST_AUTO_TEST_CASE(SendThreadTest3) MockProfilingConnection mockProfilingConnection; MockStreamCounterBuffer mockStreamCounterBuffer(1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, mockStreamCounterBuffer); - sendCounterPacket.Start(); + SendCounterPacket sendCounterPacket(mockStreamCounterBuffer); + sendCounterPacket.Start(mockProfilingConnection); // Not using pauses or "grace periods" to stress test the send thread @@ -2049,8 +2027,8 @@ BOOST_AUTO_TEST_CASE(SendThreadBufferTest) { MockProfilingConnection mockProfilingConnection; BufferManager bufferManager(1, 1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, bufferManager, -1); - sendCounterPacket.Start(); + SendCounterPacket sendCounterPacket(bufferManager, -1); + sendCounterPacket.Start(mockProfilingConnection); // Interleaving writes and reads to/from the buffer with pauses to test that the send thread actually waits for // something to become available for reading @@ -2176,8 +2154,8 @@ BOOST_AUTO_TEST_CASE(SendThreadBufferTest1) { MockWriteProfilingConnection mockProfilingConnection; BufferManager bufferManager(3, 1024); - SendCounterPacket sendCounterPacket(mockProfilingConnection, bufferManager, -1); - sendCounterPacket.Start(); + SendCounterPacket sendCounterPacket(bufferManager, -1); + sendCounterPacket.Start(mockProfilingConnection); // SendStreamMetaDataPacket sendCounterPacket.SendStreamMetaDataPacket(); diff --git a/src/profiling/test/SendCounterPacketTests.hpp b/src/profiling/test/SendCounterPacketTests.hpp index 584df5e520..0323f62d80 100644 --- a/src/profiling/test/SendCounterPacketTests.hpp +++ b/src/profiling/test/SendCounterPacketTests.hpp @@ -497,8 +497,8 @@ private: class SendCounterPacketTest : public SendCounterPacket { public: - SendCounterPacketTest(IProfilingConnection& profilingconnection, IBufferManager& buffer) - : SendCounterPacket(profilingconnection, buffer) + SendCounterPacketTest(IBufferManager& buffer) + : SendCounterPacket(buffer) {} bool CreateDeviceRecordTest(const DevicePtr& device, -- cgit v1.2.1