ArmNN
 20.05
TimelineTests.cpp File Reference
#include <TimelineCaptureCommandHandler.hpp>
#include <TimelineDirectoryCaptureCommandHandler.hpp>
#include <TimelineDecoder.hpp>
#include <CommandHandlerFunctor.hpp>
#include <ProfilingService.hpp>
#include <PacketBuffer.hpp>
#include <TimelinePacketWriterFactory.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test_suite.hpp>

Go to the source code of this file.

Functions

void SendTimelinePacketToCommandHandler (const unsigned char *packetBuffer, profiling::CommandHandlerFunctor &CommandHandler)
 
void PushEntity (TimelineDecoder::Model &model, const ITimelineDecoder::Entity entity)
 
void PushEventClass (TimelineDecoder::Model &model, const ITimelineDecoder::EventClass eventClass)
 
void PushEvent (TimelineDecoder::Model &model, const ITimelineDecoder::Event event)
 
void PushLabel (TimelineDecoder::Model &model, const ITimelineDecoder::Label label)
 
void PushRelationship (TimelineDecoder::Model &model, const ITimelineDecoder::Relationship relationship)
 
 BOOST_AUTO_TEST_CASE (TimelineDirectoryTest)
 
 BOOST_AUTO_TEST_CASE (TimelineCaptureTest)
 
 BOOST_AUTO_TEST_CASE (TimelineCaptureTestMultipleStringsInBuffer)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/3]

BOOST_AUTO_TEST_CASE ( TimelineDirectoryTest  )

Definition at line 71 of file TimelineTests.cpp.

References BOOST_CHECK(), Version::GetEncodedValue(), BufferManager::GetReadableBuffer(), TimelinePacketWriterFactory::GetSendTimelinePacket(), SwTraceMessage::m_ArgNames, SwTraceMessage::m_ArgTypes, SwTraceMessage::m_Id, SwTraceMessage::m_Name, SwTraceMessage::m_UiName, armnn::profiling::ReadSwTraceMessage(), armnn::profiling::ReadUint32(), armnn::profiling::ReadUint8(), PacketVersionResolver::ResolvePacketVersion(), SendTimelinePacketToCommandHandler(), armnn::profiling::ThreadIdSize, and armnn::profiling::uint32_t_size.

