15 #include <boost/test/test_tools.hpp> 16 #include <boost/test/unit_test_suite.hpp> 20 using namespace armnn;
21 using namespace timelinedecoder;
27 unsigned int offset = 0;
34 uint32_t PacketDataLength = header[1] & 0x00FFFFFF;
36 auto uniquePacketData = std::make_unique<unsigned char[]>(PacketDataLength);
37 std::memcpy(uniquePacketData.get(), packetBuffer + offset, PacketDataLength);
41 BOOST_CHECK(std::memcmp(packetBuffer + offset, packet.GetData(), packet.GetLength()) == 0);
43 CommandHandler(packet);
73 uint32_t uint8_t_size =
sizeof(uint8_t);
75 uint32_t uint64_t_size =
sizeof(uint64_t);
76 uint32_t threadId_size =
sizeof(std::thread::id);
81 std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
89 sendTimelinePacket->SendTimelineMessageDirectoryPackage();
90 sendTimelinePacket->Commit();
92 std::vector<profiling::SwTraceMessage> swTraceBufferMessages;
94 unsigned int offset = uint32_t_size * 2;
96 std::unique_ptr<profiling::IPacketBuffer> packetBuffer = bufferManager.
GetReadableBuffer();
98 uint8_t readStreamVersion =
ReadUint8(packetBuffer, offset);
100 offset += uint8_t_size;
101 uint8_t readPointerBytes =
ReadUint8(packetBuffer, offset);
103 offset += uint8_t_size;
104 uint8_t readThreadIdBytes =
ReadUint8(packetBuffer, offset);
106 offset += uint8_t_size;
110 for(uint32_t i = 0; i < declarationSize; ++i)
117 for(uint32_t index = 0; index < declarationSize; ++index)
127 for(uint32_t i = 0; i < bufferMessage.
m_ArgTypes.size(); ++i)
133 for(uint32_t i = 0; i < bufferMessage.
m_ArgNames.size(); ++i)
142 unsigned int threadIdSize =
sizeof(std::thread::id);
146 std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
164 const uint64_t entityGuid = 111111u;
165 const uint64_t eventClassGuid = 22222u;
166 const uint64_t timestamp = 33333u;
167 const uint64_t eventGuid = 44444u;
169 const std::thread::id threadId = std::this_thread::get_id();
172 unsigned char* uCharThreadId =
new unsigned char[threadIdSize]();;
173 uint64_t uint64ThreadId;
177 if (threadIdSize == 4)
181 else if (threadIdSize == 8)
185 delete[] uCharThreadId;
187 const uint64_t labelGuid = 66666u;
188 std::string labelName =
"test_label";
190 const uint64_t relationshipGuid = 77777u;
191 const uint64_t headGuid = 888888u;
192 const uint64_t tailGuid = 999999u;
194 for (
int i = 0; i < 10; ++i)
197 sendTimelinePacket->SendTimelineEntityBinaryPacket(entityGuid);
198 sendTimelinePacket->Commit();
200 timelineCaptureCommandHandler);
203 sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid);
204 sendTimelinePacket->Commit();
206 timelineCaptureCommandHandler);
209 sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid);
210 sendTimelinePacket->Commit();
212 timelineCaptureCommandHandler);
215 sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
216 sendTimelinePacket->Commit();
218 timelineCaptureCommandHandler);
222 sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
226 sendTimelinePacket->Commit();
228 timelineCaptureCommandHandler);
231 for (
unsigned long i = 0; i < 10; ++i)
253 unsigned int threadIdSize =
sizeof(std::thread::id);
257 std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
275 const uint64_t entityGuid = 111111u;
276 const uint64_t eventClassGuid = 22222u;
277 const uint64_t timestamp = 33333u;
278 const uint64_t eventGuid = 44444u;
280 const std::thread::id threadId = std::this_thread::get_id();
283 unsigned char* uCharThreadId =
new unsigned char[threadIdSize]();;
284 uint64_t uint64ThreadId;
288 if ( threadIdSize == 4 )
291 }
else if ( threadIdSize == 8 )
295 delete[] uCharThreadId;
297 const uint64_t labelGuid = 66666u;
298 std::string labelName =
"test_label";
299 std::string labelName2 =
"test_label2";
300 std::string labelName3 =
"test_label32";
302 const uint64_t relationshipGuid = 77777u;
303 const uint64_t headGuid = 888888u;
304 const uint64_t tailGuid = 999999u;
307 for (
int i = 0; i < 9; ++i )
310 sendTimelinePacket->SendTimelineEntityBinaryPacket(entityGuid);
312 sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid);
314 sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid);
316 sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
317 sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName2);
318 sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName3);
321 sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
327 sendTimelinePacket->Commit();
329 timelineCaptureCommandHandler);
331 for (
unsigned long i = 0; i < 9; ++i )
348 for (
unsigned long i = 0; i < 9; i += 3 )
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
uint32_t GetEncodedValue()
void SendTimelinePacketToCommandHandler(const unsigned char *packetBuffer, profiling::CommandHandlerFunctor &CommandHandler)
Head execution start depends on Tail execution completion.
TimelineStatus SetRelationshipCallback(const OnNewRelationshipCallback)
std::vector< Label > m_Labels
std::vector< Entity > m_Entities
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
uint8_t ReadUint8(const IPacketBufferPtr &packetBuffer, unsigned int offset)
Copyright (c) 2020 ARM Limited.
Head execution start depends on Tail execution completion.
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
SwTraceMessage ReadSwTraceMessage(const unsigned char *packetBuffer, unsigned int &offset)
std::vector< std::string > m_ArgNames
std::vector< char > m_ArgTypes
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)
std::vector< Relationship > m_Relationships
ProfilingRelationshipType
BOOST_AUTO_TEST_CASE(CheckConvolution2dLayer)
IPacketBufferPtr GetReadableBuffer() override
void PushEvent(TimelineDecoder::Model &model, const ITimelineDecoder::Event event)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
std::vector< EventClass > m_EventClasses
void PushLabel(TimelineDecoder::Model &model, const ITimelineDecoder::Label label)
BOOST_AUTO_TEST_SUITE_END()
TimelineStatus SetLabelCallback(const OnNewLabelCallback)
std::unique_ptr< ISendTimelinePacket > GetSendTimelinePacket() const
std::vector< Event > m_Events
TimelineStatus SetEntityCallback(const OnNewEntityCallback)
TimelineStatus SetEventCallback(const OnNewEventCallback)