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 --- ...quest_counters_packet_handler_8cpp_source.xhtml | 128 +++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 21.02/_request_counters_packet_handler_8cpp_source.xhtml (limited to '21.02/_request_counters_packet_handler_8cpp_source.xhtml') diff --git a/21.02/_request_counters_packet_handler_8cpp_source.xhtml b/21.02/_request_counters_packet_handler_8cpp_source.xhtml new file mode 100644 index 0000000000..65812c6476 --- /dev/null +++ b/21.02/_request_counters_packet_handler_8cpp_source.xhtml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + +ArmNN: src/profiling/test/RequestCountersPacketHandler.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
RequestCountersPacketHandler.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 
7 
9 
11 
12 #include <common/include/PacketVersionResolver.hpp>
13 #include <common/include/ProfilingException.hpp>
14 
15 namespace armnn
16 {
17 
18 namespace profiling
19 {
20 
22 {
23  std::vector<uint32_t> headers;
24  headers.push_back(m_CounterDirectoryMessageHeader); // counter directory
25  return headers;
26 }
27 
28 void RequestCountersPacketHandler::HandlePacket(const arm::pipe::Packet& packet)
29 {
30  if (packet.GetHeader() != m_CounterDirectoryMessageHeader)
31  {
32  return;
33  }
34  arm::pipe::PacketVersionResolver packetVersionResolver;
35  DirectoryCaptureCommandHandler directoryCaptureCommandHandler(
36  0, 2, packetVersionResolver.ResolvePacketVersion(0, 2).GetEncodedValue());
37  directoryCaptureCommandHandler.operator()(packet);
38  const ICounterDirectory& counterDirectory = directoryCaptureCommandHandler.GetCounterDirectory();
39  for (auto& category : counterDirectory.GetCategories())
40  {
41  // Remember we need to translate the Uid's from our CounterDirectory instance to the parent one.
42  std::vector<uint16_t> translatedCounters;
43  for (auto const& copyUid : category->m_Counters)
44  {
45  translatedCounters.emplace_back(directoryCaptureCommandHandler.TranslateUIDCopyToOriginal(copyUid));
46  }
47  m_IdList.insert(std::end(m_IdList), std::begin(translatedCounters), std::end(translatedCounters));
48  }
49  SendCounterSelectionPacket();
50 }
51 
52 void RequestCountersPacketHandler::SendCounterSelectionPacket()
53 {
54  uint32_t uint16_t_size = sizeof(uint16_t);
55  uint32_t uint32_t_size = sizeof(uint32_t);
56 
57  uint32_t offset = 0;
58  uint32_t bodySize = uint32_t_size + armnn::numeric_cast<uint32_t>(m_IdList.size()) * uint16_t_size;
59 
60  auto uniqueData = std::make_unique<unsigned char[]>(bodySize);
61  auto data = reinterpret_cast<unsigned char*>(uniqueData.get());
62 
63  // Copy capturePeriod
64  WriteUint32(data, offset, m_CapturePeriod);
65 
66  // Copy m_IdList
67  offset += uint32_t_size;
68  for (const uint16_t& id : m_IdList)
69  {
70  WriteUint16(data, offset, id);
71  offset += uint16_t_size;
72  }
73 
74  arm::pipe::Packet packet(0x40000, bodySize, uniqueData);
75  m_Connection->ReturnPacket(packet);
76 }
77 
78 } // namespace profiling
79 
80 } // namespace armnn
+
void WriteUint16(const IPacketBufferPtr &packetBuffer, unsigned int offset, uint16_t value)
+
void WriteUint32(const IPacketBufferPtr &packetBuffer, unsigned int offset, uint32_t value)
+ + +
Copyright (c) 2021 ARM Limited and Contributors.
+ +
virtual const Categories & GetCategories() const =0
+ +
virtual void ReturnPacket(arm::pipe::Packet &packet)=0
+ +
void HandlePacket(const arm::pipe::Packet &packet) override
process the packet
+
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
Definition: NumericCast.hpp:35
+ + +
+
+ + + + -- cgit v1.2.1