72 {
73  uint32_t uint8_t_size = sizeof(uint8_t);
74  uint32_t uint32_t_size = sizeof(uint32_t);
75  uint32_t uint64_t_size = sizeof(uint64_t);
76 
77  profiling::BufferManager bufferManager(5);
78  profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
79 
80  std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
81  timelinePacketWriterFactory.GetSendTimelinePacket();
82 
83  profiling::PacketVersionResolver packetVersionResolver;
84 
85  TimelineDecoder timelineDecoder;
86  TimelineCaptureCommandHandler timelineCaptureCommandHandler(
87  1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder);
88 
89  TimelineDirectoryCaptureCommandHandler timelineDirectoryCaptureCommandHandler(
90  1, 0, packetVersionResolver.ResolvePacketVersion(1, 0).GetEncodedValue(),
91  timelineCaptureCommandHandler, true);
92 
93  sendTimelinePacket->SendTimelineMessageDirectoryPackage();
94  sendTimelinePacket->Commit();
95 
96  std::vector<profiling::SwTraceMessage> swTraceBufferMessages;
97 
98  unsigned int offset = uint32_t_size * 2;
99 
100  std::unique_ptr<profiling::IPacketBuffer> packetBuffer = bufferManager.GetReadableBuffer();
101 
102  uint8_t readStreamVersion = ReadUint8(packetBuffer, offset);
103  BOOST_CHECK(readStreamVersion == 4);
104  offset += uint8_t_size;
105  uint8_t readPointerBytes = ReadUint8(packetBuffer, offset);
106  BOOST_CHECK(readPointerBytes == uint64_t_size);
107  offset += uint8_t_size;
108  uint8_t readThreadIdBytes = ReadUint8(packetBuffer, offset);
109  BOOST_CHECK(readThreadIdBytes == armnn::profiling::ThreadIdSize);
110  offset += uint8_t_size;
111 
112  uint32_t declarationSize = profiling::ReadUint32(packetBuffer, offset);
113  offset += uint32_t_size;
114  for(uint32_t i = 0; i < declarationSize; ++i)
115  {
116  swTraceBufferMessages.push_back(profiling::ReadSwTraceMessage(packetBuffer->GetReadableData(), offset));
117  }
118 
119  SendTimelinePacketToCommandHandler(packetBuffer->GetReadableData(), timelineDirectoryCaptureCommandHandler);
120 
121  for(uint32_t index = 0; index < declarationSize; ++index)
122  {
123  profiling::SwTraceMessage& bufferMessage = swTraceBufferMessages[index];
124  profiling::SwTraceMessage& handlerMessage = timelineDirectoryCaptureCommandHandler.m_SwTraceMessages[index];
125 
126  BOOST_CHECK(bufferMessage.m_Name == handlerMessage.m_Name);
127  BOOST_CHECK(bufferMessage.m_UiName == handlerMessage.m_UiName);
128  BOOST_CHECK(bufferMessage.m_Id == handlerMessage.m_Id);
129 
130  BOOST_CHECK(bufferMessage.m_ArgTypes.size() == handlerMessage.m_ArgTypes.size());
131  for(uint32_t i = 0; i < bufferMessage.m_ArgTypes.size(); ++i)
132  {
133  BOOST_CHECK(bufferMessage.m_ArgTypes[i] == handlerMessage.m_ArgTypes[i]);
134  }
135 
136  BOOST_CHECK(bufferMessage.m_ArgNames.size() == handlerMessage.m_ArgNames.size());
137  for(uint32_t i = 0; i < bufferMessage.m_ArgNames.size(); ++i)
138  {
139  BOOST_CHECK(bufferMessage.m_ArgNames[i] == handlerMessage.m_ArgNames[i]);
140  }
141  }
142 }
void SendTimelinePacketToCommandHandler(const unsigned char *packetBuffer, profiling::CommandHandlerFunctor &CommandHandler)
Version ResolvePacketVersion(uint32_t familyId, uint32_t packetId) const
uint8_t ReadUint8(const IPacketBufferPtr &packetBuffer, unsigned int offset)
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
SwTraceMessage ReadSwTraceMessage(const unsigned char *packetBuffer, unsigned int &offset)
std::vector< std::string > m_ArgNames
constexpr unsigned int ThreadIdSize
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)

◆ BOOST_AUTO_TEST_CASE() [2/3]

BOOST_AUTO_TEST_CASE ( TimelineCaptureTest  )

Definition at line 144 of file TimelineTests.cpp.

References BOOST_CHECK(), armnn::profiling::DataLink, ITimelineDecoder::DataLink, Version::GetEncodedValue(), TimelineDecoder::GetModel(), BufferManager::GetReadableBuffer(), TimelinePacketWriterFactory::GetSendTimelinePacket(), TimelineDecoder::Model::m_Entities, TimelineDecoder::Model::m_EventClasses, TimelineDecoder::Model::m_Events, TimelineDecoder::Model::m_Labels, TimelineDecoder::Model::m_Relationships, PushEntity(), PushEvent(), PushEventClass(), PushLabel(), PushRelationship(), armnn::profiling::ReadUint32(), armnn::profiling::ReadUint64(), PacketVersionResolver::ResolvePacketVersion(), SendTimelinePacketToCommandHandler(), TimelineDecoder::SetEntityCallback(), TimelineDecoder::SetEventCallback(), TimelineDecoder::SetEventClassCallback(), TimelineDecoder::SetLabelCallback(), TimelineDecoder::SetRelationshipCallback(), armnn::profiling::ThreadIdSize, and armnn::profiling::WriteBytes().

