ArmNN
 20.02
ProfilingConnectionDumpToFileDecorator Class Reference

#include <ProfilingConnectionDumpToFileDecorator.hpp>

Inheritance diagram for ProfilingConnectionDumpToFileDecorator:
IProfilingConnection

Public Member Functions

 ProfilingConnectionDumpToFileDecorator (std::unique_ptr< IProfilingConnection > connection, const Runtime::CreationOptions::ExternalProfilingOptions &options, bool ignoreFailures=false)
 
 ~ProfilingConnectionDumpToFileDecorator ()
 
bool IsOpen () const override
 
void Close () override
 
bool WritePacket (const unsigned char *buffer, uint32_t length) override
 
Packet ReadPacket (uint32_t timeout) override
 
- Public Member Functions inherited from IProfilingConnection
virtual ~IProfilingConnection ()
 

Detailed Description

Definition at line 25 of file ProfilingConnectionDumpToFileDecorator.hpp.

Constructor & Destructor Documentation

◆ ProfilingConnectionDumpToFileDecorator()

ProfilingConnectionDumpToFileDecorator ( std::unique_ptr< IProfilingConnection connection,
const Runtime::CreationOptions::ExternalProfilingOptions &  options,
bool  ignoreFailures = false 
)

Definition at line 20 of file ProfilingConnectionDumpToFileDecorator.cpp.

24  : m_Connection(std::move(connection))
25  , m_Options(options)
26  , m_IgnoreFileErrors(ignoreFailures)
27 {
28  if (!m_Connection)
29  {
30  throw InvalidArgumentException("Connection cannot be nullptr");
31  }
32 }
armnn::Runtime::CreationOptions::ExternalProfilingOptions options

◆ ~ProfilingConnectionDumpToFileDecorator()

Member Function Documentation

◆ Close()

void Close ( )
overridevirtual

Implements IProfilingConnection.

Definition at line 44 of file ProfilingConnectionDumpToFileDecorator.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), ProfilingConnectionDumpToFileDecorator::ReadPacket(), and ProfilingConnectionDumpToFileDecorator::~ProfilingConnectionDumpToFileDecorator().

45 {
46  m_IncomingDumpFileStream.flush();
47  m_IncomingDumpFileStream.close();
48  m_OutgoingDumpFileStream.flush();
49  m_OutgoingDumpFileStream.close();
50  m_Connection->Close();
51 }

◆ IsOpen()

bool IsOpen ( ) const
overridevirtual

Implements IProfilingConnection.

Definition at line 39 of file ProfilingConnectionDumpToFileDecorator.cpp.

40 {
41  return m_Connection->IsOpen();
42 }

◆ ReadPacket()

Packet ReadPacket ( uint32_t  timeout)
overridevirtual

Implements IProfilingConnection.

Definition at line 64 of file ProfilingConnectionDumpToFileDecorator.cpp.

References ProfilingConnectionDumpToFileDecorator::Close(), Packet::GetData(), Packet::GetHeader(), and Packet::GetLength().

Referenced by BOOST_AUTO_TEST_CASE().

65 {
66  Packet packet = m_Connection->ReadPacket(timeout);
67  if (!m_Options.m_IncomingCaptureFile.empty())
68  {
69  DumpIncomingToFile(packet);
70  }
71  return packet;
72 }

◆ WritePacket()

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

Implements IProfilingConnection.

Definition at line 53 of file ProfilingConnectionDumpToFileDecorator.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

54 {
55  bool success = true;
56  if (!m_Options.m_OutgoingCaptureFile.empty())
57  {
58  success &= DumpOutgoingToFile(buffer, length);
59  }
60  success &= m_Connection->WritePacket(buffer, length);
61  return success;
62 }

The documentation for this class was generated from the following files: