ArmNN  NotReleased
SendTimelinePacket Class Reference

#include <SendTimelinePacket.hpp>

Inheritance diagram for SendTimelinePacket:
ISendTimelinePacket

Public Member Functions

 SendTimelinePacket (IBufferManager &bufferManager)
 
void Commit () override
 Commits the current buffer and reset the member variables. More...
 
void SendTimelineEntityBinaryPacket (uint64_t profilingGuid) override
 Create and write a TimelineEntityBinaryPacket from the parameters to the buffer. More...
 
void SendTimelineEventBinaryPacket (uint64_t timestamp, std::thread::id threadId, uint64_t profilingGuid) override
 Create and write a TimelineEventBinaryPacket from the parameters to the buffer. More...
 
void SendTimelineEventClassBinaryPacket (uint64_t profilingGuid) override
 Create and write a TimelineEventClassBinaryPacket from the parameters to the buffer. More...
 
void SendTimelineLabelBinaryPacket (uint64_t profilingGuid, const std::string &label) override
 Create and write a TimelineLabelBinaryPacket from the parameters to the buffer. More...
 
void SendTimelineMessageDirectoryPackage () override
 Create and write a TimelineMessageDirectoryPackage in the buffer. More...
 
virtual void SendTimelineRelationshipBinaryPacket (ProfilingRelationshipType relationshipType, uint64_t relationshipGuid, uint64_t headGuid, uint64_t tailGuid) override
 Create and write a TimelineRelationshipBinaryPacket from the parameters to the buffer. More...
 
- Public Member Functions inherited from ISendTimelinePacket
virtual ~ISendTimelinePacket ()
 

Detailed Description

Definition at line 22 of file SendTimelinePacket.hpp.

Constructor & Destructor Documentation

◆ SendTimelinePacket()

Member Function Documentation

◆ Commit()

void Commit ( )
overridevirtual

Commits the current buffer and reset the member variables.

Implements ISendTimelinePacket.

Definition at line 14 of file SendTimelinePacket.cpp.

References armnn::profiling::BufferExhaustion, CHECK_LOCATION, IBufferManager::Commit(), MAX_METADATA_PACKET_LENGTH, and IBufferManager::Reserve().

Referenced by SendTimelinePacket::SendTimelineMessageDirectoryPackage(), and SendTimelinePacket::SendTimelinePacket().

15 {
16  if (m_WriteBuffer == nullptr)
17  {
18  // Can't commit from a null buffer
19  return;
20  }
21 
22  // Commit the message
23  m_BufferManager.Commit(m_WriteBuffer, m_Offset);
24  m_WriteBuffer.reset(nullptr);
25  m_Offset = 0;
26  m_BufferSize = 0;
27 }
virtual void Commit(IPacketBufferPtr &packetBuffer, unsigned int size, bool notifyConsumer=true)=0

◆ SendTimelineEntityBinaryPacket()

void SendTimelineEntityBinaryPacket ( uint64_t  profilingGuid)
overridevirtual

Create and write a TimelineEntityBinaryPacket from the parameters to the buffer.

Implements ISendTimelinePacket.

Definition at line 51 of file SendTimelinePacket.cpp.

References armnn::profiling::WriteTimelineEntityBinaryPacket().

Referenced by SendTimelinePacket::SendTimelinePacket().

52 {
53  ForwardWriteBinaryFunction(WriteTimelineEntityBinaryPacket,
54  profilingGuid);
55 }
TimelinePacketStatus WriteTimelineEntityBinaryPacket(uint64_t profilingGuid, unsigned char *buffer, unsigned int bufferSize, unsigned int &numberOfBytesWritten)

◆ SendTimelineEventBinaryPacket()

void SendTimelineEventBinaryPacket ( uint64_t  timestamp,
std::thread::id  threadId,
uint64_t  profilingGuid 
)
overridevirtual

Create and write a TimelineEventBinaryPacket from the parameters to the buffer.

Implements ISendTimelinePacket.

Definition at line 57 of file SendTimelinePacket.cpp.

References armnn::profiling::WriteTimelineEventBinaryPacket().

Referenced by SendTimelinePacket::SendTimelinePacket().

60 {
61  ForwardWriteBinaryFunction(WriteTimelineEventBinaryPacket,
62  timestamp,
63  threadId,
64  profilingGuid);
65 }
TimelinePacketStatus WriteTimelineEventBinaryPacket(uint64_t timestamp, std::thread::id threadId, uint64_t profilingGuid, unsigned char *buffer, unsigned int bufferSize, unsigned int &numberOfBytesWritten)