145 {
146  profiling::BufferManager bufferManager(50);
147  profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
148 
149  std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
150  timelinePacketWriterFactory.GetSendTimelinePacket();
151 
152  profiling::PacketVersionResolver packetVersionResolver;
153 
154  TimelineDecoder timelineDecoder;
155  const TimelineDecoder::Model& model = timelineDecoder.GetModel();
156 
157 
158  TimelineCaptureCommandHandler timelineCaptureCommandHandler(
159  1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder,
161 
163  BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success);
164  BOOST_CHECK(timelineDecoder.SetEventClassCallback(PushEventClass) == Status::TimelineStatus_Success);
165  BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent) == Status::TimelineStatus_Success);
166  BOOST_CHECK(timelineDecoder.SetLabelCallback(PushLabel) == Status::TimelineStatus_Success);
167  BOOST_CHECK(timelineDecoder.SetRelationshipCallback(PushRelationship) == Status::TimelineStatus_Success);
168 
169  const uint64_t entityGuid = 111111u;
170  const uint64_t eventClassGuid = 22222u;
171  const uint64_t timestamp = 33333u;
172  const uint64_t eventGuid = 44444u;
173 
174  const std::thread::id threadId = std::this_thread::get_id();
175 
176  // need to do a bit of work here to extract the value from threadId
177  unsigned char* uCharThreadId = new unsigned char[armnn::profiling::ThreadIdSize]();;
178  uint64_t uint64ThreadId;
179 
180  profiling::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize);
181 
183  {
184  uint64ThreadId = profiling::ReadUint32(uCharThreadId, 0);
185  }
186  else if (armnn::profiling::ThreadIdSize == 8)
187  {
188  uint64ThreadId = profiling::ReadUint64(uCharThreadId, 0);
189  }
190  delete[] uCharThreadId;
191 
192  const uint64_t labelGuid = 66666u;
193  std::string labelName = "test_label";
194 
195  const uint64_t relationshipGuid = 77777u;
196  const uint64_t headGuid = 888888u;
197  const uint64_t tailGuid = 999999u;
198 
199  for (int i = 0; i < 10; ++i)
200  {
201  // Send entity
202  sendTimelinePacket->SendTimelineEntityBinaryPacket(entityGuid);
203  sendTimelinePacket->Commit();
204  SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
205  timelineCaptureCommandHandler);
206 
207  // Send event class
208  sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid);
209  sendTimelinePacket->Commit();
210  SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
211  timelineCaptureCommandHandler);
212 
213  // Send event
214  sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid);
215  sendTimelinePacket->Commit();
216  SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
217  timelineCaptureCommandHandler);
218 
219  // Send label
220  sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
221  sendTimelinePacket->Commit();
222  SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
223  timelineCaptureCommandHandler);
224 
225  // Send relationship
226  profiling::ProfilingRelationshipType relationshipType = profiling::ProfilingRelationshipType::DataLink;
227  sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
228  relationshipGuid,
229  headGuid,
230  tailGuid);
231  sendTimelinePacket->Commit();
232  SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
233  timelineCaptureCommandHandler);
234  }
235 
236  for (unsigned long i = 0; i < 10; ++i)
237  {
238  BOOST_CHECK(model.m_Entities[i].m_Guid == entityGuid);
239 
240  BOOST_CHECK(model.m_EventClasses[i].m_Guid == eventClassGuid);
241 
242  BOOST_CHECK(model.m_Events[i].m_TimeStamp == timestamp);
243  BOOST_CHECK(model.m_Events[i].m_ThreadId == uint64ThreadId);
244  BOOST_CHECK(model.m_Events[i].m_Guid == eventGuid);
245 
246  BOOST_CHECK(model.m_Labels[i].m_Guid == labelGuid);
247  BOOST_CHECK(model.m_Labels[i].m_Name == labelName);
248 
250  BOOST_CHECK(model.m_Relationships[i].m_Guid == relationshipGuid);
251  BOOST_CHECK(model.m_Relationships[i].m_HeadGuid == headGuid);
252  BOOST_CHECK(model.m_Relationships[i].m_TailGuid == tailGuid);
253  }
254 }
void SendTimelinePacketToCommandHandler(const unsigned char *packetBuffer, profiling::CommandHandlerFunctor &CommandHandler)
Head execution start depends on Tail execution completion.
TimelineStatus SetRelationshipCallback(const OnNewRelationshipCallback)
void PushEventClass(TimelineDecoder::Model &model, const ITimelineDecoder::EventClass eventClass)
uint64_t ReadUint64(const IPacketBufferPtr &packetBuffer, unsigned int offset)
Version ResolvePacketVersion(uint32_t familyId, uint32_t packetId) const
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
void WriteBytes(const IPacketBufferPtr &packetBuffer, unsigned int offset, const void *value, unsigned int valueSize)
void PushRelationship(TimelineDecoder::Model &model, const ITimelineDecoder::Relationship relationship)
void PushEntity(TimelineDecoder::Model &model, const ITimelineDecoder::Entity entity)
TimelineStatus SetEventClassCallback(const OnNewEventClassCallback)
Status
enumeration
Definition: Types.hpp:26
constexpr unsigned int ThreadIdSize
void PushEvent(TimelineDecoder::Model &model, const ITimelineDecoder::Event event)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
void PushLabel(TimelineDecoder::Model &model, const ITimelineDecoder::Label label)
TimelineStatus SetLabelCallback(const OnNewLabelCallback)
TimelineStatus SetEntityCallback(const OnNewEntityCallback)
TimelineStatus SetEventCallback(const OnNewEventCallback)

