From 6940dd720ebb6b3d1df8ca203ab696daefe58189 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Fri, 20 Mar 2020 12:25:56 +0000 Subject: renamed Documentation folder 20.02 and added .nojekyll file Signed-off-by: Jim Flynn --- ..._1profiling_1_1_mock_profiling_connection.xhtml | 505 +++++++++++++++++++++ 1 file changed, 505 insertions(+) create mode 100644 20.02/classarmnn_1_1profiling_1_1_mock_profiling_connection.xhtml (limited to '20.02/classarmnn_1_1profiling_1_1_mock_profiling_connection.xhtml') diff --git a/20.02/classarmnn_1_1profiling_1_1_mock_profiling_connection.xhtml b/20.02/classarmnn_1_1profiling_1_1_mock_profiling_connection.xhtml new file mode 100644 index 0000000000..90e2e0cec4 --- /dev/null +++ b/20.02/classarmnn_1_1profiling_1_1_mock_profiling_connection.xhtml @@ -0,0 +1,505 @@ + + + + + + + + + + + + + +ArmNN: MockProfilingConnection Class Reference + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+ +
+
MockProfilingConnection Class Reference
+
+
+ +

#include <ProfilingMocks.hpp>

+
+Inheritance diagram for MockProfilingConnection:
+
+
+ + +IProfilingConnection + +
+ + + + +

+Public Types

enum  PacketType {
+  StreamMetaData, +ConnectionAcknowledge, +CounterDirectory, +ReqCounterDirectory, +
+  PeriodicCounterSelection, +PerJobCounterSelection, +TimelineMessageDirectory, +PeriodicCounterCapture, +
+  Unknown +
+ }
 
+ + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 MockProfilingConnection ()
 
bool IsOpen () const override
 
void Close () override
 
bool WritePacket (const unsigned char *buffer, uint32_t length) override
 
long CheckForPacket (const std::pair< PacketType, uint32_t > packetInfo)
 
bool WritePacket (Packet &&packet)
 
Packet ReadPacket (uint32_t timeout) override
 
unsigned long GetWrittenDataSize ()
 
void Clear ()
 
- Public Member Functions inherited from IProfilingConnection
virtual ~IProfilingConnection ()
 
+

Detailed Description

+
+

Definition at line 35 of file ProfilingMocks.hpp.

+

Member Enumeration Documentation

+ +

◆ PacketType

+ +
+
+ + + + + +
+ + + + +
enum PacketType
+
+strong
+
+ + + + + + + + + + +
Enumerator
StreamMetaData 
ConnectionAcknowledge 
CounterDirectory 
ReqCounterDirectory 
PeriodicCounterSelection 
PerJobCounterSelection 
TimelineMessageDirectory 
PeriodicCounterCapture 
Unknown 
+ +

Definition at line 44 of file ProfilingMocks.hpp.

+
45  {
47  ConnectionAcknowledge,
49  ReqCounterDirectory,
50  PeriodicCounterSelection,
51  PerJobCounterSelection,
52  TimelineMessageDirectory,
53  PeriodicCounterCapture,
54  Unknown
55  };
+ + +
+
+
+

Constructor & Destructor Documentation

+ +

◆ MockProfilingConnection()

+ +
+
+ + + + + +
+ + + + + + + +
MockProfilingConnection ()
+
+inline
+
+ +

Definition at line 38 of file ProfilingMocks.hpp.

+
39  : m_IsOpen(true)
40  , m_WrittenData()
41  , m_Packet()
42  {}
+
+
+

Member Function Documentation

+ +

◆ CheckForPacket()

+ +
+
+ + + + + +
+ + + + + + + + +
long CheckForPacket (const std::pair< PacketType, uint32_t > packetInfo)
+
+inline
+
+ +

Definition at line 106 of file ProfilingMocks.hpp.

+ +

Referenced by BOOST_AUTO_TEST_CASE(), and SwapProfilingConnectionFactoryHelper::WaitForPacketsSent().

+
107  {
108  std::lock_guard<std::mutex> lock(m_Mutex);
109 
110  if(packetInfo.second != 0)
111  {
112  return std::count(m_WrittenData.begin(), m_WrittenData.end(), packetInfo);
113  }
114  else
115  {
116  return std::count_if(m_WrittenData.begin(), m_WrittenData.end(),
117  [&packetInfo](const std::pair<PacketType, uint32_t> pair) { return packetInfo.first == pair.first; });
118  }
119  }
+
+
+ +

