9 #include <common/include/LabelsAndEventClasses.hpp> 22 std::vector<uint32_t> headers;
23 headers.push_back(m_DirectoryHeader);
24 headers.push_back(m_MessageHeader);
30 if (packet.GetHeader() == m_DirectoryHeader)
32 ProcessDirectoryPacket(packet);
34 else if (packet.GetHeader() == m_MessageHeader)
36 ProcessMessagePacket(packet);
41 ss <<
"Received a packet with unknown header [" << packet.GetHeader() <<
"]";
48 m_Connection->
Close();
53 std::unique_lock<std::mutex> lck(m_InferenceCompletedMutex);
55 auto start = std::chrono::high_resolution_clock::now();
58 if (!m_InferenceCompletedConditionVariable.wait_for(lck,
59 std::chrono::milliseconds(timeout),
60 [&]{return m_InferenceCompleted == true;}))
62 auto finish = std::chrono::high_resolution_clock::now();
63 std::chrono::duration<double, std::milli> elapsed = finish - start;
65 ss <<
"Timed out waiting on inference completion for " << elapsed.count() <<
" ms";
74 std::unique_lock<std::mutex> lck(m_InferenceCompletedMutex);
75 m_InferenceCompleted =
true;
77 m_InferenceCompletedConditionVariable.notify_one();
80 void TestTimelinePacketHandler::ProcessDirectoryPacket(
const arm::pipe::Packet& packet)
82 m_DirectoryDecoder(packet);
85 void TestTimelinePacketHandler::ProcessMessagePacket(
const arm::pipe::Packet& packet)
94 return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
98 const arm::pipe::ITimelineDecoder::EventClass& eventClass)
101 return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
105 const arm::pipe::ITimelineDecoder::Event& event)
108 return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
112 const arm::pipe::ITimelineDecoder::Label& label)
115 return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
119 const arm::pipe::ITimelineDecoder::Relationship& relationship)
127 ProfilingStaticGuid attributeGuid(relationship.m_AttributeGuid);
128 if (attributeGuid == armnn::profiling::LabelsAndEventClasses::ARMNN_PROFILING_EOL_EVENT_CLASS)
130 if (m_PacketHandler !=
nullptr)
132 m_PacketHandler->SetInferenceComplete();
136 return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
void AddLabel(const arm::pipe::ITimelineDecoder::Label &label)
Head retains(parents) Tail.
bool IsInferenceGuid(uint64_t guid) const
Copyright (c) 2021 ARM Limited and Contributors.
void AddEventClass(const arm::pipe::ITimelineDecoder::EventClass &eventClass)
virtual std::vector< uint32_t > GetHeadersAccepted() override
void AddEvent(const arm::pipe::ITimelineDecoder::Event &event)
void AddEntity(uint64_t guid)
virtual TimelineStatus CreateLabel(const Label &) override
virtual TimelineStatus CreateEventClass(const EventClass &) override
virtual TimelineStatus CreateEvent(const Event &) override
void SetInferenceComplete()
virtual TimelineStatus CreateRelationship(const Relationship &) override
Base class for all ArmNN exceptions so that users can filter to just those.
void WaitOnInferenceCompletion(unsigned int timeout)
virtual void HandlePacket(const arm::pipe::Packet &packet) override
process the packet
void AddRelationship(const arm::pipe::ITimelineDecoder::Relationship &relationship)
virtual TimelineStatus CreateEntity(const Entity &) override