From 5bf1d321e480b9c0030368edd5138fec949975c1 Mon Sep 17 00:00:00 2001 From: Ferran Balaguer Date: Fri, 13 Sep 2019 13:31:40 +0100 Subject: IVGCVSW-3872 Add Missing packet to SendMetaDataPacket Signed-off-by: Ferran Balaguer Change-Id: I98d8b22bdc447c2ff3f4d74d58ef9c0eae75db76 --- src/profiling/SendCounterPacket.cpp | 13 +++++++++++-- src/profiling/test/SendCounterPacketTests.cpp | 10 ++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src/profiling') diff --git a/src/profiling/SendCounterPacket.cpp b/src/profiling/SendCounterPacket.cpp index 94a5db223e..f2172b3b7d 100644 --- a/src/profiling/SendCounterPacket.cpp +++ b/src/profiling/SendCounterPacket.cpp @@ -53,7 +53,8 @@ void SendCounterPacket::SendStreamMetaDataPacket() // Counter Directory packet (packet family=0; packet id=2) // Request Counter Directory packet (packet family=0, packet id=3) // Periodic Counter Selection packet (packet family=0, packet id=4) - uint32_t packetVersionEntries = 5; + // Periodic Counter Capture packet (packet family=1, packet class=0, type=0) + uint32_t packetVersionEntries = 6; uint32_t payloadSize = numeric_cast(infoSize + hardwareVersionSize + softwareVersionSize + processNameSize + packetVersionCountSize + @@ -150,12 +151,20 @@ void SendCounterPacket::SendStreamMetaDataPacket() uint32_t packetId = 0; offset += sizeUint32; - for (uint32_t i = 0; i < packetVersionEntries; ++i) { + for (uint32_t i = 0; i < packetVersionEntries - 1; ++i) + { WriteUint32(writeBuffer, offset, ((packetFamily & 0x3F) << 26) | ((packetId++ & 0x3FF) << 16)); offset += sizeUint32; WriteUint32(writeBuffer, offset, EncodeVersion(1, 0, 0)); offset += sizeUint32; } + + packetFamily = 1; + packetId = 0; + + WriteUint32(writeBuffer, offset, ((packetFamily & 0x3F) << 26) | ((packetId & 0x3FF) << 16)); + offset += sizeUint32; + WriteUint32(writeBuffer, offset, EncodeVersion(1, 0, 0)); } } catch(...) diff --git a/src/profiling/test/SendCounterPacketTests.cpp b/src/profiling/test/SendCounterPacketTests.cpp index 4c4620ffca..4435ab67a3 100644 --- a/src/profiling/test/SendCounterPacketTests.cpp +++ b/src/profiling/test/SendCounterPacketTests.cpp @@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest) uint32_t processNameSize = numeric_cast(processName.size()) > 0 ? numeric_cast(processName.size()) + 1 : 0; - uint32_t packetEntries = 5; + uint32_t packetEntries = 6; MockBuffer mockBuffer2(512); SendCounterPacket sendPacket2(mockBuffer2); @@ -289,7 +289,7 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest) { BOOST_TEST((ReadUint32(readBuffer2, offset) >> 16) == packetEntries); offset += sizeUint32; - for (uint32_t i = 0; i < packetEntries; ++i) + for (uint32_t i = 0; i < packetEntries - 1; ++i) { BOOST_TEST(((ReadUint32(readBuffer2, offset) >> 26) & 0x3F) == 0); BOOST_TEST(((ReadUint32(readBuffer2, offset) >> 16) & 0x3FF) == i); @@ -297,6 +297,12 @@ BOOST_AUTO_TEST_CASE(SendStreamMetaDataPacketTest) BOOST_TEST(ReadUint32(readBuffer2, offset) == EncodeVersion(1, 0, 0)); offset += sizeUint32; } + + BOOST_TEST(((ReadUint32(readBuffer2, offset) >> 26) & 0x3F) == 1); + BOOST_TEST(((ReadUint32(readBuffer2, offset) >> 16) & 0x3FF) == 0); + offset += sizeUint32; + BOOST_TEST(ReadUint32(readBuffer2, offset) == EncodeVersion(1, 0, 0)); + offset += sizeUint32; } BOOST_TEST(offset == totalLength); -- cgit v1.2.1