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<uint16_t> selectedCounterIds;
// Packet without any counters
MockBufferManager mockBuffer2(512);
- SendCounterPacket sendPacket2(mockProfilingConnection, mockBuffer2);
+ SendCounterPacket sendPacket2(mockBuffer2);
sendPacket2.SendPeriodicCounterSelectionPacket(capturePeriod, selectedCounterIds);
auto readBuffer2 = mockBuffer2.GetReadableBuffer();
// Full packet message
MockBufferManager mockBuffer3(512);
- SendCounterPacket sendPacket3(mockProfilingConnection, mockBuffer3);
+ SendCounterPacket sendPacket3(mockBuffer3);
selectedCounterIds.reserve(5);
selectedCounterIds.emplace_back(100);
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<uint64_t >(captureTimestamp.time_since_epoch().count());
// Packet without any counters
MockBufferManager mockBuffer2(512);
- SendCounterPacket sendPacket2(mockProfilingConnection, mockBuffer2);
+ SendCounterPacket sendPacket2(mockBuffer2);
sendPacket2.SendPeriodicCounterCapturePacket(time, indexValuePairs);
auto readBuffer2 = mockBuffer2.GetReadableBuffer();
// Full packet message
MockBufferManager mockBuffer3(512);
- SendCounterPacket sendPacket3(mockProfilingConnection, mockBuffer3);
+ SendCounterPacket sendPacket3(mockBuffer3);
indexValuePairs.reserve(5);
indexValuePairs.emplace_back(std::make_pair<uint16_t, uint32_t >(0, 100));
uint32_t sizeUint32 = numeric_cast<uint32_t>(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
uint32_t packetEntries = 6;
MockBufferManager mockBuffer2(512);
- SendCounterPacket sendPacket2(mockProfilingConnection, mockBuffer2);
+ SendCounterPacket sendPacket2(mockBuffer2);
sendPacket2.SendStreamMetaDataPacket();
auto readBuffer2 = mockBuffer2.GetReadableBuffer();
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;
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;
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;
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;
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;
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;
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;
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;
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;
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";
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";
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";
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);
}
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
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);
}
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);
}
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);
}
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);
}
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);
}
{
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));
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
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
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
{
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
{
MockWriteProfilingConnection mockProfilingConnection;
BufferManager bufferManager(3, 1024);
- SendCounterPacket sendCounterPacket(mockProfilingConnection, bufferManager, -1);
- sendCounterPacket.Start();
+ SendCounterPacket sendCounterPacket(bufferManager, -1);
+ sendCounterPacket.Start(mockProfilingConnection);
// SendStreamMetaDataPacket
sendCounterPacket.SendStreamMetaDataPacket();