aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadik Armagan <sadik.armagan@arm.com>2020-02-25 12:44:44 +0000
committerSadik Armagan <sadik.armagan@arm.com>2020-02-28 16:01:46 +0000
commit4c998993bda1475595be5505690ff4e08dc2389e (patch)
tree643dc71e82c8affd842481d4aa389db7de2c5c42
parent3b3c381963a1bfe12e083928a3abb5a9852b199b (diff)
downloadarmnn-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
-rw-r--r--include/armnn/backends/profiling/IBackendProfiling.hpp4
-rw-r--r--src/profiling/CounterDirectory.cpp135
-rw-r--r--src/profiling/CounterDirectory.hpp9
-rw-r--r--src/profiling/DirectoryCaptureCommandHandler.cpp14
-rw-r--r--src/profiling/ICounterDirectory.hpp6
-rw-r--r--src/profiling/ICounterRegistry.hpp4
-rw-r--r--src/profiling/ProfilingUtils.cpp8
-rw-r--r--src/profiling/RegisterBackendCounters.cpp6
-rw-r--r--src/profiling/RegisterBackendCounters.hpp4
-rw-r--r--src/profiling/SendCounterPacket.cpp20
-rw-r--r--src/profiling/test/ProfilingMocks.hpp36
-rw-r--r--src/profiling/test/ProfilingTests.cpp93
-rw-r--r--src/profiling/test/SendCounterPacketTests.cpp69
-rw-r--r--tests/profiling/gatordmock/CounterDirectory.hpp10
-rw-r--r--tests/profiling/gatordmock/tests/GatordMockTests.cpp2
15 files changed, 68 insertions, 352 deletions
diff --git a/include/armnn/backends/profiling/IBackendProfiling.hpp b/include/armnn/backends/profiling/IBackendProfiling.hpp
index 989c5e8281..3352d37a80 100644
--- a/include/armnn/backends/profiling/IBackendProfiling.hpp
+++ b/include/armnn/backends/profiling/IBackendProfiling.hpp
@@ -49,9 +49,7 @@ struct CounterStatus
class IRegisterBackendCounters
{
public:
- virtual void RegisterCategory(const std::string& categoryName,
- const Optional<uint16_t>& deviceUid = EmptyOptional(),
- const Optional<uint16_t>& counterSetUid = EmptyOptional()) = 0;
+ virtual void RegisterCategory(const std::string& categoryName) = 0;
virtual uint16_t RegisterDevice(const std::string& deviceName,
uint16_t cores = 0,
diff --git a/src/profiling/CounterDirectory.cpp b/src/profiling/CounterDirectory.cpp
index 6b2a945c9c..052e452b7b 100644
--- a/src/profiling/CounterDirectory.cpp
+++ b/src/profiling/CounterDirectory.cpp
@@ -18,9 +18,7 @@ namespace armnn
namespace profiling
{
-const Category* CounterDirectory::RegisterCategory(const std::string& categoryName,
- const Optional<uint16_t>& deviceUid,
- const Optional<uint16_t>& counterSetUid)
+const Category* CounterDirectory::RegisterCategory(const std::string& categoryName)
{
// Check that the given category name is valid
if (categoryName.empty() ||
@@ -37,38 +35,8 @@ const Category* CounterDirectory::RegisterCategory(const std::string& categoryNa
% categoryName));
}
- // Check that a device with the given (optional) UID is already registered
- uint16_t deviceUidValue = deviceUid.has_value() ? deviceUid.value() : 0;
- if (deviceUidValue > 0)
- {
- // Check that the (optional) device is already registered
- if (!IsDeviceRegistered(deviceUidValue))
- {
- throw InvalidArgumentException(
- boost::str(boost::format("Trying to connect a category (\"%1%\") to a device that is "
- "not registered (UID %2%)")
- % categoryName
- % deviceUidValue));
- }
- }
-
- // Check that a counter set with the given (optional) UID is already registered
- uint16_t counterSetUidValue = counterSetUid.has_value() ? counterSetUid.value() : 0;
- if (counterSetUidValue > 0)
- {
- // Check that the (optional) counter set is already registered
- if (!IsCounterSetRegistered(counterSetUidValue))
- {
- throw InvalidArgumentException(
- boost::str(boost::format("Trying to connect a category (name: \"%1%\") to a counter set "
- "that is not registered (UID: %2%)")
- % categoryName
- % counterSetUidValue));
- }
- }
-
// 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
@@ -100,12 +68,7 @@ const Device* CounterDirectory::RegisterDevice(const std::string& deviceName,
% deviceName));
}
- // Peek the next UID, do not get an actual valid UID just now as we don't want to waste a good UID in case
- // the registration fails. We'll get a proper one once we're sure that the device can be registered
- uint16_t deviceUidPeek = GetNextUid(true);
-
// Check that a category with the given (optional) parent category name is already registered
- Category* parentCategoryPtr = nullptr;
if (parentCategoryName.has_value())
{
// Get the (optional) parent category name
@@ -129,32 +92,10 @@ const Device* CounterDirectory::RegisterDevice(const std::string& deviceName,
% deviceName
% parentCategoryNameValue));
}
-
- // Get the parent category
- const CategoryPtr& parentCategory = *categoryIt;
- BOOST_ASSERT(parentCategory);
-
- // Check that the given parent category is not already connected to another device
- if (parentCategory->m_DeviceUid != 0 && parentCategory->m_DeviceUid != deviceUidPeek)
- {
- throw InvalidArgumentException(
- boost::str(boost::format("Trying to connect a device (UID: %1%) to a parent category that is "
- "already connected to a different device "
- "(category \"%2%\" connected to device %3%)")
- % deviceUidPeek
- % parentCategoryNameValue
- % parentCategory->m_DeviceUid));
- }
-
- // The parent category can be associated to the device that is about to be registered.
- // Get the raw pointer to the parent category (to be used later when the device is actually been
- // registered, to make sure that the category is associated to an existing device)
- parentCategoryPtr = parentCategory.get();
}
// Get the device UID
uint16_t deviceUid = GetNextUid();
- BOOST_ASSERT(deviceUid == deviceUidPeek);
// Create the device
DevicePtr device = std::make_unique<Device>(deviceUid, deviceName, cores);
@@ -167,13 +108,6 @@ const Device* CounterDirectory::RegisterDevice(const std::string& deviceName,
// Register the device
m_Devices.insert(std::make_pair(deviceUid, std::move(device)));
- // Connect the device to the parent category, if required
- if (parentCategoryPtr)
- {
- // Set the device UID in the parent category
- parentCategoryPtr->m_DeviceUid = deviceUid;
- }
-
return devicePtr;
}
@@ -201,7 +135,6 @@ const CounterSet* CounterDirectory::RegisterCounterSet(const std::string& counte
uint16_t counterSetUidPeek = GetNextUid(true);
// Check that a category with the given (optional) parent category name is already registered
- Category* parentCategoryPtr = nullptr;
if (parentCategoryName.has_value())
{
// Get the (optional) parent category name
@@ -225,27 +158,6 @@ const CounterSet* CounterDirectory::RegisterCounterSet(const std::string& counte
% counterSetUidPeek
% parentCategoryNameValue));
}
-
- // Get the parent category
- const CategoryPtr& parentCategory = *it;
- BOOST_ASSERT(parentCategory);
-
- // Check that the given parent category is not already connected to another counter set
- if (parentCategory->m_CounterSetUid != 0 && parentCategory->m_CounterSetUid != counterSetUidPeek)
- {
- throw InvalidArgumentException(
- boost::str(boost::format("Trying to connect a counter set (UID: %1%) to a parent category "
- "that is already connected to a different counter set "
- "(category \"%2%\" connected to counter set %3%)")
- % counterSetUidPeek
- % parentCategoryNameValue
- % parentCategory->m_CounterSetUid));
- }
-
- // The parent category can be associated to the counter set that is about to be registered.
- // Get the raw pointer to the parent category (to be used later when the counter set is actually been
- // registered, to make sure that the category is associated to an existing counter set)
- parentCategoryPtr = parentCategory.get();
}
// Get the counter set UID
@@ -263,13 +175,6 @@ const CounterSet* CounterDirectory::RegisterCounterSet(const std::string& counte
// 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 (parentCategoryPtr)
- {
- // Set the counter set UID in the parent category
- parentCategoryPtr->m_CounterSetUid = counterSetUid;
- }
-
return counterSetPtr;
}
@@ -381,7 +286,7 @@ const Counter* CounterDirectory::RegisterCounter(const BackendId& backendId,
// Get the number of cores (this call may throw)
uint16_t deviceUidValue = deviceUid.has_value() ? deviceUid.value() : 0;
- uint16_t deviceCores = GetNumberOfCores(numberOfCores, deviceUidValue, parentCategory);
+ uint16_t deviceCores = GetNumberOfCores(numberOfCores, deviceUidValue);
// Get the counter UIDs and calculate the max counter UID
std::vector<uint16_t> counterUids = GetNextCounterUids(uid, deviceCores);
@@ -599,19 +504,14 @@ CountersIt CounterDirectory::FindCounter(const std::string& counterName) const
}
uint16_t CounterDirectory::GetNumberOfCores(const Optional<uint16_t>& numberOfCores,
- uint16_t deviceUid,
- const CategoryPtr& parentCategory)
+ uint16_t deviceUid)
{
- BOOST_ASSERT(parentCategory);
-
// To get the number of cores, apply the following rules:
//
// 1. If numberOfCores is set then take it as the deviceCores value
// 2. If numberOfCores is not set then check to see if this counter is directly associated with a device,
// if so then that devices number of cores is taken as the deviceCores value
- // 3. If neither of the above is set then look at the category to see if it has a device associated with it,
- // if it does then take that device's numberOfCores as the deviceCores value
- // 4. If none of the above holds then set deviceCores to zero
+ // 3. If none of the above holds then set deviceCores to zero
// 1. If numberOfCores is set then take it as the deviceCores value
if (numberOfCores.has_value())
@@ -642,30 +542,7 @@ uint16_t CounterDirectory::GetNumberOfCores(const Optional<uint16_t>& numberOfCo
return device->m_Cores;
}
- // 3. If neither of the above is set then look at the category to see if it has a device associated with it,
- // if it does then take that device's numberOfCores as the deviceCores value
- uint16_t parentCategoryDeviceUid = parentCategory->m_DeviceUid;
- if (parentCategoryDeviceUid > 0)
- {
- // Check that the device associated to the parent category is already registered
- auto deviceIt = FindDevice(parentCategoryDeviceUid);
- if (deviceIt == m_Devices.end())
- {
- throw InvalidArgumentException(
- boost::str(boost::format("Trying to get the number of cores from a device that is "
- "not registered (device UID %1%)")
- % parentCategoryDeviceUid));
- }
-
- // Get the associated device
- const DevicePtr& device = deviceIt->second;
- BOOST_ASSERT(device);
-
- // Get the number of cores of the device associated to the parent category
- return device->m_Cores;
- }
-
- // 4. If none of the above holds then set deviceCores to zero
+ // 3. If none of the above holds then set deviceCores to zero
return 0;
}
diff --git a/src/profiling/CounterDirectory.hpp b/src/profiling/CounterDirectory.hpp
index 22bae89bbb..6a73a76a0d 100644
--- a/src/profiling/CounterDirectory.hpp
+++ b/src/profiling/CounterDirectory.hpp
@@ -27,9 +27,7 @@ public:
~CounterDirectory() = default;
// Register profiling objects
- const Category* RegisterCategory (const std::string& categoryName,
- const Optional<uint16_t>& deviceUid = EmptyOptional(),
- const Optional<uint16_t>& counterSetUid = EmptyOptional()) override;
+ const Category* RegisterCategory (const std::string& categoryName) override;
const Device* RegisterDevice (const std::string& deviceName,
uint16_t cores = 0,
const Optional<std::string>& parentCategoryName = EmptyOptional()) override;
@@ -51,7 +49,7 @@ public:
// Getters for counts
uint16_t GetCategoryCount() const override { return boost::numeric_cast<uint16_t>(m_Categories.size()); }
- uint16_t GetDeviceCount() const override { return boost::numeric_cast<uint16_t>(m_Devices.size()); }
+ uint16_t GetDeviceCount() const override { return boost::numeric_cast<uint16_t>(m_Devices.size()); }
uint16_t GetCounterSetCount() const override { return boost::numeric_cast<uint16_t>(m_CounterSets.size()); }
uint16_t GetCounterCount() const override { return boost::numeric_cast<uint16_t>(m_Counters.size()); }
@@ -95,8 +93,7 @@ private:
CountersIt FindCounter(uint16_t counterUid) const;
CountersIt FindCounter(const std::string& counterName) const;
uint16_t GetNumberOfCores(const Optional<uint16_t>& numberOfCores,
- uint16_t deviceUid,
- const CategoryPtr& parentCategory);
+ uint16_t deviceUid);
};
} // namespace profiling
diff --git a/src/profiling/DirectoryCaptureCommandHandler.cpp b/src/profiling/DirectoryCaptureCommandHandler.cpp
index f221513572..65cac848ae 100644
--- a/src/profiling/DirectoryCaptureCommandHandler.cpp
+++ b/src/profiling/DirectoryCaptureCommandHandler.cpp
@@ -153,18 +153,6 @@ void DirectoryCaptureCommandHandler::ReadCategoryRecords(const unsigned char* co
{
uint32_t categoryRecordOffset = offset + categoryOffsets[categoryIndex];
- // Category record word 0:
- // 0:15 The deviceUid of a counter_set the category is associated with.
- // Set to zero if the category is NOT associated with a counter set.
- uint16_t counterSetUid = profiling::ReadUint16(data, categoryRecordOffset);
- categoryRecordOffset += uint16_t_size;
-
- // 16:31 The deviceUid of a device element which identifies some hardware device that the category belongs to.
- // Set to zero if the category is NOT associated with a device
- uint16_t deviceUid = profiling::ReadUint16(data, categoryRecordOffset);
-
- categoryRecordOffset += uint16_t_size;
-
// Category record word 1:
// 0:15 Reserved, value 0x0000.
categoryRecordOffset += uint16_t_size;
@@ -197,7 +185,7 @@ void DirectoryCaptureCommandHandler::ReadCategoryRecords(const unsigned char* co
categoryRecordOffset += uint32_t_size;
const Category* category = m_CounterDirectory.RegisterCategory(
- GetStringNameFromBuffer(data, categoryRecordOffset + nameOffset), deviceUid, counterSetUid);
+ GetStringNameFromBuffer(data, categoryRecordOffset + nameOffset));
for (auto& counter : eventRecords)
{
const Counter* registeredCounter = m_CounterDirectory.RegisterCounter(armnn::profiling::BACKEND_ID,
diff --git a/src/profiling/ICounterDirectory.hpp b/src/profiling/ICounterDirectory.hpp
index 4f82b2e6e4..b19f7d306d 100644
--- a/src/profiling/ICounterDirectory.hpp
+++ b/src/profiling/ICounterDirectory.hpp
@@ -49,10 +49,8 @@ class Category final
{
public:
// Constructors
- Category(const std::string& name, uint16_t deviceUid, uint16_t counterSetUid)
+ Category(const std::string& name)
: m_Name(name)
- , m_DeviceUid(deviceUid)
- , m_CounterSetUid(counterSetUid)
{}
// Fields
@@ -60,8 +58,6 @@ public:
// Connections
std::vector<uint16_t> m_Counters; // The UIDs of the counters associated with this category
- uint16_t m_DeviceUid; // Optional, set to zero if the counter is not associated with a device
- uint16_t m_CounterSetUid; // Optional, set to zero if the counter is not associated with a counter set
};
class Device final
diff --git a/src/profiling/ICounterRegistry.hpp b/src/profiling/ICounterRegistry.hpp
index 75bc8ef97f..83bc33587c 100644
--- a/src/profiling/ICounterRegistry.hpp
+++ b/src/profiling/ICounterRegistry.hpp
@@ -20,9 +20,7 @@ public:
virtual ~ICounterRegistry() {}
// Register profiling objects
- virtual const Category* RegisterCategory (const std::string& categoryName,
- const Optional<uint16_t>& deviceUid,
- const Optional<uint16_t>& counterSetUid) = 0;
+ virtual const Category* RegisterCategory (const std::string& categoryName) = 0;
virtual const Device* RegisterDevice (const std::string& deviceName,
uint16_t cores,
diff --git a/src/profiling/ProfilingUtils.cpp b/src/profiling/ProfilingUtils.cpp
index 0125f0db4b..3b06a2614e 100644
--- a/src/profiling/ProfilingUtils.cpp
+++ b/src/profiling/ProfilingUtils.cpp
@@ -1014,19 +1014,11 @@ void PrintCategoryDetails(const std::unique_ptr<Category>& category,
categoryHeader.append(CentreAlignFormatting("Name", 20));
categoryHeader.append(" | ");
- categoryHeader.append(CentreAlignFormatting("Device", 12));
- categoryHeader.append(" | ");
- categoryHeader.append(CentreAlignFormatting("Counter set UID:", 16));
- categoryHeader.append(" | ");
categoryHeader.append(CentreAlignFormatting("Event Count", 14));
categoryHeader.append("\n");
categoryBody.append(CentreAlignFormatting(category->m_Name, 20));
categoryBody.append(" | ");
- categoryBody.append(CentreAlignFormatting(std::to_string(category->m_DeviceUid), 12));
- categoryBody.append(" | ");
- categoryBody.append(CentreAlignFormatting(std::to_string(category->m_CounterSetUid), 16));
- categoryBody.append(" | ");
categoryBody.append(CentreAlignFormatting(std::to_string(category->m_Counters.size()), 14));
std::cout << "\n" << "\n";
diff --git a/src/profiling/RegisterBackendCounters.cpp b/src/profiling/RegisterBackendCounters.cpp
index 0c68838cd6..36f6106c00 100644
--- a/src/profiling/RegisterBackendCounters.cpp
+++ b/src/profiling/RegisterBackendCounters.cpp
@@ -11,11 +11,9 @@ namespace armnn
namespace profiling
{
-void RegisterBackendCounters::RegisterCategory(const std::string& categoryName,
- const Optional<uint16_t>& deviceUid,
- const Optional<uint16_t>& counterSetUid)
+void RegisterBackendCounters::RegisterCategory(const std::string& categoryName)
{
- m_CounterDirectory.RegisterCategory(categoryName, deviceUid, counterSetUid);
+ m_CounterDirectory.RegisterCategory(categoryName);
}
uint16_t RegisterBackendCounters::RegisterDevice(const std::string& deviceName,
diff --git a/src/profiling/RegisterBackendCounters.hpp b/src/profiling/RegisterBackendCounters.hpp
index 41886c0444..8f1fa049b6 100644
--- a/src/profiling/RegisterBackendCounters.hpp
+++ b/src/profiling/RegisterBackendCounters.hpp
@@ -27,9 +27,7 @@ public:
~RegisterBackendCounters() = default;
- void RegisterCategory(const std::string& categoryName,
- const Optional<uint16_t>& deviceUid = EmptyOptional(),
- const Optional<uint16_t>& counterSetUid = EmptyOptional()) override;
+ void RegisterCategory(const std::string& categoryName) override;
uint16_t RegisterDevice(const std::string& deviceName,
uint16_t cores = 0,
diff --git a/src/profiling/SendCounterPacket.cpp b/src/profiling/SendCounterPacket.cpp
index f60586ed26..b8ef189d6e 100644
--- a/src/profiling/SendCounterPacket.cpp
+++ b/src/profiling/SendCounterPacket.cpp
@@ -182,21 +182,12 @@ bool SendCounterPacket::CreateCategoryRecord(const CategoryPtr& category,
const std::string& categoryName = category->m_Name;
const std::vector<uint16_t> categoryCounters = category->m_Counters;
- uint16_t deviceUid = category->m_DeviceUid;
- uint16_t counterSetUid = category->m_CounterSetUid;
BOOST_ASSERT(!categoryName.empty());
// Utils
size_t uint32_t_size = sizeof(uint32_t);
- // Category record word 0:
- // 16:31 [16] device: the uid of a device element which identifies some hardware device that
- // the category belongs to
- // 0:15 [16] counter_set: the uid of a counter_set the category is associated with
- uint32_t categoryRecordWord0 = (static_cast<uint32_t>(deviceUid) << 16) |
- (static_cast<uint32_t>(counterSetUid));
-
// Category record word 1:
// 16:31 [16] event_count: number of events belonging to this category
// 0:15 [16] reserved: all zeros
@@ -252,7 +243,7 @@ bool SendCounterPacket::CreateCategoryRecord(const CategoryPtr& category,
uint32_t categoryRecordWord3 = numeric_cast<uint32_t>(eventRecordOffsets.size() * uint32_t_size);
// Calculate the size in words of the category record
- size_t categoryRecordSize = 4u + // The size of the fixed part (device + counter_set + event_count + reserved +
+ size_t categoryRecordSize = 3u + // The size of the fixed part (device + counter_set + event_count + reserved +
// event_pointer_table_offset + name_offset)
eventRecordOffsets.size() + // The size of the variable part (the event pointer table +
categoryNameBuffer.size() + // and the category name including the null-terminator +
@@ -263,11 +254,10 @@ bool SendCounterPacket::CreateCategoryRecord(const CategoryPtr& category,
ARMNN_NO_CONVERSION_WARN_BEGIN
// Create the category record
- categoryRecord[0] = categoryRecordWord0; // device + counter_set
- categoryRecord[1] = categoryRecordWord1; // event_count + reserved
- categoryRecord[2] = categoryRecordWord2; // event_pointer_table_offset
- categoryRecord[3] = categoryRecordWord3; // name_offset
- auto offset = categoryRecord.begin() + 4u;
+ categoryRecord[0] = categoryRecordWord1; // event_count + reserved
+ categoryRecord[1] = categoryRecordWord2; // event_pointer_table_offset
+ categoryRecord[2] = categoryRecordWord3; // name_offset
+ auto offset = categoryRecord.begin() + 3u;
std::copy(eventRecordOffsets.begin(), eventRecordOffsets.end(), offset); // event_pointer_table
offset += eventRecordOffsets.size();
std::copy(categoryNameBuffer.begin(), categoryNameBuffer.end(), offset); // name
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);
diff --git a/tests/profiling/gatordmock/CounterDirectory.hpp b/tests/profiling/gatordmock/CounterDirectory.hpp
index 7b45e661e0..528c037cbf 100644
--- a/tests/profiling/gatordmock/CounterDirectory.hpp
+++ b/tests/profiling/gatordmock/CounterDirectory.hpp
@@ -106,8 +106,6 @@ struct EventRecord
struct CategoryRecord
{
- uint16_t m_DeviceUid;
- uint16_t m_CounterSet;
uint16_t m_EventCount;
std::string m_CategoryName;
std::vector<EventRecord> m_EventRecords;
@@ -119,19 +117,11 @@ struct CategoryRecord
header.append(gatordmock::CentreAlignFormatting("Name", 20));
header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Device", 12));
- header.append(" | ");
- header.append(gatordmock::CentreAlignFormatting("Counter set UID:", 16));
- header.append(" | ");
header.append(gatordmock::CentreAlignFormatting("Event Count", 14));
header.append("\n");
body.append(gatordmock::CentreAlignFormatting(m_CategoryName, 20));
body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_DeviceUid), 12));
- body.append(" | ");
- body.append(gatordmock::CentreAlignFormatting(std::to_string(m_CounterSet), 16));
- body.append(" | ");
body.append(gatordmock::CentreAlignFormatting(std::to_string(m_EventCount), 14));
std::cout << "\n" << "\n";
diff --git a/tests/profiling/gatordmock/tests/GatordMockTests.cpp b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
index 02adffb2cc..fecfce42d0 100644
--- a/tests/profiling/gatordmock/tests/GatordMockTests.cpp
+++ b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
@@ -243,8 +243,6 @@ BOOST_AUTO_TEST_CASE(GatorDMockEndToEnd)
if (receivedCategory->m_Name.compare(category->m_Name) == 0)
{
// We've found the matching category.
- BOOST_CHECK(category->m_DeviceUid == receivedCategory->m_DeviceUid);
- BOOST_CHECK(category->m_CounterSetUid == receivedCategory->m_CounterSetUid);
// Now look at the interiors of the counters. Start by sorting them.
std::sort(category->m_Counters.begin(), category->m_Counters.end());
std::sort(receivedCategory->m_Counters.begin(), receivedCategory->m_Counters.end());