From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- ..._test_timeline_packet_handler_8cpp_source.xhtml | 140 +++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 21.02/_test_timeline_packet_handler_8cpp_source.xhtml (limited to '21.02/_test_timeline_packet_handler_8cpp_source.xhtml') diff --git a/21.02/_test_timeline_packet_handler_8cpp_source.xhtml b/21.02/_test_timeline_packet_handler_8cpp_source.xhtml new file mode 100644 index 0000000000..0868f9772e --- /dev/null +++ b/21.02/_test_timeline_packet_handler_8cpp_source.xhtml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + +ArmNN: src/profiling/test/TestTimelinePacketHandler.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
TestTimelinePacketHandler.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
9 
10 #include <chrono>
11 #include <iostream>
12 
13 namespace armnn
14 {
15 
16 namespace profiling
17 {
18 
20 {
21  std::vector<uint32_t> headers;
22  headers.push_back(m_DirectoryHeader); // message directory
23  headers.push_back(m_MessageHeader); // message
24  return headers;
25 }
26 
27 void TestTimelinePacketHandler::HandlePacket(const arm::pipe::Packet& packet)
28 {
29  if (packet.GetHeader() == m_DirectoryHeader)
30  {
31  ProcessDirectoryPacket(packet);
32  }
33  else if (packet.GetHeader() == m_MessageHeader)
34  {
35  ProcessMessagePacket(packet);
36  }
37  else
38  {
39  std::stringstream ss;
40  ss << "Received a packet with unknown header [" << packet.GetHeader() << "]";
41  throw armnn::Exception(ss.str());
42  }
43 }
44 
46 {
47  m_Connection->Close();
48 }
49 
51 {
52  std::unique_lock<std::mutex> lck(m_InferenceCompletedMutex);
53 
54  auto start = std::chrono::high_resolution_clock::now();
55  // Here we we will go back to sleep after a spurious wake up if
56  // m_InferenceCompleted is not yet true.
57  if (!m_InferenceCompletedConditionVariable.wait_for(lck,
58  std::chrono::milliseconds(timeout),
59  [&]{return m_InferenceCompleted == true;}))
60  {
61  auto finish = std::chrono::high_resolution_clock::now();
62  std::chrono::duration<double, std::milli> elapsed = finish - start;
63  std::stringstream ss;
64  ss << "Timed out waiting on inference completion for " << elapsed.count() << " ms";
65  throw armnn::TimeoutException(ss.str());
66  }
67  return;
68 }
69 
71 {
72  { // only lock when we are updating the inference completed variable
73  std::unique_lock<std::mutex> lck(m_InferenceCompletedMutex);
74  m_InferenceCompleted = true;
75  }
76  m_InferenceCompletedConditionVariable.notify_one();
77 }
78 
79 void TestTimelinePacketHandler::ProcessDirectoryPacket(const arm::pipe::Packet& packet)
80 {
81  m_DirectoryDecoder(packet);
82 }
83 
84 void TestTimelinePacketHandler::ProcessMessagePacket(const arm::pipe::Packet& packet)
85 {
86  m_Decoder(packet);
87 }
88 
89 // TimelineMessageDecoder functions
90 arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEntity(const Entity& entity)
91 {
92  m_TimelineModel.AddEntity(entity.m_Guid);
93  return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
94 }
95 
96 arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEventClass(
97  const arm::pipe::ITimelineDecoder::EventClass& eventClass)
98 {
99  m_TimelineModel.AddEventClass(eventClass);
100  return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
101 }
102 
103 arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateEvent(
104  const arm::pipe::ITimelineDecoder::Event& event)
105 {
106  m_TimelineModel.AddEvent(event);
107  return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
108 }
109 
110 arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateLabel(
111  const arm::pipe::ITimelineDecoder::Label& label)
112 {
113  m_TimelineModel.AddLabel(label);
114  return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
115 }
116 
117 arm::pipe::ITimelineDecoder::TimelineStatus TimelineMessageDecoder::CreateRelationship(
118  const arm::pipe::ITimelineDecoder::Relationship& relationship)
119 {
120  m_TimelineModel.AddRelationship(relationship);
121  // check to see if this is an execution link to an inference of event class end of life
122  // if so the inference has completed so send out a notification...
123  if (relationship.m_RelationshipType == RelationshipType::ExecutionLink &&
124  m_TimelineModel.IsInferenceGuid(relationship.m_HeadGuid))
125  {
126  ProfilingStaticGuid attributeGuid(relationship.m_AttributeGuid);
128  {
129  if (m_PacketHandler != nullptr)
130  {
131  m_PacketHandler->SetInferenceComplete();
132  }
133  }
134  }
135  return arm::pipe::ITimelineDecoder::TimelineStatus::TimelineStatus_Success;
136 }
137 
138 } // namespace profiling
139 
140 } // namespace armnn
void AddLabel(const arm::pipe::ITimelineDecoder::Label &label)
+ + + +
bool IsInferenceGuid(uint64_t guid) const
+
Copyright (c) 2021 ARM Limited and Contributors.
+
static ARMNN_DLLEXPORT ProfilingStaticGuid ARMNN_PROFILING_EOL_EVENT_CLASS
+ + +
void AddEventClass(const arm::pipe::ITimelineDecoder::EventClass &eventClass)
+
virtual std::vector< uint32_t > GetHeadersAccepted() override
+
void AddEvent(const arm::pipe::ITimelineDecoder::Event &event)
+ + +
virtual TimelineStatus CreateLabel(const Label &) override
+ +
virtual TimelineStatus CreateEventClass(const EventClass &) override
+
virtual TimelineStatus CreateEvent(const Event &) override
+ + +
virtual TimelineStatus CreateRelationship(const Relationship &) override
+
Base class for all ArmNN exceptions so that users can filter to just those.
Definition: Exceptions.hpp:46
+ + +
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
+
+
+ + + + -- cgit v1.2.1