◆ SendTimelineEventClassBinaryPacket()

void SendTimelineEventClassBinaryPacket ( uint64_t  profilingGuid)
overridevirtual

Create and write a TimelineEventClassBinaryPacket from the parameters to the buffer.

Implements ISendTimelinePacket.

Definition at line 67 of file SendTimelinePacket.cpp.

References armnn::profiling::WriteTimelineEventClassBinaryPacket().

Referenced by SendTimelinePacket::SendTimelinePacket().

68 {
69  ForwardWriteBinaryFunction(WriteTimelineEventClassBinaryPacket,
70  profilingGuid);
71 }
TimelinePacketStatus WriteTimelineEventClassBinaryPacket(uint64_t profilingGuid, unsigned char *buffer, unsigned int bufferSize, unsigned int &numberOfBytesWritten)

◆ SendTimelineLabelBinaryPacket()

void SendTimelineLabelBinaryPacket ( uint64_t  profilingGuid,
const std::string &  label 
)
overridevirtual

Create and write a TimelineLabelBinaryPacket from the parameters to the buffer.

Implements ISendTimelinePacket.

Definition at line 73 of file SendTimelinePacket.cpp.

References armnn::profiling::WriteTimelineLabelBinaryPacket().

Referenced by SendTimelinePacket::SendTimelinePacket().

74 {
75  ForwardWriteBinaryFunction(WriteTimelineLabelBinaryPacket,
76  profilingGuid,
77  label);
78 }
TimelinePacketStatus WriteTimelineLabelBinaryPacket(uint64_t profilingGuid, const std::string &label, unsigned char *buffer, unsigned int bufferSize, unsigned int &numberOfBytesWritten)

◆ SendTimelineMessageDirectoryPackage()

void SendTimelineMessageDirectoryPackage ( )
overridevirtual

Create and write a TimelineMessageDirectoryPackage in the buffer.

Implements ISendTimelinePacket.

Definition at line 92 of file SendTimelinePacket.cpp.

References CHECK_LOCATION, SendTimelinePacket::Commit(), armnn::profiling::Ok, and armnn::profiling::WriteTimelineMessageDirectoryPackage().

Referenced by SendTimelinePacket::SendTimelinePacket().

93 {
94  try
95  {
96  // Reserve buffer if it hasn't already been reserved
97  ReserveBuffer();
98 
99  // Write to buffer
100  unsigned int numberOfBytesWritten = 0;
101  TimelinePacketStatus result = WriteTimelineMessageDirectoryPackage(&m_WriteBuffer->GetWritableData()[m_Offset],
102  m_BufferSize,
103  numberOfBytesWritten);
105  {
106  throw RuntimeException("Error processing TimelineMessageDirectoryPackage", CHECK_LOCATION());
107  }
108 
109  // Commit the message
110  m_Offset += numberOfBytesWritten;
111  m_BufferSize -= numberOfBytesWritten;
112  Commit();
113  }
114  catch (...)
115  {
116  throw RuntimeException("Error processing TimelineMessageDirectoryPackage", CHECK_LOCATION());
117  }
118 }
#define CHECK_LOCATION()
Definition: Exceptions.hpp:169
TimelinePacketStatus WriteTimelineMessageDirectoryPackage(unsigned char *buffer, unsigned int bufferSize, unsigned int &numberOfBytesWritten)
void Commit() override
Commits the current buffer and reset the member variables.

◆ SendTimelineRelationshipBinaryPacket()

void SendTimelineRelationshipBinaryPacket ( ProfilingRelationshipType  relationshipType,
uint64_t  relationshipGuid,
uint64_t  headGuid,
uint64_t  tailGuid 
)
overridevirtual

Create and write a TimelineRelationshipBinaryPacket from the parameters to the buffer.

Implements ISendTimelinePacket.

Definition at line 80 of file SendTimelinePacket.cpp.

References armnn::profiling::WriteTimelineRelationshipBinaryPacket().

Referenced by SendTimelinePacket::SendTimelinePacket().

84 {
85  ForwardWriteBinaryFunction(WriteTimelineRelationshipBinaryPacket,
86  relationshipType,
87  relationshipGuid,
88  headGuid,
89  tailGuid);
90 }
TimelinePacketStatus WriteTimelineRelationshipBinaryPacket(ProfilingRelationshipType relationshipType, uint64_t relationshipGuid, uint64_t headGuid, uint64_t tailGuid, unsigned char *buffer, unsigned int bufferSize, unsigned int &numberOfBytesWritten)

The documentation for this class was generated from the following files: