IVGCVSW-4002 Add FamilyId to CommandHandlerKey

Change-Id: I0bb0bf77da2bcd7f4746078c4ccee9acc98638a7
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
diff --git a/src/profiling/CommandHandler.cpp b/src/profiling/CommandHandler.cpp
index b0603b0..2e22be3 100644
--- a/src/profiling/CommandHandler.cpp
+++ b/src/profiling/CommandHandler.cpp
@@ -58,7 +58,9 @@
             Version version = m_PacketVersionResolver.ResolvePacketVersion(packet.GetPacketId());
 
             CommandHandlerFunctor* commandHandlerFunctor =
-                m_CommandHandlerRegistry.GetFunctor(packet.GetPacketId(), version.GetEncodedValue());
+                m_CommandHandlerRegistry.GetFunctor(packet.GetPacketFamily(), 
+                                                    packet.GetPacketId(), 
+                                                    version.GetEncodedValue());
             BOOST_ASSERT(commandHandlerFunctor);
             commandHandlerFunctor->operator()(packet);
         }
diff --git a/src/profiling/CommandHandlerFunctor.cpp b/src/profiling/CommandHandlerFunctor.cpp
index 894e2d4..7f836cb 100644
--- a/src/profiling/CommandHandlerFunctor.cpp
+++ b/src/profiling/CommandHandlerFunctor.cpp
@@ -11,6 +11,11 @@
 namespace profiling
 {
 
+uint32_t CommandHandlerFunctor::GetFamilyId() const
+{
+    return m_FamilyId;
+}
+
 uint32_t CommandHandlerFunctor::GetPacketId() const
 {
     return m_PacketId;
diff --git a/src/profiling/CommandHandlerFunctor.hpp b/src/profiling/CommandHandlerFunctor.hpp
index 7aaab58..4d6dfa0 100644
--- a/src/profiling/CommandHandlerFunctor.hpp
+++ b/src/profiling/CommandHandlerFunctor.hpp
@@ -18,11 +18,13 @@
 class CommandHandlerFunctor
 {
 public:
-    CommandHandlerFunctor(uint32_t packetId, uint32_t version)
-        : m_PacketId(packetId)
+    CommandHandlerFunctor(uint32_t familyId, uint32_t packetId, uint32_t version)
+        : m_FamilyId(familyId),
+          m_PacketId(packetId)
         , m_Version(version)
     {}
 
+    uint32_t GetFamilyId() const;
     uint32_t GetPacketId() const;
     uint32_t GetVersion()  const;
 
@@ -31,6 +33,7 @@
     virtual ~CommandHandlerFunctor() {}
 
 private:
+    uint32_t m_FamilyId;
     uint32_t m_PacketId;
     uint32_t m_Version;
 };
diff --git a/src/profiling/CommandHandlerKey.cpp b/src/profiling/CommandHandlerKey.cpp
index 66b20c5..4d7e11a 100644
--- a/src/profiling/CommandHandlerKey.cpp
+++ b/src/profiling/CommandHandlerKey.cpp
@@ -11,6 +11,11 @@
 namespace profiling
 {
 
+uint32_t CommandHandlerKey::GetFamilyId() const
+{
+    return m_FamilyId;
+}
+
 uint32_t CommandHandlerKey::GetPacketId() const
 {
     return m_PacketId;
@@ -24,16 +29,21 @@
 bool CommandHandlerKey::operator<(const CommandHandlerKey& rhs) const
 {
     bool result = true;
-
-    if (m_PacketId == rhs.m_PacketId)
+    if (m_FamilyId == rhs.m_FamilyId)
     {
-        result = m_Version < rhs.m_Version;
+        if (m_PacketId == rhs.m_PacketId)
+        {
+            result = m_Version < rhs.m_Version;
+        }
+        else if (m_PacketId > rhs.m_PacketId)
+        {
+            result = false;
+        }
     }
-    else if (m_PacketId > rhs.m_PacketId)
+    else if (m_FamilyId > rhs.m_FamilyId)
     {
         result = false;
     }
-
     return result;
 }
 
@@ -54,7 +64,7 @@
 
 bool CommandHandlerKey::operator==(const CommandHandlerKey& rhs) const
 {
-    return m_PacketId == rhs.m_PacketId && m_Version == rhs.m_Version;
+    return m_FamilyId == rhs.m_FamilyId && m_PacketId == rhs.m_PacketId && m_Version == rhs.m_Version;
 }
 
 bool CommandHandlerKey::operator!=(const CommandHandlerKey& rhs) const
diff --git a/src/profiling/CommandHandlerKey.hpp b/src/profiling/CommandHandlerKey.hpp
index 1ec5f51..247f679 100644
--- a/src/profiling/CommandHandlerKey.hpp
+++ b/src/profiling/CommandHandlerKey.hpp
@@ -16,8 +16,10 @@
 class CommandHandlerKey
 {
 public:
-    CommandHandlerKey(uint32_t packetId, uint32_t version) : m_PacketId(packetId), m_Version(version) {};
+    CommandHandlerKey(uint32_t familyId, uint32_t packetId, uint32_t version)
+    : m_FamilyId(familyId), m_PacketId(packetId), m_Version(version) {};
 
+    uint32_t GetFamilyId() const;
     uint32_t GetPacketId() const;
     uint32_t GetVersion()  const;
 
@@ -29,6 +31,7 @@
     bool operator!=(const CommandHandlerKey& rhs) const;
 
 private:
+    uint32_t m_FamilyId;
     uint32_t m_PacketId;
     uint32_t m_Version;
 };
diff --git a/src/profiling/CommandHandlerRegistry.cpp b/src/profiling/CommandHandlerRegistry.cpp
index bd9b318..8070afe 100644
--- a/src/profiling/CommandHandlerRegistry.cpp
+++ b/src/profiling/CommandHandlerRegistry.cpp
@@ -14,11 +14,14 @@
 namespace profiling
 {
 
-void CommandHandlerRegistry::RegisterFunctor(CommandHandlerFunctor* functor, uint32_t packetId, uint32_t version)
+void CommandHandlerRegistry::RegisterFunctor(CommandHandlerFunctor* functor,
+                                             uint32_t familyId,
+                                             uint32_t packetId,
+                                             uint32_t version)
 {
     BOOST_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
 
-    CommandHandlerKey key(packetId, version);
+    CommandHandlerKey key(familyId, packetId, version);
     registry[key] = functor;
 }
 
@@ -26,12 +29,12 @@
 {
     BOOST_ASSERT_MSG(functor, "Provided functor should not be a nullptr");
 
-    RegisterFunctor(functor, functor->GetPacketId(), functor->GetVersion());
+    RegisterFunctor(functor, functor->GetFamilyId(), functor->GetPacketId(), functor->GetVersion());
 }
 
-CommandHandlerFunctor* CommandHandlerRegistry::GetFunctor(uint32_t packetId, uint32_t version) const
+CommandHandlerFunctor* CommandHandlerRegistry::GetFunctor(uint32_t familyId,uint32_t packetId, uint32_t version) const
 {
-    CommandHandlerKey key(packetId, version);
+    CommandHandlerKey key(familyId, packetId, version);
 
     // Check that the requested key exists
     if (registry.find(key) == registry.end())
diff --git a/src/profiling/CommandHandlerRegistry.hpp b/src/profiling/CommandHandlerRegistry.hpp
index 9d514bf..43419de 100644
--- a/src/profiling/CommandHandlerRegistry.hpp
+++ b/src/profiling/CommandHandlerRegistry.hpp
@@ -34,11 +34,11 @@
 public:
     CommandHandlerRegistry() = default;
 
-    void RegisterFunctor(CommandHandlerFunctor* functor, uint32_t packetId, uint32_t version);
+    void RegisterFunctor(CommandHandlerFunctor* functor, uint32_t familyId, uint32_t packetId, uint32_t version);
 
     void RegisterFunctor(CommandHandlerFunctor* functor);
 
-    CommandHandlerFunctor* GetFunctor(uint32_t packetId, uint32_t version) const;
+    CommandHandlerFunctor* GetFunctor(uint32_t familyId, uint32_t packetId, uint32_t version) const;
 
 private:
     std::unordered_map<CommandHandlerKey, CommandHandlerFunctor*, CommandHandlerHash> registry;
diff --git a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp
index d0dc07a..255fcf6 100644
--- a/src/profiling/ConnectionAcknowledgedCommandHandler.hpp
+++ b/src/profiling/ConnectionAcknowledgedCommandHandler.hpp
@@ -19,10 +19,11 @@
 {
 
 public:
-    ConnectionAcknowledgedCommandHandler(uint32_t packetId,
+    ConnectionAcknowledgedCommandHandler(uint32_t familyId,
+                                         uint32_t packetId,
                                          uint32_t version,
                                          ProfilingStateMachine& profilingStateMachine)
-        : CommandHandlerFunctor(packetId, version)
+        : CommandHandlerFunctor(familyId, packetId, version)
         , m_StateMachine(profilingStateMachine)
     {}
 
diff --git a/src/profiling/PerJobCounterSelectionCommandHandler.hpp b/src/profiling/PerJobCounterSelectionCommandHandler.hpp
index 6caa08d..738a476 100644
--- a/src/profiling/PerJobCounterSelectionCommandHandler.hpp
+++ b/src/profiling/PerJobCounterSelectionCommandHandler.hpp
@@ -19,10 +19,11 @@
 {
 
 public:
-    PerJobCounterSelectionCommandHandler(uint32_t packetId,
-                                           uint32_t version,
-                                           const ProfilingStateMachine& profilingStateMachine)
-        : CommandHandlerFunctor(packetId, version)
+    PerJobCounterSelectionCommandHandler(uint32_t familyId,
+                                         uint32_t packetId,
+                                         uint32_t version,
+                                         const ProfilingStateMachine& profilingStateMachine)
+        : CommandHandlerFunctor(familyId, packetId, version)
         , m_StateMachine(profilingStateMachine)
     {}
 
diff --git a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
index 1da08e3..e2738f8 100644
--- a/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
+++ b/src/profiling/PeriodicCounterSelectionCommandHandler.hpp
@@ -22,14 +22,15 @@
 {
 
 public:
-    PeriodicCounterSelectionCommandHandler(uint32_t packetId,
+    PeriodicCounterSelectionCommandHandler(uint32_t familyId,
+                                           uint32_t packetId,
                                            uint32_t version,
                                            Holder& captureDataHolder,
                                            IPeriodicCounterCapture& periodicCounterCapture,
                                            const IReadCounterValues& readCounterValue,
                                            ISendCounterPacket& sendCounterPacket,
                                            const ProfilingStateMachine& profilingStateMachine)
-        : CommandHandlerFunctor(packetId, version)
+        : CommandHandlerFunctor(familyId, packetId, version)
         , m_CaptureDataHolder(captureDataHolder)
         , m_PeriodicCounterCapture(periodicCounterCapture)
         , m_ReadCounterValues(readCounterValue)
diff --git a/src/profiling/ProfilingService.hpp b/src/profiling/ProfilingService.hpp
index dda37dd..ea11442 100644
--- a/src/profiling/ProfilingService.hpp
+++ b/src/profiling/ProfilingService.hpp
@@ -121,22 +121,26 @@
         , m_BufferManager()
         , m_SendCounterPacket(m_StateMachine, m_BufferManager)
         , m_PeriodicCounterCapture(m_Holder, m_SendCounterPacket, *this)
-        , m_ConnectionAcknowledgedCommandHandler(1,
+        , m_ConnectionAcknowledgedCommandHandler(0,
+                                                 1,
                                                  m_PacketVersionResolver.ResolvePacketVersion(1).GetEncodedValue(),
                                                  m_StateMachine)
-        , m_RequestCounterDirectoryCommandHandler(3,
+        , m_RequestCounterDirectoryCommandHandler(0,
+                                                  3,
                                                   m_PacketVersionResolver.ResolvePacketVersion(3).GetEncodedValue(),
                                                   m_CounterDirectory,
                                                   m_SendCounterPacket,
                                                   m_StateMachine)
-        , m_PeriodicCounterSelectionCommandHandler(4,
+        , m_PeriodicCounterSelectionCommandHandler(0,
+                                                   4,
                                                    m_PacketVersionResolver.ResolvePacketVersion(4).GetEncodedValue(),
                                                    m_Holder,
                                                    m_PeriodicCounterCapture,
                                                    *this,
                                                    m_SendCounterPacket,
                                                    m_StateMachine)
-        , m_PerJobCounterSelectionCommandHandler(5,
+        , m_PerJobCounterSelectionCommandHandler(0,
+                                                 5,
                                                  m_PacketVersionResolver.ResolvePacketVersion(4).GetEncodedValue(),
                                                  m_StateMachine)
     {
diff --git a/src/profiling/RequestCounterDirectoryCommandHandler.hpp b/src/profiling/RequestCounterDirectoryCommandHandler.hpp
index 02bf64d..907be89 100644
--- a/src/profiling/RequestCounterDirectoryCommandHandler.hpp
+++ b/src/profiling/RequestCounterDirectoryCommandHandler.hpp
@@ -20,12 +20,13 @@
 {
 
 public:
-    RequestCounterDirectoryCommandHandler(uint32_t packetId,
+    RequestCounterDirectoryCommandHandler(uint32_t familyId,
+                                          uint32_t packetId,
                                           uint32_t version,
                                           ICounterDirectory& counterDirectory,
                                           ISendCounterPacket& sendCounterPacket,
                                           ProfilingStateMachine& profilingStateMachine)
-        : CommandHandlerFunctor(packetId, version)
+        : CommandHandlerFunctor(familyId, packetId, version)
         , m_CounterDirectory(counterDirectory)
         , m_SendCounterPacket(sendCounterPacket)
         , m_StateMachine(profilingStateMachine)
diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp
index 50af75e..c255098 100644
--- a/src/profiling/test/ProfilingTests.cpp
+++ b/src/profiling/test/ProfilingTests.cpp
@@ -43,12 +43,20 @@
 
 BOOST_AUTO_TEST_CASE(CheckCommandHandlerKeyComparisons)
 {
-    CommandHandlerKey testKey0(1, 1);
-    CommandHandlerKey testKey1(1, 1);
-    CommandHandlerKey testKey2(1, 1);
-    CommandHandlerKey testKey3(0, 0);
-    CommandHandlerKey testKey4(2, 2);
-    CommandHandlerKey testKey5(0, 2);
+    CommandHandlerKey testKey1_0(1, 1, 1);
+    CommandHandlerKey testKey1_1(1, 1, 1);
+    CommandHandlerKey testKey1_2(1, 2, 1);
+
+    CommandHandlerKey testKey0(0, 1, 1);
+    CommandHandlerKey testKey1(0, 1, 1);
+    CommandHandlerKey testKey2(0, 1, 1);
+    CommandHandlerKey testKey3(0, 0, 0);
+    CommandHandlerKey testKey4(0, 2, 2);
+    CommandHandlerKey testKey5(0, 0, 2);
+
+    BOOST_CHECK(testKey1_0 > testKey0);
+    BOOST_CHECK(testKey1_0 == testKey1_1);
+    BOOST_CHECK(testKey1_0 < testKey1_2);
 
     BOOST_CHECK(testKey1<testKey4);
     BOOST_CHECK(testKey1>testKey3);
@@ -71,18 +79,18 @@
 
     std::vector<CommandHandlerKey> vect =
     {
-        CommandHandlerKey(0,1), CommandHandlerKey(2,0), CommandHandlerKey(1,0),
-        CommandHandlerKey(2,1), CommandHandlerKey(1,1), CommandHandlerKey(0,1),
-        CommandHandlerKey(2,0), CommandHandlerKey(0,0)
+        CommandHandlerKey(0,0,1), CommandHandlerKey(0,2,0), CommandHandlerKey(0,1,0),
+        CommandHandlerKey(0,2,1), CommandHandlerKey(0,1,1), CommandHandlerKey(0,0,1),
+        CommandHandlerKey(0,2,0), CommandHandlerKey(0,0,0)
     };
 
     std::sort(vect.begin(), vect.end());
 
     std::vector<CommandHandlerKey> expectedVect =
     {
-        CommandHandlerKey(0,0), CommandHandlerKey(0,1), CommandHandlerKey(0,1),
-        CommandHandlerKey(1,0), CommandHandlerKey(1,1), CommandHandlerKey(2,0),
-        CommandHandlerKey(2,0), CommandHandlerKey(2,1)
+        CommandHandlerKey(0,0,0), CommandHandlerKey(0,0,1), CommandHandlerKey(0,0,1),
+        CommandHandlerKey(0,1,0), CommandHandlerKey(0,1,1), CommandHandlerKey(0,2,0),
+        CommandHandlerKey(0,2,0), CommandHandlerKey(0,2,1)
     };
 
     BOOST_CHECK(vect == expectedVect);
@@ -97,7 +105,7 @@
     TestProfilingConnectionTimeoutError testProfilingConnectionTimeOutError;
     TestProfilingConnectionArmnnError testProfilingConnectionArmnnError;
 
-    ConnectionAcknowledgedCommandHandler connectionAcknowledgedCommandHandler(1, 4194304, profilingStateMachine);
+    ConnectionAcknowledgedCommandHandler connectionAcknowledgedCommandHandler(0, 1, 4194304, profilingStateMachine);
     CommandHandlerRegistry commandHandlerRegistry;
 
     commandHandlerRegistry.RegisterFunctor(&connectionAcknowledgedCommandHandler);
@@ -238,13 +246,13 @@
     // Hard code the version as it will be the same during a single profiling session
     uint32_t version = 1;
 
-    TestFunctorA testFunctorA(461, version);
-    TestFunctorB testFunctorB(963, version);
-    TestFunctorC testFunctorC(983, version);
+    TestFunctorA testFunctorA(7, 461, version);
+    TestFunctorB testFunctorB(8, 963, version);
+    TestFunctorC testFunctorC(5, 983, version);
 
-    CommandHandlerKey keyA(testFunctorA.GetPacketId(), testFunctorA.GetVersion());
-    CommandHandlerKey keyB(testFunctorB.GetPacketId(), testFunctorB.GetVersion());
-    CommandHandlerKey keyC(testFunctorC.GetPacketId(), testFunctorC.GetVersion());
+    CommandHandlerKey keyA(testFunctorA.GetFamilyId(), testFunctorA.GetPacketId(), testFunctorA.GetVersion());
+    CommandHandlerKey keyB(testFunctorB.GetFamilyId(), testFunctorB.GetPacketId(), testFunctorB.GetVersion());
+    CommandHandlerKey keyC(testFunctorC.GetFamilyId(), testFunctorC.GetPacketId(), testFunctorC.GetVersion());
 
     // Create the unwrapped map to simulate the Command Handler Registry
     std::map<CommandHandlerKey, CommandHandlerFunctor*> registry;
@@ -255,11 +263,11 @@
 
     // Check the order of the map is correct
     auto it = registry.begin();
-    BOOST_CHECK(it->first==keyA);
+    BOOST_CHECK(it->first==keyC); // familyId == 5
     it++;
-    BOOST_CHECK(it->first==keyB);
+    BOOST_CHECK(it->first==keyA); // familyId == 7
     it++;
-    BOOST_CHECK(it->first==keyC);
+    BOOST_CHECK(it->first==keyB); // familyId == 8
 
     std::unique_ptr<unsigned char[]> packetDataA;
     std::unique_ptr<unsigned char[]> packetDataB;
@@ -270,17 +278,17 @@
     Packet packetC(400000000, 0, packetDataC);
 
     // Check the correct operator of derived class is called
-    registry.at(CommandHandlerKey(packetA.GetPacketId(), version))->operator()(packetA);
+    registry.at(CommandHandlerKey(packetA.GetPacketFamily(), packetA.GetPacketId(), version))->operator()(packetA);
     BOOST_CHECK(testFunctorA.GetCount() == 1);
     BOOST_CHECK(testFunctorB.GetCount() == 0);
     BOOST_CHECK(testFunctorC.GetCount() == 0);
 
-    registry.at(CommandHandlerKey(packetB.GetPacketId(), version))->operator()(packetB);
+    registry.at(CommandHandlerKey(packetB.GetPacketFamily(), packetB.GetPacketId(), version))->operator()(packetB);
     BOOST_CHECK(testFunctorA.GetCount() == 1);
     BOOST_CHECK(testFunctorB.GetCount() == 1);
     BOOST_CHECK(testFunctorC.GetCount() == 0);
 
-    registry.at(CommandHandlerKey(packetC.GetPacketId(), version))->operator()(packetC);
+    registry.at(CommandHandlerKey(packetC.GetPacketFamily(), packetC.GetPacketId(), version))->operator()(packetC);
     BOOST_CHECK(testFunctorA.GetCount() == 1);
     BOOST_CHECK(testFunctorB.GetCount() == 1);
     BOOST_CHECK(testFunctorC.GetCount() == 1);
@@ -291,9 +299,9 @@
     // Hard code the version as it will be the same during a single profiling session
     uint32_t version = 1;
 
-    TestFunctorA testFunctorA(461, version);
-    TestFunctorB testFunctorB(963, version);
-    TestFunctorC testFunctorC(983, version);
+    TestFunctorA testFunctorA(7, 461, version);
+    TestFunctorB testFunctorB(8, 963, version);
+    TestFunctorC testFunctorC(5, 983, version);
 
     // Create the Command Handler Registry
     CommandHandlerRegistry registry;
@@ -312,30 +320,30 @@
     Packet packetC(400000000, 0, packetDataC);
 
     // Check the correct operator of derived class is called
-    registry.GetFunctor(packetA.GetPacketId(), version)->operator()(packetA);
+    registry.GetFunctor(packetA.GetPacketFamily(), packetA.GetPacketId(), version)->operator()(packetA);
     BOOST_CHECK(testFunctorA.GetCount() == 1);
     BOOST_CHECK(testFunctorB.GetCount() == 0);
     BOOST_CHECK(testFunctorC.GetCount() == 0);
 
-    registry.GetFunctor(packetB.GetPacketId(), version)->operator()(packetB);
+    registry.GetFunctor(packetB.GetPacketFamily(), packetB.GetPacketId(), version)->operator()(packetB);
     BOOST_CHECK(testFunctorA.GetCount() == 1);
     BOOST_CHECK(testFunctorB.GetCount() == 1);
     BOOST_CHECK(testFunctorC.GetCount() == 0);
 
-    registry.GetFunctor(packetC.GetPacketId(), version)->operator()(packetC);
+    registry.GetFunctor(packetC.GetPacketFamily(), packetC.GetPacketId(), version)->operator()(packetC);
     BOOST_CHECK(testFunctorA.GetCount() == 1);
     BOOST_CHECK(testFunctorB.GetCount() == 1);
     BOOST_CHECK(testFunctorC.GetCount() == 1);
 
     // Re-register an existing key with a new function
-    registry.RegisterFunctor(&testFunctorC, testFunctorA.GetPacketId(), version);
-    registry.GetFunctor(packetA.GetPacketId(), version)->operator()(packetC);
+    registry.RegisterFunctor(&testFunctorC, testFunctorA.GetFamilyId(), testFunctorA.GetPacketId(), version);
+    registry.GetFunctor(packetA.GetPacketFamily(), packetA.GetPacketId(), version)->operator()(packetC);
     BOOST_CHECK(testFunctorA.GetCount() == 1);
     BOOST_CHECK(testFunctorB.GetCount() == 1);
     BOOST_CHECK(testFunctorC.GetCount() == 2);
 
     // Check that non-existent key returns nullptr for its functor
-    BOOST_CHECK_THROW(registry.GetFunctor(0, 0), armnn::Exception);
+    BOOST_CHECK_THROW(registry.GetFunctor(0, 0, 0), armnn::Exception);
 }
 
 BOOST_AUTO_TEST_CASE(CheckPacketVersionResolver)
@@ -1698,7 +1706,7 @@
         uint16_t GetCounterCount() const override { return 0; }
         uint32_t GetCounterValue(uint16_t counterUid) const override { return 0; }
     };
-
+    const uint32_t familyId = 0;
     const uint32_t packetId = 0x40000;
 
     uint32_t version = 1;
@@ -1727,7 +1735,8 @@
 
     Packet packetA(packetId, dataLength1, uniqueData1);
 
-    PeriodicCounterSelectionCommandHandler commandHandler(packetId,
+    PeriodicCounterSelectionCommandHandler commandHandler(familyId,
+                                                          packetId,
                                                           version,
                                                           holder,
                                                           captureThread,
@@ -1813,6 +1822,7 @@
 {
     using boost::numeric_cast;
 
+    const uint32_t packetFamilyId = 0;
     const uint32_t connectionPacketId = 0x10000;
     const uint32_t version = 1;
 
@@ -1838,7 +1848,7 @@
     ProfilingStateMachine profilingState(ProfilingState::Uninitialised);
     BOOST_CHECK(profilingState.GetCurrentState() == ProfilingState::Uninitialised);
 
-    ConnectionAcknowledgedCommandHandler commandHandler(connectionPacketId, version, profilingState);
+    ConnectionAcknowledgedCommandHandler commandHandler(packetFamilyId, connectionPacketId, version, profilingState);
 
     // command handler received packet on ProfilingState::Uninitialised
     BOOST_CHECK_THROW(commandHandler(packetA), armnn::Exception);
@@ -1863,7 +1873,8 @@
     Packet packetB(differentPacketId, dataLength1, uniqueData1);
     profilingState.TransitionToState(ProfilingState::NotConnected);
     profilingState.TransitionToState(ProfilingState::WaitingForAck);
-    ConnectionAcknowledgedCommandHandler differentCommandHandler(differentPacketId, version, profilingState);
+    ConnectionAcknowledgedCommandHandler differentCommandHandler(
+        packetFamilyId, differentPacketId, version, profilingState);
     BOOST_CHECK_THROW(differentCommandHandler(packetB), armnn::Exception);
 }
 
@@ -2145,13 +2156,15 @@
 {
     using boost::numeric_cast;
 
+    const uint32_t familyId = 0;
     const uint32_t packetId = 3;
     const uint32_t version = 1;
     ProfilingStateMachine profilingStateMachine;
     CounterDirectory counterDirectory;
     MockBufferManager mockBuffer(1024);
     SendCounterPacket sendCounterPacket(profilingStateMachine, mockBuffer);
-    RequestCounterDirectoryCommandHandler commandHandler(packetId,
+    RequestCounterDirectoryCommandHandler commandHandler(familyId,
+                                                         packetId,
                                                          version,
                                                          counterDirectory,
                                                          sendCounterPacket,
@@ -2195,13 +2208,15 @@
 {
     using boost::numeric_cast;
 
+    const uint32_t familyId = 0;
     const uint32_t packetId = 3;
     const uint32_t version = 1;
     ProfilingStateMachine profilingStateMachine;
     CounterDirectory counterDirectory;
     MockBufferManager mockBuffer(1024);
     SendCounterPacket sendCounterPacket(profilingStateMachine, mockBuffer);
-    RequestCounterDirectoryCommandHandler commandHandler(packetId,
+    RequestCounterDirectoryCommandHandler commandHandler(familyId,
+                                                         packetId,
                                                          version,
                                                          counterDirectory,
                                                          sendCounterPacket,
diff --git a/tests/profiling/gatordmock/GatordMockMain.cpp b/tests/profiling/gatordmock/GatordMockMain.cpp
index 002d6c7..2423493 100644
--- a/tests/profiling/gatordmock/GatordMockMain.cpp
+++ b/tests/profiling/gatordmock/GatordMockMain.cpp
@@ -29,10 +29,10 @@
 
     // This functor will receive back the selection response packet.
     armnn::gatordmock::PeriodicCounterSelectionResponseHandler periodicCounterSelectionResponseHandler(
-        4, packetVersionResolver.ResolvePacketVersion(4).GetEncodedValue());
+        0, 4, packetVersionResolver.ResolvePacketVersion(4).GetEncodedValue());
     // This functor will receive the counter data.
     armnn::gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(
-        0, packetVersionResolver.ResolvePacketVersion(0).GetEncodedValue());
+        1, 0, packetVersionResolver.ResolvePacketVersion(0).GetEncodedValue());
 
     // Register different derived functors
     registry.RegisterFunctor(&periodicCounterSelectionResponseHandler);
diff --git a/tests/profiling/gatordmock/GatordMockService.cpp b/tests/profiling/gatordmock/GatordMockService.cpp
index 4b9d752..2697b2f 100644
--- a/tests/profiling/gatordmock/GatordMockService.cpp
+++ b/tests/profiling/gatordmock/GatordMockService.cpp
@@ -324,7 +324,8 @@
     // Pass packet into the handler registry
     m_PacketsReceivedCount.operator++(std::memory_order::memory_order_release);
     m_HandlerRegistry
-        .GetFunctor(packetRx.GetPacketId(),
+        .GetFunctor(packetRx.GetPacketFamily(),
+                    packetRx.GetPacketId(),
                     packetVersionResolver.ResolvePacketVersion(packetRx.GetPacketId()).GetEncodedValue())
         ->operator()(packetRx);
 
diff --git a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp
index b2fd48f..4135a2f 100644
--- a/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp
+++ b/tests/profiling/gatordmock/PeriodicCounterCaptureCommandHandler.hpp
@@ -29,13 +29,16 @@
 
 public:
     /**
-     *
+     * @param familyId The family of the packets this handler will service 
      * @param packetId The id of packets this handler will process.
      * @param version The version of that id.
      * @param quietOperation Optional parameter to turn off printouts. This is useful for unittests.
      */
-    PeriodicCounterCaptureCommandHandler(uint32_t packetId, uint32_t version, bool quietOperation = false)
-        : CommandHandlerFunctor(packetId, version)
+    PeriodicCounterCaptureCommandHandler(uint32_t familyId,
+                                         uint32_t packetId,
+                                         uint32_t version,
+                                         bool quietOperation = false)
+        : CommandHandlerFunctor(familyId, packetId, version)
         , m_QuietOperation(quietOperation)
     {}
 
diff --git a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp b/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp
index e1172e2..faf9792 100644
--- a/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp
+++ b/tests/profiling/gatordmock/PeriodicCounterSelectionResponseHandler.hpp
@@ -26,8 +26,11 @@
      * @param version The version of that id.
      * @param quietOperation Optional parameter to turn off printouts. This is useful for unittests.
      */
-    PeriodicCounterSelectionResponseHandler(uint32_t packetId, uint32_t version, bool quietOperation = true)
-        : CommandHandlerFunctor(packetId, version)
+    PeriodicCounterSelectionResponseHandler(uint32_t familyId,
+                                            uint32_t packetId,
+                                            uint32_t version,
+                                            bool quietOperation = true)
+        : CommandHandlerFunctor(familyId, packetId, version)
         , m_QuietOperation(quietOperation)
     {}
 
diff --git a/tests/profiling/gatordmock/tests/GatordMockTests.cpp b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
index 3f58f39..eb4b178 100644
--- a/tests/profiling/gatordmock/tests/GatordMockTests.cpp
+++ b/tests/profiling/gatordmock/tests/GatordMockTests.cpp
@@ -103,7 +103,7 @@
     profiling::Packet packet2(headerWord1, dataLength, uniqueData2);
 
     uint32_t version = 1;
-    gatordmock::PeriodicCounterCaptureCommandHandler commandHandler(headerWord1, version, true);
+    gatordmock::PeriodicCounterCaptureCommandHandler commandHandler(0, 4, version, false);
 
     // Simulate two separate packets coming in to calculate period
     commandHandler(packet1);
@@ -123,14 +123,14 @@
     // performance data.
 
     // Initialise functors and register into the CommandHandlerRegistry
-    uint32_t counterCaptureHeader = ConstructHeader(1, 0);
     uint32_t version              = 1;
 
     // Create the Command Handler Registry
     profiling::CommandHandlerRegistry registry;
 
     // Update with derived functors
-    gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(counterCaptureHeader, version, true);
+    gatordmock::PeriodicCounterCaptureCommandHandler counterCaptureCommandHandler(0, 4, version, false);
+
     // Register different derived functors
     registry.RegisterFunctor(&counterCaptureCommandHandler);