6 #include "../TimelineCaptureCommandHandler.hpp" 7 #include "../TimelineDirectoryCaptureCommandHandler.hpp" 8 #include "../ITimelineDecoder.h" 9 #include "../TimelineModel.h" 17 #include <boost/test/test_tools.hpp> 18 #include <boost/test/unit_test_suite.hpp> 22 using namespace armnn;
28 unsigned int offset = 0;
36 uint32_t PacketDataLength = header[1] & 0x00FFFFFF;
38 auto uniquePacketData = std::make_unique<unsigned char[]>(PacketDataLength);
39 std::memcpy(uniquePacketData.get(), packetBuffer + offset, PacketDataLength);
43 BOOST_CHECK(std::memcmp(packetBuffer + offset, packet.GetData(), packet.GetLength()) == 0);
45 CommandHandler(packet);
50 uint32_t uint8_t_size =
sizeof(uint8_t);
52 uint32_t uint64_t_size =
sizeof(uint64_t);
53 uint32_t threadId_size =
sizeof(std::thread::id);
58 std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
66 sendTimelinePacket->SendTimelineMessageDirectoryPackage();
67 sendTimelinePacket->Commit();
69 std::vector<profiling::SwTraceMessage> swTraceBufferMessages;
71 unsigned int offset = uint32_t_size * 2;
73 std::unique_ptr<profiling::IPacketBuffer> packetBuffer = bufferManager.
GetReadableBuffer();
75 uint8_t readStreamVersion =
ReadUint8(packetBuffer, offset);
77 offset += uint8_t_size;
78 uint8_t readPointerBytes =
ReadUint8(packetBuffer, offset);
80 offset += uint8_t_size;
81 uint8_t readThreadIdBytes =
ReadUint8(packetBuffer, offset);
83 offset += uint8_t_size;
87 for(uint32_t i = 0; i < declarationSize; ++i)
94 for(uint32_t index = 0; index < declarationSize; ++index)
104 for(uint32_t i = 0; i < bufferMessage.
m_ArgTypes.size(); ++i)
110 for(uint32_t i = 0; i < bufferMessage.
m_ArgNames.size(); ++i)
119 uint32_t threadId_size =
sizeof(std::thread::id);
124 std::unique_ptr<profiling::ISendTimelinePacket> sendTimelinePacket =
141 const uint64_t entityGuid = 22222u;
143 const uint64_t eventClassGuid = 33333u;
145 const uint64_t timestamp = 111111u;
146 const uint64_t eventGuid = 55555u;
148 const std::thread::id threadId = std::this_thread::get_id();;
150 const uint64_t labelGuid = 11111u;
151 std::string labelName =
"test_label";
153 const uint64_t relationshipGuid = 44444u;
154 const uint64_t headGuid = 111111u;
155 const uint64_t tailGuid = 222222u;
157 for (
int i = 0; i < 10; ++i)
160 sendTimelinePacket->SendTimelineEntityBinaryPacket(entityGuid);
161 sendTimelinePacket->Commit();
163 timelineCaptureCommandHandler);
166 sendTimelinePacket->SendTimelineEventClassBinaryPacket(eventClassGuid);
167 sendTimelinePacket->Commit();
169 timelineCaptureCommandHandler);
172 sendTimelinePacket->SendTimelineEventBinaryPacket(timestamp, threadId, eventGuid);
173 sendTimelinePacket->Commit();
175 timelineCaptureCommandHandler);
178 sendTimelinePacket->SendTimelineLabelBinaryPacket(labelGuid, labelName);
179 sendTimelinePacket->Commit();
181 timelineCaptureCommandHandler);
185 sendTimelinePacket->SendTimelineRelationshipBinaryPacket(relationshipType,
189 sendTimelinePacket->Commit();
191 timelineCaptureCommandHandler);
194 for (
int i = 0; i < 10; ++i)
202 std::vector<uint8_t> readThreadId(threadId_size, 0);
void PushEntity(const Entity entity, Model *model)
std::vector< char > m_ArgTypes
ErrorCode SetRelationshipCallback(OnNewRelationshipCallback cb, Model *model)
void PushRelationship(const Relationship relationship, Model *model)
Version ResolvePacketVersion(uint32_t familyId, uint32_t packetId) const
uint32_t GetEncodedValue()
ProfilingRelationshipType
EventClass ** m_EventClasses
std::vector< std::string > m_ArgNames
BOOST_AUTO_TEST_CASE(CheckConvolution2dLayer)
void PushEventClass(const EventClass eventClass, Model *model)
std::unique_ptr< ISendTimelinePacket > GetSendTimelinePacket() const
void PushLabel(const Label label, Model *model)
ErrorCode SetEventClassCallback(OnNewEventClassCallback cb, Model *model)
void PushEvent(const Event event, Model *model)
ErrorCode SetLabelCallback(OnNewLabelCallback cb, Model *model)
IPacketBufferPtr GetReadableBuffer() override
Head execution start depends on Tail execution completion.
ErrorCode DestroyModel(Model **model)
BOOST_CHECK(profilingService.GetCurrentState()==ProfilingState::WaitingForAck)
Head execution start depends on Tail execution completion.
RelationshipType m_RelationshipType
ErrorCode SetEventCallback(OnNewEventCallback cb, Model *model)
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
BOOST_AUTO_TEST_SUITE_END()
void ReadBytes(const IPacketBufferPtr &packetBuffer, unsigned int offset, unsigned int valueSize, uint8_t outValue[])
Relationship ** m_Relationships
ErrorCode SetEntityCallback(OnNewEntityCallback cb, Model *model)
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
void SendTimelinePacketToCommandHandler(const unsigned char *packetBuffer, profiling::CommandHandlerFunctor &CommandHandler)
uint8_t ReadUint8(const IPacketBufferPtr &packetBuffer, unsigned int offset)
SwTraceMessage ReadSwTraceMessage(const unsigned char *packetBuffer, unsigned int &offset)
ErrorCode CreateModel(Model **model)