DOLFIN
DOLFIN C++ interface
Public Member Functions | List of all members
dolfin::Logger Class Reference

Handling of error messages, logging and informational display. More...

#include <Logger.h>

Public Member Functions

 Logger ()
 Constructor.
 
 ~Logger ()
 Destructor.
 
void log (std::string msg, int log_level=INFO) const
 Print message.
 
void log_underline (std::string msg, int log_level=INFO) const
 Print underlined message.
 
void warning (std::string msg) const
 Print warning.
 
void error (std::string msg) const
 Print error message and throw exception.
 
void dolfin_error (std::string location, std::string task, std::string reason, int mpi_rank=-1) const
 
void deprecation (std::string feature, std::string version_deprecated, std::string message) const
 Issue deprecation warning for removed feature.
 
void begin (std::string msg, int log_level=INFO)
 Begin task (increase indentation level)
 
void end ()
 End task (decrease indentation level)
 
void progress (std::string title, double p) const
 Draw progress bar.
 
void set_output_stream (std::ostream &stream)
 Set output stream.
 
std::ostream & get_output_stream ()
 Get output stream.
 
void set_log_active (bool active)
 Turn logging on or off.
 
bool is_active ()
 Return true iff logging is active.
 
void set_log_level (int log_level)
 Set log level.
 
int get_log_level () const
 Get log level.
 
void set_indentation_level (std::size_t indentation_level)
 Set indentation level.
 
void register_timing (std::string task, std::tuple< double, double, double > elapsed)
 Register timing (for later summary)
 
Table timings (TimingClear clear, std::set< TimingType > type)
 
void list_timings (TimingClear clear, std::set< TimingType > type)
 
void dump_timings_to_xml (std::string filename, TimingClear clear)
 
std::tuple< std::size_t, double, double, double > timing (std::string task, TimingClear clear)
 
void monitor_memory_usage ()
 
MPI_Comm mpi_comm ()
 Return MPI Communicator of Logger.
 
void _report_memory_usage (size_t num_mb)
 Helper function for reporting memory usage.
 
void __debug (std::string msg) const
 Helper function for dolfin_debug macro.
 
void __dolfin_assert (std::string file, unsigned long line, std::string function, std::string check) const
 Helper function for dolfin_dolfin_assert macro.
 

Detailed Description

Handling of error messages, logging and informational display.

Member Function Documentation

◆ dolfin_error()

void Logger::dolfin_error ( std::string  location,
std::string  task,
std::string  reason,
int  mpi_rank = -1 
) const

Print error message, prefer this to the above generic error message

◆ dump_timings_to_xml()

void Logger::dump_timings_to_xml ( std::string  filename,
TimingClear  clear 
)

Dump a summary of timings and tasks to XML file, optionally clearing stored timings. MPI_MAX, MPI_MIN and MPI_AVG reductions are stored. Collective on Logger::mpi_comm().

◆ list_timings()

void Logger::list_timings ( TimingClear  clear,
std::set< TimingType type 
)

List a summary of timings and tasks, optionally clearing stored timings. MPI_AVG reduction is printed. Collective on Logger::mpi_comm().

◆ monitor_memory_usage()

void Logger::monitor_memory_usage ( )

Monitor memory usage. Call this function at the start of a program to continuously monitor the memory usage of the process.

◆ timing()

std::tuple< std::size_t, double, double, double > Logger::timing ( std::string  task,
TimingClear  clear 
)

Return timing (count, total wall time, total user time, total system time) for given task, optionally clearing all timings for the task

◆ timings()

Table Logger::timings ( TimingClear  clear,
std::set< TimingType type 
)

Return a summary of timings and tasks in a Table, optionally clearing stored timings


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