ArmNN
 21.02
ProfilingConnectionDumpToFileDecorator Class Reference

#include <ProfilingConnectionDumpToFileDecorator.hpp>

Inheritance diagram for ProfilingConnectionDumpToFileDecorator:
IProfilingConnection

Public Member Functions

 ProfilingConnectionDumpToFileDecorator (std::unique_ptr< IProfilingConnection > connection, const IRuntime::CreationOptions::ExternalProfilingOptions &options, bool ignoreFailures=false)
 
 ~ProfilingConnectionDumpToFileDecorator ()
 
bool IsOpen () const override
 
void Close () override
 
bool WritePacket (const unsigned char *buffer, uint32_t length) override
 
arm::pipe::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 IRuntime::CreationOptions::ExternalProfilingOptions options,
bool  ignoreFailures = false 
)

Definition at line 19 of file ProfilingConnectionDumpToFileDecorator.cpp.

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

◆ ~ProfilingConnectionDumpToFileDecorator()

Member Function Documentation

◆ Close()

void Close ( )
overridevirtual

Implements IProfilingConnection.

Definition at line 43 of file ProfilingConnectionDumpToFileDecorator.cpp.

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

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

◆ IsOpen()

bool IsOpen ( ) const
overridevirtual

Implements IProfilingConnection.

Definition at line 38 of file ProfilingConnectionDumpToFileDecorator.cpp.

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

◆ ReadPacket()

arm::pipe::Packet ReadPacket ( uint32_t  timeout)
overridevirtual

Implements IProfilingConnection.

Definition at line 63 of file ProfilingConnectionDumpToFileDecorator.cpp.

References ProfilingConnectionDumpToFileDecorator::Close(), IRuntime::CreationOptions::ExternalProfilingOptions::m_IncomingCaptureFile, and IRuntime::CreationOptions::ExternalProfilingOptions::m_OutgoingCaptureFile.

Referenced by BOOST_AUTO_TEST_CASE().

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

◆ WritePacket()

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

Implements IProfilingConnection.

Definition at line 52 of file ProfilingConnectionDumpToFileDecorator.cpp.

References IRuntime::CreationOptions::ExternalProfilingOptions::m_OutgoingCaptureFile.

Referenced by BOOST_AUTO_TEST_CASE().

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

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