◆ BOOST_AUTO_TEST_CASE() [3/3]

BOOST_AUTO_TEST_CASE ( TimelineCaptureTestMultipleStringsInBuffer  )

Definition at line 256 of file TimelineTests.cpp.

References BOOST_AUTO_TEST_SUITE_END(), BOOST_CHECK(), armnn::profiling::DataLink, ITimelineDecoder::DataLink, Version::GetEncodedValue(), TimelineDecoder::GetModel(), BufferManager::GetReadableBuffer(), TimelinePacketWriterFactory::GetSendTimelinePacket(), TimelineDecoder::Model::m_Entities, TimelineDecoder::Model::m_EventClasses, TimelineDecoder::Model::m_Events, TimelineDecoder::Model::m_Labels, TimelineDecoder::Model::m_Relationships, PushEntity(), PushEvent(), PushEventClass(), PushLabel(), PushRelationship(), armnn::profiling::ReadUint32(), armnn::profiling::ReadUint64(), PacketVersionResolver::ResolvePacketVersion(), SendTimelinePacketToCommandHandler(), TimelineDecoder::SetEntityCallback(), TimelineDecoder::SetEventCallback(), TimelineDecoder::SetEventClassCallback(), TimelineDecoder::SetLabelCallback(), TimelineDecoder::SetRelationshipCallback(), armnn::profiling::ThreadIdSize, and armnn::profiling::WriteBytes().

