ArmNN
 21.08
ProfilingConnectionFactory Class Referencefinal

#include <ProfilingConnectionFactory.hpp>

Inheritance diagram for ProfilingConnectionFactory:
IProfilingConnectionFactory

Public Member Functions

 ProfilingConnectionFactory ()=default
 
 ~ProfilingConnectionFactory ()=default
 
IProfilingConnectionPtr GetProfilingConnection (const ExternalProfilingOptions &options) const override
 
- Public Member Functions inherited from IProfilingConnectionFactory
virtual ~IProfilingConnectionFactory ()
 

Additional Inherited Members

- Public Types inherited from IProfilingConnectionFactory
using ExternalProfilingOptions = IRuntime::CreationOptions::ExternalProfilingOptions
 
using IProfilingConnectionPtr = std::unique_ptr< IProfilingConnection >
 

Detailed Description

Definition at line 16 of file ProfilingConnectionFactory.hpp.

Constructor & Destructor Documentation

◆ ProfilingConnectionFactory()

◆ ~ProfilingConnectionFactory()

Member Function Documentation

◆ GetProfilingConnection()

std::unique_ptr< IProfilingConnection > GetProfilingConnection ( const ExternalProfilingOptions options) const
overridevirtual

Implements IProfilingConnectionFactory.

Definition at line 18 of file ProfilingConnectionFactory.cpp.

References IRuntime::CreationOptions::ExternalProfilingOptions::m_FileFormat, IRuntime::CreationOptions::ExternalProfilingOptions::m_FileOnly, IRuntime::CreationOptions::ExternalProfilingOptions::m_IncomingCaptureFile, IRuntime::CreationOptions::ExternalProfilingOptions::m_LocalPacketHandlers, and IRuntime::CreationOptions::ExternalProfilingOptions::m_OutgoingCaptureFile.

20 {
21  // Before proceed to create the IProfilingConnection, check if the file format is supported
22  if (!(options.m_FileFormat == "binary"))
23  {
24  throw armnn::UnimplementedException("Unsupported profiling file format, only binary is supported");
25  }
26 
27  // We can create 3 different types of IProfilingConnection.
28  // 1: If no relevant options are specified then a SocketProfilingConnection is returned.
29  // 2: If both incoming and outgoing capture files are specified then a SocketProfilingConnection decorated by a
30  // ProfilingConnectionDumpToFileDecorator is returned.
31  // 3: If both incoming and outgoing capture files are specified and "file only" then a FileOnlyProfilingConnection
32  // decorated by a ProfilingConnectionDumpToFileDecorator is returned.
33  // 4. There is now another option if m_FileOnly == true and there are ILocalPacketHandlers specified
34  // we can create a FileOnlyProfilingConnection without a file dump
35  if ((!options.m_IncomingCaptureFile.empty() || !options.m_OutgoingCaptureFile.empty()) && !options.m_FileOnly)
36  {
37  // This is type 2.
38  return std::make_unique<ProfilingConnectionDumpToFileDecorator>(std::make_unique<SocketProfilingConnection>(),
39  options);
40  }
41  else if ((!options.m_IncomingCaptureFile.empty() || !options.m_OutgoingCaptureFile.empty()) && options.m_FileOnly)
42  {
43  // This is type 3.
44  return std::make_unique<ProfilingConnectionDumpToFileDecorator>(
45  std::make_unique<FileOnlyProfilingConnection>(options), options);
46  }
47  else if (options.m_FileOnly && !options.m_LocalPacketHandlers.empty())
48  {
49  // This is the type 4.
50  return std::make_unique<FileOnlyProfilingConnection>(options);
51  }
52  else
53  {
54  // This is type 1.
55  return std::make_unique<SocketProfilingConnection>();
56  }
57 }

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