◆ Clear()

+ +
+
+ + + + + +
+ + + + + + + +
void Clear ()
+
+inline
+
+ +

Definition at line 146 of file ProfilingMocks.hpp.

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
147  {
148  std::lock_guard<std::mutex> lock(m_Mutex);
149 
150  m_WrittenData.clear();
151  }
+
+
+ +

◆ Close()

+ +
+
+ + + + + +
+ + + + + + + +
void Close ()
+
+inlineoverridevirtual
+
+ +

Implements IProfilingConnection.

+ +

Definition at line 64 of file ProfilingMocks.hpp.

+
65  {
66  std::lock_guard<std::mutex> lock(m_Mutex);
67 
68  m_IsOpen = false;
69  }
+
+
+ +

◆ GetWrittenDataSize()

+ +
+
+ + + + + +
+ + + + + + + +
unsigned long GetWrittenDataSize ()
+
+inline
+
+ +

Definition at line 139 of file ProfilingMocks.hpp.

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
140  {
141  std::lock_guard<std::mutex> lock(m_Mutex);
142 
143  return m_WrittenData.size();
144  }
+
+
+ +

◆ IsOpen()

+ +
+
+ + + + + +
+ + + + + + + +
bool IsOpen () const
+
+inlineoverridevirtual
+
+ +

Implements IProfilingConnection.

+ +

Definition at line 57 of file ProfilingMocks.hpp.

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
58  {
59  std::lock_guard<std::mutex> lock(m_Mutex);
60 
61  return m_IsOpen;
62  }
+
+
+ +

◆ ReadPacket()

+ +
+
+ + + + + +
+ + + + + + + + +
Packet ReadPacket (uint32_t timeout)
+
+inlineoverridevirtual
+
+ +

Implements IProfilingConnection.

+ +

Definition at line 129 of file ProfilingMocks.hpp.

+ +

References armnn::IgnoreUnused().

+
130  {
131  IgnoreUnused(timeout);
132 
133  // Simulate a delay in the reading process. The default timeout is way too long.
134  std::this_thread::sleep_for(std::chrono::milliseconds(5));
135  std::lock_guard<std::mutex> lock(m_Mutex);
136  return std::move(m_Packet);
137  }
void IgnoreUnused(Ts &&...)
+
+
+
+ +

◆ WritePacket() [1/2]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
bool WritePacket (const unsigned char * buffer,
uint32_t length 
)
+
+inlineoverridevirtual
+
+ +

Implements IProfilingConnection.

+ +

Definition at line 71 of file ProfilingMocks.hpp.

+ +

References MockProfilingConnection::PeriodicCounterCapture, armnn::profiling::ReadUint32(), MockProfilingConnection::TimelineMessageDirectory, and MockProfilingConnection::Unknown.

+ +

Referenced by BOOST_AUTO_TEST_CASE().

+
72  {
73  if (buffer == nullptr || length == 0)
74  {
75  return false;
76  }
77 
78  uint32_t header = ReadUint32(buffer, 0);
79 
80  uint32_t packetFamily = (header >> 26);
81  uint32_t packetId = ((header >> 16) & 1023);
82 
83  PacketType packetType;
84 
85  switch (packetFamily)
86  {
87  case 0:
88  packetType = packetId < 6 ? PacketType(packetId) : PacketType::Unknown;
89  break;
90  case 1:
91  packetType = packetId == 0 ? PacketType::TimelineMessageDirectory : PacketType::Unknown;
92  break;
93  case 3:
94  packetType = packetId == 0 ? PacketType::PeriodicCounterCapture : PacketType::Unknown;
95  break;
96  default:
97  packetType = PacketType::Unknown;
98  }
99 
100  std::lock_guard<std::mutex> lock(m_Mutex);
101 
102  m_WrittenData.push_back({ packetType, length });
103  return true;
104  }
+ + +
MockProfilingConnection::PacketType PacketType
+ + +
uint32_t ReadUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset)
+
+
+
+ +

◆ WritePacket() [2/2]

+ +
+
+ + + + + +
+ + + + + + + + +
bool WritePacket (Packet && packet)
+
+inline
+
+ +

Definition at line 121 of file ProfilingMocks.hpp.

+
122  {
123  std::lock_guard<std::mutex> lock(m_Mutex);
124 
125  m_Packet = std::move(packet);
126  return true;
127  }
+
+
+
The documentation for this class was generated from the following file: +
+
+ + + + -- cgit v1.2.1