257 {
258  profiling::BufferManager bufferManager(50);
259  profiling::TimelinePacketWriterFactory timelinePacketWriterFactory(bufferManager);
260 
261  std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
262  timelinePacketWriterFactory.GetSendTimelinePacket();
263 
264  profiling::PacketVersionResolver packetVersionResolver;
265 
266  TimelineDecoder timelineDecoder;
267  const TimelineDecoder::Model& model = timelineDecoder.GetModel();
268 
269  TimelineCaptureCommandHandler timelineCaptureCommandHandler(
270  1, 1, packetVersionResolver.ResolvePacketVersion(1, 1).GetEncodedValue(), timelineDecoder,
272 
274  BOOST_CHECK(timelineDecoder.SetEntityCallback(PushEntity) == Status::TimelineStatus_Success);
275  BOOST_CHECK(timelineDecoder.SetEventClassCallback(PushEventClass) == Status::TimelineStatus_Success);
276  BOOST_CHECK(timelineDecoder.SetEventCallback(PushEvent) == Status::TimelineStatus_Success);
277  BOOST_CHECK(timelineDecoder.SetLabelCallback(PushLabel) == Status::TimelineStatus_Success);
278  BOOST_CHECK(timelineDecoder.SetRelationshipCallback(PushRelationship) == Status::TimelineStatus_Success);
279 
280  const uint64_t entityGuid = 111111u;
281  const uint64_t eventClassGuid = 22222u;
282  const uint64_t timestamp = 33333u;
283  const uint64_t eventGuid = 44444u;
284 
285  const std::thread::id threadId = std::this_thread::get_id();
286 
287  // need to do a bit of work here to extract the value from threadId
288  unsigned char* uCharThreadId = new unsigned char[armnn::profiling::ThreadIdSize]();
289  uint64_t uint64ThreadId;
290 
291  profiling::WriteBytes(uCharThreadId, 0, &threadId, armnn::profiling::ThreadIdSize);
292 
294  {
295  uint64ThreadId = profiling::ReadUint32(uCharThreadId, 0);
296  }
297  else if ( armnn::profiling::ThreadIdSize == 8 )
298  {
299  uint64ThreadId = profiling::ReadUint64(uCharThreadId, 0);
300  }
301  delete[] uCharThreadId;
302 
303  const uint64_t labelGuid = 66666u;
304  std::string labelName = "test_label";
305  std::string labelName2 = "test_label2";
306  std::string labelName3 = "test_label32";
307 
308  const uint64_t relationshipGuid = 77777u;
309  const uint64_t headGuid = 888888u;
310  const uint64_t tailGuid = 999999u;
311 
312  // Check with multiple messages in the same buffer
313  for ( int i = 0; i < 9; ++i )
314  {
315  // Send entity
316  sendTimelinePacket->SendTimelineEntityBinaryPacket(entityGuid);
317  // Send event class
318  sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid);
319  // Send event
320  sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid);
321  // Send label
322  sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
323  sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName2);
324  sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName3);
325  // Send relationship
326  profiling::ProfilingRelationshipType relationshipType = profiling::ProfilingRelationshipType::DataLink;
327  sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
328  relationshipGuid,
329  headGuid,
330  tailGuid);
331  }
332 
333  sendTimelinePacket->Commit();
334  SendTimelinePacketToCommandHandler(bufferManager.GetReadableBuffer()->GetReadableData(),
335  timelineCaptureCommandHandler);
336 
337  for ( unsigned long i = 0; i < 9; ++i )
338  {
339  BOOST_CHECK(model.m_Entities[i].m_Guid == entityGuid);
340 
341  BOOST_CHECK(model.m_EventClasses[i].m_Guid == eventClassGuid);
342 
343  BOOST_CHECK(model.m_Labels[i].m_Guid == labelGuid);
344 
345  BOOST_CHECK(model.m_Events[i].m_TimeStamp == timestamp);
346  BOOST_CHECK(model.m_Events[i].m_ThreadId == uint64ThreadId);
347  BOOST_CHECK(model.m_Events[i].m_Guid == eventGuid);
348 
350  BOOST_CHECK(model.m_Relationships[i].m_Guid == relationshipGuid);
351  BOOST_CHECK(model.m_Relationships[i].m_HeadGuid == headGuid);
352  BOOST_CHECK(model.m_Relationships[i].m_TailGuid == tailGuid);
353  }
354  for ( unsigned long i = 0; i < 9; i += 3 )
355  {
356  BOOST_CHECK(model.m_Labels[i].m_Name == labelName);
357  BOOST_CHECK(model.m_Labels[i+1].m_Name == labelName2);
358  BOOST_CHECK(model.m_Labels[i+2].m_Name == labelName3);
359  }
360 }
void SendTimelinePacketToCommandHandler(const unsigned char *packetBuffer, profiling::CommandHandlerFunctor &CommandHandler)
Head execution start depends on Tail execution completion.
TimelineStatus SetRelationshipCallback(const OnNewRelationshipCallback)
void PushEventClass(TimelineDecoder::Model &model, const ITimelineDecoder::EventClass eventClass)
uint64_t ReadUint64(const IPacketBufferPtr &packetBuffer, unsigned int offset)
Version ResolvePacketVersion(uint32_t familyId, uint32_t packetId) const
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
void WriteBytes(const IPacketBufferPtr &packetBuffer, unsigned int offset, const void *value, unsigned int valueSize)
void PushRelationship(TimelineDecoder::Model &model, const ITimelineDecoder::Relationship relationship)
void PushEntity(TimelineDecoder::Model &model, const ITimelineDecoder::Entity entity)
TimelineStatus SetEventClassCallback(const OnNewEventClassCallback)
Status
enumeration
Definition: Types.hpp:26
constexpr unsigned int ThreadIdSize
void PushEvent(TimelineDecoder::Model &model, const ITimelineDecoder::Event event)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
void PushLabel(TimelineDecoder::Model &model, const ITimelineDecoder::Label label)
TimelineStatus SetLabelCallback(const OnNewLabelCallback)
TimelineStatus SetEntityCallback(const OnNewEntityCallback)
TimelineStatus SetEventCallback(const OnNewEventCallback)

