SendTimelineEventBinaryPacket(uint64_t timestamp, std::thread::id threadId, uint64_t profilingGuid) = 0;
/// Create and write a TimelineEventClassBinaryPacket from the parameters to the buffer.
- virtual void SendTimelineEventClassBinaryPacket(uint64_t profilingGuid) = 0;
+ virtual void SendTimelineEventClassBinaryPacket(uint64_t profilingGuid, uint64_t nameGuid) = 0;
/// Create and write a TimelineLabelBinaryPacket from the parameters to the buffer.
virtual void SendTimelineLabelBinaryPacket(uint64_t profilingGuid, const std::string& label) = 0;
struct EventClass
{
uint64_t m_Guid;
+ uint64_t m_NameGuid;
};
struct Event
m_GuidGenerator.GenerateStaticId(LabelsAndEventClasses::WORKLOAD_EXECUTION));
// Event Class GUIDs
+// Start of Life (SOL)
+std::string LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS_NAME("start_of_life");
+ProfilingStaticGuid LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS_NAME_GUID(
+ m_GuidGenerator.GenerateStaticId(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS_NAME));
ProfilingStaticGuid LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS(
m_GuidGenerator.GenerateStaticId("ARMNN_PROFILING_SOL"));
+// End of Life (EOL)
+std::string LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS_NAME("end_of_life");
+ProfilingStaticGuid LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS_NAME_GUID(
+ m_GuidGenerator.GenerateStaticId(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS_NAME));
ProfilingStaticGuid LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS(
m_GuidGenerator.GenerateStaticId("ARMNN_PROFILING_EOL"));
ARMNN_DLLEXPORT static ProfilingStaticGuid WORKLOAD_EXECUTION_GUID;
// Event Class GUIDs
+ // Start of Life (SOL)
ARMNN_DLLEXPORT static ProfilingStaticGuid ARMNN_PROFILING_SOL_EVENT_CLASS;
+ ARMNN_DLLEXPORT static std::string ARMNN_PROFILING_SOL_EVENT_CLASS_NAME;
+ ARMNN_DLLEXPORT static ProfilingStaticGuid ARMNN_PROFILING_SOL_EVENT_CLASS_NAME_GUID;
+ // End of Life (EOL)
ARMNN_DLLEXPORT static ProfilingStaticGuid ARMNN_PROFILING_EOL_EVENT_CLASS;
+ ARMNN_DLLEXPORT static std::string ARMNN_PROFILING_EOL_EVENT_CLASS_NAME;
+ ARMNN_DLLEXPORT static ProfilingStaticGuid ARMNN_PROFILING_EOL_EVENT_CLASS_NAME_GUID;
private:
static ProfilingGuidGenerator m_GuidGenerator;
}
TimelinePacketStatus WriteTimelineEventClassBinary(uint64_t profilingGuid,
+ uint64_t nameGuid,
unsigned char* buffer,
unsigned int remainingBufferSize,
unsigned int& numberOfBytesWritten)
uint32_t declId = 2;
// Calculate the length of the data (in bytes)
- unsigned int dataSize = uint32_t_size + uint64_t_size; // decl_id + Profiling GUID
+ unsigned int dataSize = uint32_t_size + (uint64_t_size * 2); // decl_id + Profiling GUID + Name GUID
// Check whether the timeline binary fits in the given buffer
if (dataSize > remainingBufferSize)
WriteUint32(buffer, offset, declId); // decl_id
offset += uint32_t_size;
WriteUint64(buffer, offset, profilingGuid); // Profiling GUID
+ offset += uint64_t_size;
+ WriteUint64(buffer, offset, nameGuid); // Name GUID
// Update the number of bytes written
numberOfBytesWritten = dataSize;
unsigned int& numberOfBytesWritten);
TimelinePacketStatus WriteTimelineEventClassBinary(uint64_t profilingGuid,
+ uint64_t nameGuid,
unsigned char* buffer,
unsigned int bufferSize,
unsigned int& numberOfBytesWritten);
profilingGuid);
}
-void SendTimelinePacket::SendTimelineEventClassBinaryPacket(uint64_t profilingGuid)
+void SendTimelinePacket::SendTimelineEventClassBinaryPacket(uint64_t profilingGuid, uint64_t nameGuid)
{
ForwardWriteBinaryFunction(WriteTimelineEventClassBinary,
- profilingGuid);
+ profilingGuid,
+ nameGuid);
}
void SendTimelinePacket::SendTimelineLabelBinaryPacket(uint64_t profilingGuid, const std::string& label)
void SendTimelineEventBinaryPacket(uint64_t timestamp, std::thread::id threadId, uint64_t profilingGuid) override;
/// Create and write a TimelineEventClassBinaryPacket from the parameters to the buffer.
- void SendTimelineEventClassBinaryPacket(uint64_t profilingGuid) override;
+ void SendTimelineEventClassBinaryPacket(uint64_t profilingGuid, uint64_t nameGuid) override;
/// Create and write a TimelineLabelBinaryPacket from the parameters to the buffer.
void SendTimelineLabelBinaryPacket(uint64_t profilingGuid, const std::string& label) override;
{
// Send the "name" label, this call throws in case of error
timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::NAME_GUID,
- LabelsAndEventClasses::NAME_LABEL);
+ LabelsAndEventClasses::NAME_LABEL);
// Send the "type" label, this call throws in case of error
timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::TYPE_GUID,
- LabelsAndEventClasses::TYPE_LABEL);
+ LabelsAndEventClasses::TYPE_LABEL);
// Send the "index" label, this call throws in case of error
timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::INDEX_GUID,
- LabelsAndEventClasses::INDEX_LABEL);
+ LabelsAndEventClasses::INDEX_LABEL);
// Send the "backendId" label, this call throws in case of error
timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::BACKENDID_GUID,
- LabelsAndEventClasses::BACKENDID_LABEL);
+ LabelsAndEventClasses::BACKENDID_LABEL);
// Send the "layer" label, this call throws in case of error
timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::LAYER_GUID,
- LabelsAndEventClasses::LAYER);
+ LabelsAndEventClasses::LAYER);
// Send the "workload" label, this call throws in case of error
timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::WORKLOAD_GUID,
- LabelsAndEventClasses::WORKLOAD);
+ LabelsAndEventClasses::WORKLOAD);
// Send the "network" label, this call throws in case of error
timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::NETWORK_GUID,
- LabelsAndEventClasses::NETWORK);
+ LabelsAndEventClasses::NETWORK);
// Send the "connection" label, this call throws in case of error
timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::CONNECTION_GUID,
- LabelsAndEventClasses::CONNECTION);
+ LabelsAndEventClasses::CONNECTION);
// Send the "inference" label, this call throws in case of error
timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::INFERENCE_GUID,
- LabelsAndEventClasses::INFERENCE);
+ LabelsAndEventClasses::INFERENCE);
// Send the "workload_execution" label, this call throws in case of error
timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::WORKLOAD_EXECUTION_GUID,
- LabelsAndEventClasses::WORKLOAD_EXECUTION);
+ LabelsAndEventClasses::WORKLOAD_EXECUTION);
// Send the "start of life" event class, this call throws in case of error
- timelinePacket.SendTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS);
+ timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS_NAME_GUID,
+ LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS_NAME);
+ timelinePacket.SendTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS,
+ LabelsAndEventClasses::ARMNN_PROFILING_SOL_EVENT_CLASS_NAME_GUID);
// Send the "end of life" event class, this call throws in case of error
- timelinePacket.SendTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS);
+ timelinePacket.SendTimelineLabelBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS_NAME_GUID,
+ LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS_NAME);
+ timelinePacket.SendTimelineEventClassBinaryPacket(LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS,
+ LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS_NAME_GUID);
timelinePacket.Commit();
}
}
void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid,
+ ProfilingGuid nameGuid,
const unsigned char* readableData,
unsigned int& offset)
{
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;
}
unsigned int& offset);
void VerifyTimelineEventClassBinaryPacketData(ProfilingGuid guid,
+ ProfilingGuid nameGuid,
const unsigned char* readableData,
unsigned int& offset);
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();
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;
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 TimelineEventClassBinaryPacket
const uint64_t eventClassBinaryPacketProfilingGuid = 789123u;
- sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassBinaryPacketProfilingGuid);
+ const uint64_t eventClassBinaryPacketNameGuid = 8845u;
+ sendTimelinePacket->SendTimelineEventClassBinaryPacket(
+ eventClassBinaryPacketProfilingGuid, eventClassBinaryPacketNameGuid);
// Commit the buffer
sendTimelinePacket->Commit();
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);
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
// 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);
}
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);
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);
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);
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
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)
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);
unsigned int offset = 0;
// Verify Header
- VerifyTimelineHeaderBinary(readableData, offset, 292);
+ VerifyTimelineHeaderBinary(readableData, offset, 368);
// First "well-known" label: NAME
VerifyTimelineLabelBinaryPacketData(LabelsAndEventClasses::NAME_GUID,
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);
ITimelineDecoder::EventClass eventClass;
eventClass.m_Guid = profiling::ReadUint64(data, offset);
offset += uint64_t_size;
+ eventClass.m_NameGuid = profiling::ReadUint64(data, offset);
+ offset += uint64_t_size;
m_TimelineDecoder.CreateEventClass(eventClass);
}
const uint64_t entityGuid = 111111u;
const uint64_t eventClassGuid = 22222u;
+ const uint64_t eventClassNameGuid = 22322u;
const uint64_t timestamp = 33333u;
const uint64_t eventGuid = 44444u;
timelineCaptureCommandHandler);
// Send event class
- sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid);
+ sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid, eventClassNameGuid);
sendTimelinePacket->Commit();
SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
timelineCaptureCommandHandler);
BOOST_CHECK(timelineDecoder.SetLabelCallback(PushLabel) == Status::TimelineStatus_Success);
BOOST_CHECK(timelineDecoder.SetRelationshipCallback(PushRelationship) == Status::TimelineStatus_Success);
- const uint64_t entityGuid = 111111u;
- const uint64_t eventClassGuid = 22222u;
- const uint64_t timestamp = 33333u;
- const uint64_t eventGuid = 44444u;
+ const uint64_t entityGuid = 111111u;
+ const uint64_t eventClassGuid = 22222u;
+ const uint64_t eventClassNameGuid = 22322u;
+ const uint64_t timestamp = 33333u;
+ const uint64_t eventGuid = 44444u;
const std::thread::id threadId = std::this_thread::get_id();
// Send entity
sendTimelinePacket->SendTimelineEntityBinaryPacket(entityGuid);
// Send event class
- sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid);
+ sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid, eventClassNameGuid);
// Send event
sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid);
// Send label