aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/test
diff options
context:
space:
mode:
authorJim Flynn <jim.flynn@arm.com>2020-05-26 21:10:49 +0100
committerJim Flynn <jim.flynn@arm.com>2020-05-27 15:05:25 +0000
commit1892d210d089cfbf355b44e32feb40bcb283ffc3 (patch)
tree28e53f6b63443b89cf6198f2e94af353d43e3aa6 /src/profiling/test
parent83fcf988cc1d5c9254a19258d6d67362c04bbaf4 (diff)
downloadarmnn-1892d210d089cfbf355b44e32feb40bcb283ffc3.tar.gz
IVGCVSW-4735 Add label GUID to timeline eventClass message
Change-Id: Ie205d8146f5bb1920bf001b7623ead79e2ab9e48 Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'src/profiling/test')
-rw-r--r--src/profiling/test/ProfilingTestUtils.cpp5
-rw-r--r--src/profiling/test/ProfilingTestUtils.hpp1
-rw-r--r--src/profiling/test/SendTimelinePacketTests.cpp24
-rw-r--r--src/profiling/test/TimelinePacketTests.cpp15
-rw-r--r--src/profiling/test/TimelineUtilityMethodsTests.cpp16
5 files changed, 53 insertions, 8 deletions
diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp
index ff256047be..20e1a9b446 100644
--- a/src/profiling/test/ProfilingTestUtils.cpp
+++ b/src/profiling/test/ProfilingTestUtils.cpp
@@ -118,6 +118,7 @@ void VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid,
}
void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid,
+ ProfilingGuid nameGuid,
const unsigned char* readableData,
unsigned int& offset)
{
@@ -136,6 +137,10 @@ void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid,
uint64_t readProfilingGuid = ReadUint64(readableData, offset);
BOOST_CHECK(readProfilingGuid == guid);
+ offset += uint64_t_size;
+ uint64_t readProfiilngNameGuid = ReadUint64(readableData, offset);
+ BOOST_CHECK(readProfiilngNameGuid == nameGuid);
+
// Update the offset to allow parsing to be continued after this function returns
offset += uint64_t_size;
}
diff --git a/src/profiling/test/ProfilingTestUtils.hpp b/src/profiling/test/ProfilingTestUtils.hpp
index 7e4f399eba..2e7daabda7 100644
--- a/src/profiling/test/ProfilingTestUtils.hpp
+++ b/src/profiling/test/ProfilingTestUtils.hpp
@@ -33,6 +33,7 @@ void VerifyTimelineLabelBinaryPacketData(Optional<ProfilingGuid> guid,
unsigned int& offset);
void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid,
+ ProfilingGuid nameGuid,
const unsigned char* readableData,
unsigned int& offset);
diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp
index 6d5bf490a8..05a6db8d1d 100644
--- a/src/profiling/test/SendTimelinePacketTests.cpp
+++ b/src/profiling/test/SendTimelinePacketTests.cpp
@@ -144,7 +144,9 @@ BOOST_AUTO_TEST_CASE(SendTimelineEntityWithEventClassPacketTest)
sendTimelinePacket->SendTimelineEntityBinaryPacket(entityBinaryPacketProfilingGuid);
const uint64_t eventClassBinaryPacketProfilingGuid = 789123u;
- sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassBinaryPacketProfilingGuid);
+ const uint64_t eventClassBinaryPacketNameGuid = 8845u;
+ sendTimelinePacket->SendTimelineEventClassBinaryPacket(
+ eventClassBinaryPacketProfilingGuid, eventClassBinaryPacketNameGuid);
// Commit the messages
sendTimelinePacket->Commit();
@@ -178,7 +180,7 @@ BOOST_AUTO_TEST_CASE(SendTimelineEntityWithEventClassPacketTest)
uint32_t entityBinaryPacketDataLength = (entityBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
BOOST_CHECK(entityBinaryPacketSequenceNumbered == 0);
- BOOST_CHECK(entityBinaryPacketDataLength == 24);
+ BOOST_CHECK(entityBinaryPacketDataLength == 32);
// Check the decl_id
offset += uint32_t_size;
@@ -203,6 +205,10 @@ BOOST_AUTO_TEST_CASE(SendTimelineEntityWithEventClassPacketTest)
readProfilingGuid = ReadUint64(packetBuffer, offset);
BOOST_CHECK(readProfilingGuid == eventClassBinaryPacketProfilingGuid);
+ offset += uint64_t_size;
+ uint64_t readEventClassNameGuid = ReadUint64(packetBuffer, offset);
+ BOOST_CHECK(readEventClassNameGuid == eventClassBinaryPacketNameGuid);
+
bufferManager.MarkRead(packetBuffer);
}
@@ -263,7 +269,9 @@ BOOST_AUTO_TEST_CASE(SendEventClassAfterTimelineEntityPacketTest)
// Send TimelineEventClassBinaryPacket
const uint64_t eventClassBinaryPacketProfilingGuid = 789123u;
- sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassBinaryPacketProfilingGuid);
+ const uint64_t eventClassBinaryPacketNameGuid = 8845u;
+ sendTimelinePacket->SendTimelineEventClassBinaryPacket(
+ eventClassBinaryPacketProfilingGuid, eventClassBinaryPacketNameGuid);
// Commit the buffer
sendTimelinePacket->Commit();
@@ -291,7 +299,7 @@ BOOST_AUTO_TEST_CASE(SendEventClassAfterTimelineEntityPacketTest)
uint32_t eventClassBinaryPacketSequenceNumbered = (eventClassBinaryPacketHeaderWord1 >> 24) & 0x00000001;
uint32_t eventClassBinaryPacketDataLength = (eventClassBinaryPacketHeaderWord1 >> 0) & 0x00FFFFFF;
BOOST_CHECK(eventClassBinaryPacketSequenceNumbered == 0);
- BOOST_CHECK(eventClassBinaryPacketDataLength == 12);
+ BOOST_CHECK(eventClassBinaryPacketDataLength == 20);
offset += uint32_t_size;
uint32_t eventClassDeclId = ReadUint32(packetBuffer, offset);
@@ -302,6 +310,10 @@ BOOST_AUTO_TEST_CASE(SendEventClassAfterTimelineEntityPacketTest)
readProfilingGuid = ReadUint64(packetBuffer, offset);
BOOST_CHECK(readProfilingGuid == eventClassBinaryPacketProfilingGuid);
+ offset += uint64_t_size;
+ uint64_t readEventClassNameGuid = ReadUint64(packetBuffer, offset);
+ BOOST_CHECK(readEventClassNameGuid == eventClassBinaryPacketNameGuid);
+
bufferManager.MarkRead(packetBuffer);
// Send TimelineEventBinaryPacket
@@ -388,7 +400,9 @@ BOOST_AUTO_TEST_CASE(SendTimelinePacketTests3)
// Send TimelineEventClassBinaryPacket
const uint64_t eventClassBinaryPacketProfilingGuid = 789123u;
- BOOST_CHECK_THROW(sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassBinaryPacketProfilingGuid),
+ const uint64_t eventClassBinaryPacketNameGuid = 8845u;
+ BOOST_CHECK_THROW(sendTimelinePacket->SendTimelineEventClassBinaryPacket(
+ eventClassBinaryPacketProfilingGuid, eventClassBinaryPacketNameGuid),
armnn::RuntimeException);
}
diff --git a/src/profiling/test/TimelinePacketTests.cpp b/src/profiling/test/TimelinePacketTests.cpp
index 8cce520da2..555ec670bd 100644
--- a/src/profiling/test/TimelinePacketTests.cpp
+++ b/src/profiling/test/TimelinePacketTests.cpp
@@ -645,8 +645,10 @@ BOOST_AUTO_TEST_CASE(TimelineEntityPacketTestFullConstructionOfData)
BOOST_AUTO_TEST_CASE(TimelineEventClassTestNoBuffer)
{
const uint64_t profilingGuid = 123456u;
+ const uint64_t profilingNameGuid = 3345u;
unsigned int numberOfBytesWritten = 789u;
TimelinePacketStatus result = WriteTimelineEventClassBinary(profilingGuid,
+ profilingNameGuid,
nullptr,
512u,
numberOfBytesWritten);
@@ -659,8 +661,10 @@ BOOST_AUTO_TEST_CASE(TimelineEventClassTestBufferExhaustionZeroValue)
std::vector<unsigned char> buffer(512, 0);
const uint64_t profilingGuid = 123456u;
+ const uint64_t profilingNameGuid = 3345u;
unsigned int numberOfBytesWritten = 789u;
TimelinePacketStatus result = WriteTimelineEventClassBinary(profilingGuid,
+ profilingNameGuid,
buffer.data(),
0,
numberOfBytesWritten);
@@ -673,8 +677,10 @@ BOOST_AUTO_TEST_CASE(TimelineEventClassTestBufferExhaustionFixedValue)
std::vector<unsigned char> buffer(10, 0);
const uint64_t profilingGuid = 123456u;
+ const uint64_t profilingNameGuid = 5564u;
unsigned int numberOfBytesWritten = 789u;
TimelinePacketStatus result = WriteTimelineEventClassBinary(profilingGuid,
+ profilingNameGuid,
buffer.data(),
boost::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
@@ -687,15 +693,18 @@ BOOST_AUTO_TEST_CASE(TimelineEventClassTestFullConstructionOfData)
std::vector<unsigned char> buffer(512, 0);
const uint64_t profilingGuid = 123456u;
+ const uint64_t profilingNameGuid = 654321u;
unsigned int numberOfBytesWritten = 789u;
TimelinePacketStatus result = WriteTimelineEventClassBinary(profilingGuid,
+ profilingNameGuid,
buffer.data(),
boost::numeric_cast<unsigned int>(buffer.size()),
numberOfBytesWritten);
BOOST_CHECK(result == TimelinePacketStatus::Ok);
- BOOST_CHECK(numberOfBytesWritten == 12);
+ BOOST_CHECK(numberOfBytesWritten == 20);
unsigned int uint32_t_size = sizeof(uint32_t);
+ unsigned int uint64_t_size = sizeof(uint64_t);
unsigned int offset = 0;
// Check the decl_id
@@ -706,6 +715,10 @@ BOOST_AUTO_TEST_CASE(TimelineEventClassTestFullConstructionOfData)
offset += uint32_t_size;
uint64_t readProfilingGuid = ReadUint64(buffer.data(), offset);
BOOST_CHECK(readProfilingGuid == profilingGuid);
+
+ offset += uint64_t_size;
+ uint64_t readProfilingNameGuid = ReadUint64(buffer.data(), offset);
+ BOOST_CHECK(readProfilingNameGuid == profilingNameGuid);
}
BOOST_AUTO_TEST_CASE(TimelineEventPacketTestNoBuffer)
diff --git a/src/profiling/test/TimelineUtilityMethodsTests.cpp b/src/profiling/test/TimelineUtilityMethodsTests.cpp
index 8fd8c369f4..815a3a0f95 100644
--- a/src/profiling/test/TimelineUtilityMethodsTests.cpp
+++ b/src/profiling/test/TimelineUtilityMethodsTests.cpp
@@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(SendWellKnownLabelsAndEventClassesTest)
auto readableBuffer = mockBufferManager.GetReadableBuffer();
BOOST_CHECK(readableBuffer != nullptr);
unsigned int size = readableBuffer->GetSize();
- BOOST_TEST(size == 300);
+ BOOST_TEST(size == 376);
const unsigned char* readableData = readableBuffer->GetReadableData();
BOOST_CHECK(readableData != nullptr);
@@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(SendWellKnownLabelsAndEventClassesTest)
unsigned int offset = 0;
// Verify Header
- VerifyTimelineHeaderBinary(readableData, offset, 292);
+ VerifyTimelineHeaderBinary(readableData, offset, 368);
// First "well-known" label: NAME
VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::NAME_GUID,
@@ -154,12 +154,24 @@ BOOST_AUTO_TEST_CASE(SendWellKnownLabelsAndEventClassesTest)
offset);
// First "well-known" event class: START OF LIFE
+ VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS_NAME_GUID,
+ LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS_NAME,
+ readableData,
+ offset);
+
VerifyTimelineEventClassBinaryPacketData(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+ LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS_NAME_GUID,
readableData,
offset);
// Second "well-known" event class: END OF LIFE
+ VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS_NAME_GUID,
+ LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS_NAME,
+ readableData,
+ offset);
+
VerifyTimelineEventClassBinaryPacketData(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+ LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS_NAME_GUID,
readableData,
offset);