diff options
author | Sadik Armagan <sadik.armagan@arm.com> | 2020-02-25 12:44:44 +0000 |
---|---|---|
committer | Sadik Armagan <sadik.armagan@arm.com> | 2020-02-28 16:01:46 +0000 |
commit | 4c998993bda1475595be5505690ff4e08dc2389e (patch) | |
tree | 643dc71e82c8affd842481d4aa389db7de2c5c42 /src/profiling/test | |
parent | 3b3c381963a1bfe12e083928a3abb5a9852b199b (diff) | |
download | armnn-4c998993bda1475595be5505690ff4e08dc2389e.tar.gz |
IVGCVSW-4454 Remove the CounterSet and Device fields from Category
Signed-off-by: Sadik Armagan <sadik.armagan@arm.com>
Change-Id: I721f59cd1f6d068e02dabd62c42871a43be9d934
Diffstat (limited to 'src/profiling/test')
-rw-r--r-- | src/profiling/test/ProfilingMocks.hpp | 36 | ||||
-rw-r--r-- | src/profiling/test/ProfilingTests.cpp | 93 | ||||
-rw-r--r-- | src/profiling/test/SendCounterPacketTests.cpp | 69 |
3 files changed, 47 insertions, 151 deletions
diff --git a/src/profiling/test/ProfilingMocks.hpp b/src/profiling/test/ProfilingMocks.hpp index 3782a0f7e4..19aad491af 100644 --- a/src/profiling/test/ProfilingMocks.hpp +++ b/src/profiling/test/ProfilingMocks.hpp @@ -443,18 +443,10 @@ public: ~MockCounterDirectory() = default; // Register profiling objects - const Category* RegisterCategory(const std::string& categoryName, - const armnn::Optional<uint16_t>& deviceUid = armnn::EmptyOptional(), - const armnn::Optional<uint16_t>& counterSetUid = armnn::EmptyOptional()) + const Category* RegisterCategory(const std::string& categoryName) { - // Get the device UID - uint16_t deviceUidValue = deviceUid.has_value() ? deviceUid.value() : 0; - - // Get the counter set UID - uint16_t counterSetUidValue = counterSetUid.has_value() ? counterSetUid.value() : 0; - // Create the category - CategoryPtr category = std::make_unique<Category>(categoryName, deviceUidValue, counterSetUidValue); + CategoryPtr category = std::make_unique<Category>(categoryName); BOOST_ASSERT(category); // Get the raw category pointer @@ -468,8 +460,7 @@ public: } const Device* RegisterDevice(const std::string& deviceName, - uint16_t cores = 0, - const armnn::Optional<std::string>& parentCategoryName = armnn::EmptyOptional()) + uint16_t cores = 0) { // Get the device UID uint16_t deviceUid = GetNextUid(); @@ -485,22 +476,12 @@ public: // Register the device m_Devices.insert(std::make_pair(deviceUid, std::move(device))); - // Connect the counter set to the parent category, if required - if (parentCategoryName.has_value()) - { - // Set the counter set UID in the parent category - Category* parentCategory = const_cast<Category*>(GetCategory(parentCategoryName.value())); - BOOST_ASSERT(parentCategory); - parentCategory->m_DeviceUid = deviceUid; - } - return devicePtr; } const CounterSet* RegisterCounterSet( const std::string& counterSetName, - uint16_t count = 0, - const armnn::Optional<std::string>& parentCategoryName = armnn::EmptyOptional()) + uint16_t count = 0) { // Get the counter set UID uint16_t counterSetUid = GetNextUid(); @@ -516,15 +497,6 @@ public: // Register the counter set m_CounterSets.insert(std::make_pair(counterSetUid, std::move(counterSet))); - // Connect the counter set to the parent category, if required - if (parentCategoryName.has_value()) - { - // Set the counter set UID in the parent category - Category* parentCategory = const_cast<Category*>(GetCategory(parentCategoryName.value())); - BOOST_ASSERT(parentCategory); - parentCategory->m_CounterSetUid = counterSetUid; - } - return counterSetPtr; } diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index c025aa2e3e..6c1e84b8d0 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -787,8 +787,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCategory) BOOST_CHECK(category); BOOST_CHECK(category->m_Name == categoryName); BOOST_CHECK(category->m_Counters.empty()); - BOOST_CHECK(category->m_DeviceUid == 0); - BOOST_CHECK(category->m_CounterSetUid == 0); // Get the registered category const Category* registeredCategory = counterDirectory.GetCategory(categoryName); @@ -821,39 +819,29 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCategory) // Register a new category not associated to any device const std::string categoryWoDeviceName = "some_category_without_device"; const Category* categoryWoDevice = nullptr; - BOOST_CHECK_NO_THROW(categoryWoDevice = counterDirectory.RegisterCategory(categoryWoDeviceName, 0)); + BOOST_CHECK_NO_THROW(categoryWoDevice = counterDirectory.RegisterCategory(categoryWoDeviceName)); BOOST_CHECK(counterDirectory.GetCategoryCount() == 2); BOOST_CHECK(categoryWoDevice); BOOST_CHECK(categoryWoDevice->m_Name == categoryWoDeviceName); BOOST_CHECK(categoryWoDevice->m_Counters.empty()); - BOOST_CHECK(categoryWoDevice->m_DeviceUid == 0); - BOOST_CHECK(categoryWoDevice->m_CounterSetUid == 0); - // Register a new category associated to an invalid device - const std::string categoryWInvalidDeviceName = "some_category_with_invalid_device"; - - ARMNN_NO_CONVERSION_WARN_BEGIN - uint16_t invalidDeviceUid = device->m_Uid + 10; - ARMNN_NO_CONVERSION_WARN_END - - const Category* categoryWInvalidDevice = nullptr; - BOOST_CHECK_THROW(categoryWInvalidDevice = - counterDirectory.RegisterCategory(categoryWInvalidDeviceName, invalidDeviceUid), + // Register a new category associated to an invalid device name (already exist) + const Category* categoryInvalidDeviceName = nullptr; + BOOST_CHECK_THROW(categoryInvalidDeviceName = + counterDirectory.RegisterCategory(categoryWoDeviceName), armnn::InvalidArgumentException); BOOST_CHECK(counterDirectory.GetCategoryCount() == 2); - BOOST_CHECK(!categoryWInvalidDevice); + BOOST_CHECK(!categoryInvalidDeviceName); // Register a new category associated to a valid device const std::string categoryWValidDeviceName = "some_category_with_valid_device"; const Category* categoryWValidDevice = nullptr; BOOST_CHECK_NO_THROW(categoryWValidDevice = - counterDirectory.RegisterCategory(categoryWValidDeviceName, device->m_Uid)); + counterDirectory.RegisterCategory(categoryWValidDeviceName)); BOOST_CHECK(counterDirectory.GetCategoryCount() == 3); BOOST_CHECK(categoryWValidDevice); BOOST_CHECK(categoryWValidDevice != category); BOOST_CHECK(categoryWValidDevice->m_Name == categoryWValidDeviceName); - BOOST_CHECK(categoryWValidDevice->m_DeviceUid == device->m_Uid); - BOOST_CHECK(categoryWValidDevice->m_CounterSetUid == 0); // Register a counter set for testing const std::string counterSetName = "some_counter_set"; @@ -869,50 +857,29 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCategory) const std::string categoryWoCounterSetName = "some_category_without_counter_set"; const Category* categoryWoCounterSet = nullptr; BOOST_CHECK_NO_THROW(categoryWoCounterSet = - counterDirectory.RegisterCategory(categoryWoCounterSetName, armnn::EmptyOptional(), 0)); + counterDirectory.RegisterCategory(categoryWoCounterSetName)); BOOST_CHECK(counterDirectory.GetCategoryCount() == 4); BOOST_CHECK(categoryWoCounterSet); BOOST_CHECK(categoryWoCounterSet->m_Name == categoryWoCounterSetName); - BOOST_CHECK(categoryWoCounterSet->m_DeviceUid == 0); - BOOST_CHECK(categoryWoCounterSet->m_CounterSetUid == 0); - - // Register a new category associated to an invalid counter set - const std::string categoryWInvalidCounterSetName = "some_category_with_invalid_counter_set"; - - ARMNN_NO_CONVERSION_WARN_BEGIN - uint16_t invalidCunterSetUid = counterSet->m_Uid + 10; - ARMNN_NO_CONVERSION_WARN_END - - const Category* categoryWInvalidCounterSet = nullptr; - BOOST_CHECK_THROW(categoryWInvalidCounterSet = counterDirectory.RegisterCategory( - categoryWInvalidCounterSetName, armnn::EmptyOptional(), invalidCunterSetUid), - armnn::InvalidArgumentException); - BOOST_CHECK(counterDirectory.GetCategoryCount() == 4); - BOOST_CHECK(!categoryWInvalidCounterSet); // Register a new category associated to a valid counter set const std::string categoryWValidCounterSetName = "some_category_with_valid_counter_set"; const Category* categoryWValidCounterSet = nullptr; - BOOST_CHECK_NO_THROW(categoryWValidCounterSet = counterDirectory.RegisterCategory( - categoryWValidCounterSetName, armnn::EmptyOptional(), counterSet->m_Uid)); + BOOST_CHECK_NO_THROW(categoryWValidCounterSet = counterDirectory.RegisterCategory(categoryWValidCounterSetName)); BOOST_CHECK(counterDirectory.GetCategoryCount() == 5); BOOST_CHECK(categoryWValidCounterSet); BOOST_CHECK(categoryWValidCounterSet != category); BOOST_CHECK(categoryWValidCounterSet->m_Name == categoryWValidCounterSetName); - BOOST_CHECK(categoryWValidCounterSet->m_DeviceUid == 0); - BOOST_CHECK(categoryWValidCounterSet->m_CounterSetUid == counterSet->m_Uid); // Register a new category associated to a valid device and counter set const std::string categoryWValidDeviceAndValidCounterSetName = "some_category_with_valid_device_and_counter_set"; const Category* categoryWValidDeviceAndValidCounterSet = nullptr; BOOST_CHECK_NO_THROW(categoryWValidDeviceAndValidCounterSet = counterDirectory.RegisterCategory( - categoryWValidDeviceAndValidCounterSetName, device->m_Uid, counterSet->m_Uid)); + categoryWValidDeviceAndValidCounterSetName)); BOOST_CHECK(counterDirectory.GetCategoryCount() == 6); BOOST_CHECK(categoryWValidDeviceAndValidCounterSet); BOOST_CHECK(categoryWValidDeviceAndValidCounterSet != category); BOOST_CHECK(categoryWValidDeviceAndValidCounterSet->m_Name == categoryWValidDeviceAndValidCounterSetName); - BOOST_CHECK(categoryWValidDeviceAndValidCounterSet->m_DeviceUid == device->m_Uid); - BOOST_CHECK(categoryWValidDeviceAndValidCounterSet->m_CounterSetUid == counterSet->m_Uid); } BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterDevice) @@ -1004,8 +971,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterDevice) BOOST_CHECK(category); BOOST_CHECK(category->m_Name == categoryName); BOOST_CHECK(category->m_Counters.empty()); - BOOST_CHECK(category->m_DeviceUid == 0); - BOOST_CHECK(category->m_CounterSetUid == 0); // Register a new device with cores and valid parent category const std::string deviceWCoresWValidParentCategoryName = "some_device_with_cores_with_valid_parent_category"; @@ -1019,15 +984,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterDevice) BOOST_CHECK(deviceWCoresWValidParentCategory->m_Uid > device->m_Uid); BOOST_CHECK(deviceWCoresWValidParentCategory->m_Uid > deviceWCores->m_Uid); BOOST_CHECK(deviceWCoresWValidParentCategory->m_Cores == 4); - BOOST_CHECK(category->m_DeviceUid == deviceWCoresWValidParentCategory->m_Uid); - - // Register a device associated to a category already associated to a different device - const std::string deviceSameCategoryName = "some_device_with_invalid_parent_category"; - const Device* deviceSameCategory = nullptr; - BOOST_CHECK_THROW(deviceSameCategory = counterDirectory.RegisterDevice(deviceSameCategoryName, 0, categoryName), - armnn::InvalidArgumentException); - BOOST_CHECK(counterDirectory.GetDeviceCount() == 3); - BOOST_CHECK(!deviceSameCategory); } BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounterSet) @@ -1123,8 +1079,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounterSet) BOOST_CHECK(category); BOOST_CHECK(category->m_Name == categoryName); BOOST_CHECK(category->m_Counters.empty()); - BOOST_CHECK(category->m_DeviceUid == 0); - BOOST_CHECK(category->m_CounterSetUid == 0); // Register a new counter set with count and valid parent category const std::string counterSetWCountWValidParentCategoryName = "some_counter_set_with_count_" @@ -1139,13 +1093,13 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounterSet) BOOST_CHECK(counterSetWCountWValidParentCategory->m_Uid > counterSet->m_Uid); BOOST_CHECK(counterSetWCountWValidParentCategory->m_Uid > counterSetWCount->m_Uid); BOOST_CHECK(counterSetWCountWValidParentCategory->m_Count == 42); - BOOST_CHECK(category->m_CounterSetUid == counterSetWCountWValidParentCategory->m_Uid); - // Register a counter set associated to a category already associated to a different counter set + // Register a counter set associated to a category with invalid name const std::string counterSetSameCategoryName = "some_counter_set_with_invalid_parent_category"; + const std::string invalidCategoryName = ""; const CounterSet* counterSetSameCategory = nullptr; BOOST_CHECK_THROW(counterSetSameCategory = - counterDirectory.RegisterCounterSet(counterSetSameCategoryName, 0, categoryName), + counterDirectory.RegisterCounterSet(counterSetSameCategoryName, 0, invalidCategoryName), armnn::InvalidArgumentException); BOOST_CHECK(counterDirectory.GetCounterSetCount() == 3); BOOST_CHECK(!counterSetSameCategory); @@ -1323,8 +1277,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) BOOST_CHECK(category); BOOST_CHECK(category->m_Name == categoryName); BOOST_CHECK(category->m_Counters.empty()); - BOOST_CHECK(category->m_DeviceUid == 0); - BOOST_CHECK(category->m_CounterSetUid == 0); // Register a counter with a valid parent category name const Counter* counter = nullptr; @@ -1602,6 +1554,7 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) // Register a counter with a valid parent category name and getting the number of cores of the multi-core device // associated to that category const Counter* counterWMultiCoreDeviceWParentCategory = nullptr; + uint16_t numberOfCourse = multiCoreDeviceWParentCategory->m_Cores; BOOST_CHECK_NO_THROW(counterWMultiCoreDeviceWParentCategory = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, 100, @@ -1611,9 +1564,9 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) 123.45f, "valid name 10", "valid description", - armnn::EmptyOptional(),// Units - armnn::EmptyOptional(),// Number of cores - armnn::EmptyOptional(),// Device UID + armnn::EmptyOptional(), // Units + numberOfCourse, // Number of cores + armnn::EmptyOptional(), // Device UID armnn::EmptyOptional()));// Counter set UID BOOST_CHECK(counterDirectory.GetCounterCount() == 26); BOOST_CHECK(counterWMultiCoreDeviceWParentCategory); @@ -1626,8 +1579,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) BOOST_CHECK(counterWMultiCoreDeviceWParentCategory->m_Name == "valid name 10"); BOOST_CHECK(counterWMultiCoreDeviceWParentCategory->m_Description == "valid description"); BOOST_CHECK(counterWMultiCoreDeviceWParentCategory->m_Units == ""); - BOOST_CHECK(counterWMultiCoreDeviceWParentCategory->m_DeviceUid == 0); - BOOST_CHECK(counterWMultiCoreDeviceWParentCategory->m_CounterSetUid == 0); BOOST_CHECK(category->m_Counters.size() == 26); for (size_t i = 0; i < 2; i++) { @@ -1702,8 +1653,6 @@ BOOST_AUTO_TEST_CASE(CheckCounterDirectoryRegisterCounter) BOOST_CHECK(anotherCategory != category); BOOST_CHECK(anotherCategory->m_Name == anotherCategoryName); BOOST_CHECK(anotherCategory->m_Counters.empty()); - BOOST_CHECK(anotherCategory->m_DeviceUid == 0); - BOOST_CHECK(anotherCategory->m_CounterSetUid == 0); // Register a counter to the other category const Counter* anotherCounter = nullptr; @@ -2304,7 +2253,7 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest2) BOOST_CHECK(device != nullptr); const CounterSet* counterSet = counterDirectory.RegisterCounterSet("countersetA"); BOOST_CHECK(counterSet != nullptr); - counterDirectory.RegisterCategory("categoryA", device->m_Uid, counterSet->m_Uid); + counterDirectory.RegisterCategory("categoryA"); counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, 24, "categoryA", 0, 1, 2.0f, "counterA", "descA"); counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, 25, @@ -2326,7 +2275,7 @@ BOOST_AUTO_TEST_CASE(RequestCounterDirectoryCommandHandlerTest2) BOOST_TEST(((header1Word0 >> 26) & 0x0000003F) == 0); // packet family BOOST_TEST(((header1Word0 >> 16) & 0x000003FF) == 2); // packet id - BOOST_TEST(header1Word1 == 240); // data length + BOOST_TEST(header1Word1 == 236); // data length uint32_t bodyHeader1Word0 = ReadUint32(readBuffer1, 8); uint32_t bodyHeader1Word1 = ReadUint32(readBuffer1, 12); @@ -2474,9 +2423,9 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodRequestCounterDirectoryPacket) // Write the packet to the mock profiling connection mockProfilingConnection->WritePacket(std::move(requestCounterDirectoryPacket)); - // Expecting one CounterDirectory Packet of length 656 + // Expecting one CounterDirectory Packet of length 652 // and one TimelineMessageDirectory packet of length 427 - BOOST_CHECK(helper.WaitForPacketsSent(mockProfilingConnection, PacketType::CounterDirectory, 656) == 1); + BOOST_CHECK(helper.WaitForPacketsSent(mockProfilingConnection, PacketType::CounterDirectory, 652) == 1); BOOST_CHECK(helper.WaitForPacketsSent(mockProfilingConnection, PacketType::TimelineMessageDirectory, 427) == 1); // The Request Counter Directory Command Handler should not have updated the profiling state diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp index 48a0bb64de..d7dc7e2d9e 100644 --- a/src/profiling/test/SendCounterPacketTests.cpp +++ b/src/profiling/test/SendCounterPacketTests.cpp @@ -858,9 +858,7 @@ BOOST_AUTO_TEST_CASE(CreateCategoryRecordTest) // Create a category for testing const std::string categoryName = "some_category"; - uint16_t deviceUid = 1302; - uint16_t counterSetUid = 20734; - const CategoryPtr category = std::make_unique<Category>(categoryName, deviceUid, counterSetUid); + const CategoryPtr category = std::make_unique<Category>(categoryName); BOOST_ASSERT(category); category->m_Counters = { 11u, 23u, 5670u }; @@ -917,21 +915,14 @@ BOOST_AUTO_TEST_CASE(CreateCategoryRecordTest) BOOST_CHECK(result); BOOST_CHECK(errorMessage.empty()); - BOOST_CHECK(categoryRecord.size() == 80); // Size in words: header [4] + event pointer table [3] + + BOOST_CHECK(categoryRecord.size() == 79); // Size in words: header [3] + event pointer table [3] + // category name [5] + event records [68 = 22 + 20 + 26] - uint16_t categoryRecordWord0[] + uint16_t categoryRecordWord1[] { static_cast<uint16_t>(categoryRecord[0] >> 16), static_cast<uint16_t>(categoryRecord[0]) }; - uint16_t categoryRecordWord1[] - { - static_cast<uint16_t>(categoryRecord[1] >> 16), - static_cast<uint16_t>(categoryRecord[1]) - }; - BOOST_CHECK(categoryRecordWord0[0] == deviceUid); // device - BOOST_CHECK(categoryRecordWord0[1] == counterSetUid); // counter_set BOOST_CHECK(categoryRecordWord1[0] == categoryEventCount); // event_count BOOST_CHECK(categoryRecordWord1[1] == 0); // reserved @@ -943,10 +934,10 @@ BOOST_AUTO_TEST_CASE(CreateCategoryRecordTest) categoryEventCount * uint32_t_size; // The size of the event pointer table ARMNN_NO_CONVERSION_WARN_END - BOOST_CHECK(categoryRecord[2] == eventPointerTableOffset); // event_pointer_table_offset - BOOST_CHECK(categoryRecord[3] == categoryNameOffset); // name_offset + BOOST_CHECK(categoryRecord[1] == eventPointerTableOffset); // event_pointer_table_offset + BOOST_CHECK(categoryRecord[2] == categoryNameOffset); // name_offset - auto categoryRecordPool = reinterpret_cast<unsigned char*>(categoryRecord.data() + 4u); // The start of the pool + auto categoryRecordPool = reinterpret_cast<unsigned char*>(categoryRecord.data() + 3u); // The start of the pool // The event pointer table uint32_t eventRecord0Offset = categoryRecordPool[eventPointerTableOffset + 0 * uint32_t_size]; @@ -1062,9 +1053,7 @@ BOOST_AUTO_TEST_CASE(CreateInvalidCategoryRecordTest1) // Create a category for testing const std::string categoryName = "some invalid category"; - uint16_t deviceUid = 1302; - uint16_t counterSetUid = 20734; - const CategoryPtr category = std::make_unique<Category>(categoryName, deviceUid, counterSetUid); + const CategoryPtr category = std::make_unique<Category>(categoryName); BOOST_CHECK(category); // Create a category record @@ -1085,9 +1074,7 @@ BOOST_AUTO_TEST_CASE(CreateInvalidCategoryRecordTest2) // Create a category for testing const std::string categoryName = "some_category"; - uint16_t deviceUid = 1302; - uint16_t counterSetUid = 20734; - const CategoryPtr category = std::make_unique<Category>(categoryName, deviceUid, counterSetUid); + const CategoryPtr category = std::make_unique<Category>(categoryName); BOOST_CHECK(category); category->m_Counters = { 11u, 23u, 5670u }; @@ -1174,20 +1161,19 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest2) // Register a category associated to "device1" and "counterset1" const std::string category1Name = "category1"; const Category* category1 = nullptr; - BOOST_CHECK_NO_THROW(category1 = counterDirectory.RegisterCategory(category1Name, - device1->m_Uid, - counterSet1->m_Uid)); + BOOST_CHECK_NO_THROW(category1 = counterDirectory.RegisterCategory(category1Name)); BOOST_CHECK(counterDirectory.GetCategoryCount() == 1); BOOST_CHECK(category1); // Register a category not associated to "device2" but no counter set const std::string category2Name = "category2"; const Category* category2 = nullptr; - BOOST_CHECK_NO_THROW(category2 = counterDirectory.RegisterCategory(category2Name, - device2->m_Uid)); + BOOST_CHECK_NO_THROW(category2 = counterDirectory.RegisterCategory(category2Name)); BOOST_CHECK(counterDirectory.GetCategoryCount() == 2); BOOST_CHECK(category2); + uint16_t numberOfCores = 3; + // Register a counter associated to "category1" const Counter* counter1 = nullptr; BOOST_CHECK_NO_THROW(counter1 = counterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID, @@ -1198,7 +1184,8 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest2) 123.45f, "counter1", "counter1description", - std::string("counter1units"))); + std::string("counter1units"), + numberOfCores)); BOOST_CHECK(counterDirectory.GetCounterCount() == 3); BOOST_CHECK(counter1); @@ -1249,7 +1236,7 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest2) uint32_t packetHeaderWord1 = ReadUint32(readBuffer, 4); BOOST_TEST(((packetHeaderWord0 >> 26) & 0x3F) == 0); // packet_family BOOST_TEST(((packetHeaderWord0 >> 16) & 0x3FF) == 2); // packet_id - BOOST_TEST(packetHeaderWord1 == 936); // data_length + BOOST_TEST(packetHeaderWord1 == 928); // data_length // Check the body header uint32_t bodyHeaderWord0 = ReadUint32(readBuffer, 8); @@ -1282,7 +1269,7 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest2) uint32_t categoryRecordOffset0 = ReadUint32(readBuffer, 44); uint32_t categoryRecordOffset1 = ReadUint32(readBuffer, 48); BOOST_TEST(categoryRecordOffset0 == 64); // Category record offset for "category1" - BOOST_TEST(categoryRecordOffset1 == 476); // Category record offset for "category2" + BOOST_TEST(categoryRecordOffset1 == 472); // Category record offset for "category2" // Get the device record pool offset uint32_t uint32_t_size = sizeof(uint32_t); @@ -1431,8 +1418,6 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest2) // Category record structure/collection used for testing struct CategoryRecord { - uint16_t device; - uint16_t counter_set; uint16_t event_count; uint32_t event_pointer_table_offset; uint32_t name_offset; @@ -1451,24 +1436,20 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest2) uint32_t categoryRecordOffset = ReadUint32(readBuffer, categoryRecordsPointerTableOffset + i * uint32_t_size); // Collect the data for the category record - uint32_t categoryRecordWord0 = ReadUint32(readBuffer, - packetBodyPoolOffset + categoryRecordOffset + 0 * uint32_t_size); uint32_t categoryRecordWord1 = ReadUint32(readBuffer, - packetBodyPoolOffset + categoryRecordOffset + 1 * uint32_t_size); + packetBodyPoolOffset + categoryRecordOffset + 0 * uint32_t_size); uint32_t categoryRecordWord2 = ReadUint32(readBuffer, - packetBodyPoolOffset + categoryRecordOffset + 2 * uint32_t_size); + packetBodyPoolOffset + categoryRecordOffset + 1 * uint32_t_size); uint32_t categoryRecordWord3 = ReadUint32(readBuffer, - packetBodyPoolOffset + categoryRecordOffset + 3 * uint32_t_size); + packetBodyPoolOffset + categoryRecordOffset + 2 * uint32_t_size); CategoryRecord categoryRecord; - categoryRecord.device = static_cast<uint16_t>(categoryRecordWord0 >> 16); // device - categoryRecord.counter_set = static_cast<uint16_t>(categoryRecordWord0); // counter_set categoryRecord.event_count = static_cast<uint16_t>(categoryRecordWord1 >> 16); // event_count categoryRecord.event_pointer_table_offset = categoryRecordWord2; // event_pointer_table_offset categoryRecord.name_offset = categoryRecordWord3; // name_offset uint32_t categoryRecordPoolOffset = packetBodyPoolOffset + // Packet body offset categoryRecordOffset + // Category record offset - 4 * uint32_t_size; // Category record header + 3 * uint32_t_size; // Category record header uint32_t categoryRecordNameLength = ReadUint32(readBuffer, categoryRecordPoolOffset + categoryRecord.name_offset); @@ -1603,8 +1584,6 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest2) const Category* category = counterDirectory.GetCategory(categoryRecord.name); BOOST_CHECK(category); BOOST_CHECK(category->m_Name == categoryRecord.name); - BOOST_CHECK(category->m_DeviceUid == categoryRecord.device); - BOOST_CHECK(category->m_CounterSetUid == categoryRecord.counter_set); BOOST_CHECK(category->m_Counters.size() == categoryRecord.event_count); // Check that the event records are correct @@ -1701,9 +1680,7 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest6) // Register an invalid category associated to an invalid device and an invalid counter set const std::string categoryName = "c@t€gory"; const Category* category = nullptr; - BOOST_CHECK_NO_THROW(category = counterDirectory.RegisterCategory(categoryName, - device->m_Uid, - counterSet->m_Uid)); + BOOST_CHECK_NO_THROW(category = counterDirectory.RegisterCategory(categoryName)); BOOST_CHECK(counterDirectory.GetCategoryCount() == 1); BOOST_CHECK(category); @@ -1735,9 +1712,7 @@ BOOST_AUTO_TEST_CASE(SendCounterDirectoryPacketTest7) // Register an valid category associated to a valid device and a valid counter set const std::string categoryName = "category"; const Category* category = nullptr; - BOOST_CHECK_NO_THROW(category = counterDirectory.RegisterCategory(categoryName, - device->m_Uid, - counterSet->m_Uid)); + BOOST_CHECK_NO_THROW(category = counterDirectory.RegisterCategory(categoryName)); BOOST_CHECK(counterDirectory.GetCategoryCount() == 1); BOOST_CHECK(category); |