Swarm-NG  1.1
swarm::log::manager Class Reference

Manage CPU/GPU logs and writing them to appropriate output. More...

#include <logmanager.hpp>

Public Member Functions

void init (const config &, int host_buffer_size=default_buffer_size, int device_buffer_size=default_buffer_size)
 Initialize logging system. More...
 
void flush (int flags=memory)
 Stream the log from host_log and device_log to the output. More...
 
void shutdown ()
 Unitialize logging system. More...
 

Static Public Member Functions

static shared_ptr< manager > & default_log ()
 Default log that is initialized in swarm::init(cfg) It is automatically used in integrator. More...
 

Detailed Description

Manage CPU/GPU logs and writing them to appropriate output.

Routines to coordinate three objects:

  • host_log : log data structure on host memory
  • device_log : log data structure on device memory.
  • writer : provider class to write to desired output device

Purpose:

  • Stream log messages from device_log to host_log to writer
  • Allocating memory for device_log and host_log
  • Select and configure plugin for writer
  • Stream lprintf messages to standard output

There is a default instance of this class that is initialized in swarm::init. For the most part you do not need to instantiate this class as long as you only need one log stream for your application. After initializing the swarm package using swarm::init, you can get the dafult log manager by calling log::manager::default_log() This is a good replacement for global hlog and dlog variables that were used in old swarm.

Definition at line 57 of file logmanager.hpp.

Member Function Documentation

Pmanager & swarm::log::manager::default_log ( )
static

Default log that is initialized in swarm::init(cfg) It is automatically used in integrator.

define default log manager and initialize it.

Definition at line 37 of file logmanager.cpp.

Referenced by swarm::init(), swarm::integrator::integrator(), swarm::gpu::integrator::integrator(), and main().

void swarm::log::manager::flush ( int  flags = memory)

Stream the log from host_log and device_log to the output.

Flush the output buffer for both host and device.

  • Replay lprintf
  • Download device_log to host_log
  • Output host_log to writer

Definition at line 67 of file logmanager.cpp.

References gpulog::LOG_DEVCLEAR.

void swarm::log::manager::init ( const config cfg,
int  host_buffer_size = default_buffer_size,
int  device_buffer_size = default_buffer_size 
)

Initialize logging system.

Initialize the log writer.

  • Allocates memory for host_log
  • Allocates memory for device_log
  • Select plugin for writer
  • Configure writer plugin

Definition at line 50 of file logmanager.cpp.

References swarm::log::writer::create().

Referenced by shutdown().

void swarm::log::manager::shutdown ( )

Unitialize logging system.

Reset the log manager.

Definition at line 59 of file logmanager.cpp.

References init().


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