◆ PushEntity()

void PushEntity ( TimelineDecoder::Model model,
const ITimelineDecoder::Entity  entity 
)

Definition at line 46 of file TimelineTests.cpp.

References TimelineDecoder::Model::m_Entities.

Referenced by BOOST_AUTO_TEST_CASE().

47 {
48  model.m_Entities.emplace_back(entity);
49 }

◆ PushEvent()

void PushEvent ( TimelineDecoder::Model model,
const ITimelineDecoder::Event  event 
)

Definition at line 56 of file TimelineTests.cpp.

References TimelineDecoder::Model::m_Events.

Referenced by BOOST_AUTO_TEST_CASE().

57 {
58  model.m_Events.emplace_back(event);
59 }

◆ PushEventClass()

void PushEventClass ( TimelineDecoder::Model model,
const ITimelineDecoder::EventClass  eventClass 
)

Definition at line 51 of file TimelineTests.cpp.

References TimelineDecoder::Model::m_EventClasses.

Referenced by BOOST_AUTO_TEST_CASE().

52 {
53  model.m_EventClasses.emplace_back(eventClass);
54 }

◆ PushLabel()

void PushLabel ( TimelineDecoder::Model model,
const ITimelineDecoder::Label  label 
)

Definition at line 61 of file TimelineTests.cpp.

References TimelineDecoder::Model::m_Labels.

Referenced by BOOST_AUTO_TEST_CASE().

62 {
63  model.m_Labels.emplace_back(label);
64 }

◆ PushRelationship()

void PushRelationship ( TimelineDecoder::Model model,
const ITimelineDecoder::Relationship  relationship 
)

Definition at line 66 of file TimelineTests.cpp.

References TimelineDecoder::Model::m_Relationships.

Referenced by BOOST_AUTO_TEST_CASE().

67 {
68  model.m_Relationships.emplace_back(relationship);
69 }

◆ SendTimelinePacketToCommandHandler()

void SendTimelinePacketToCommandHandler ( const unsigned char *  packetBuffer,
profiling::CommandHandlerFunctor CommandHandler 
)

Definition at line 23 of file TimelineTests.cpp.

References BOOST_CHECK(), armnn::profiling::ReadUint32(), and armnn::profiling::uint32_t_size.

Referenced by BOOST_AUTO_TEST_CASE().

25 {
26  uint32_t uint32_t_size = sizeof(uint32_t);
27  unsigned int offset = 0;
28 
29  uint32_t header[2];
30  header[0] = profiling::ReadUint32(packetBuffer, offset);
31  offset += uint32_t_size;
32  header[1] = profiling::ReadUint32(packetBuffer, offset);
33  offset += uint32_t_size;
34  uint32_t PacketDataLength = header[1] & 0x00FFFFFF;
35 
36  auto uniquePacketData = std::make_unique<unsigned char[]>(PacketDataLength);
37  std::memcpy(uniquePacketData.get(), packetBuffer + offset, PacketDataLength);
38 
39  armnn::profiling::Packet packet(header[0], PacketDataLength, uniquePacketData);
40 
41  BOOST_CHECK(std::memcmp(packetBuffer + offset, packet.GetData(), packet.GetLength()) == 0);
42 
43  CommandHandler(packet);
44 }
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)