Utilities

TPZSimpleTimer

class TPZSimpleTimer

Simple timer Utility This timer allows to measure execution time with nested timers support.

The time range corresponds to the lifetime of the TPZSimpleTimer instance. For nested timers, one can configure if the information will be printed only when the outermost timer is complete or not.

Public Functions

TPZSimpleTimer()

Default constructor.

Starts the timer.

TPZSimpleTimer(const std::string name, bool alwaysPrint = false)

Start the timer and gives it a name.

~TPZSimpleTimer()

Default destructor (stops the timer)

std::string ReturnTimeString()

When called, returns the time since the creation of the object in a string.

double ReturnTimeDouble()

When called, returns the time since the creation of the object in a double.

TPZLogger

Logging in NeoPZ is currently done through the log4cxx library, and its linkage with NeoPZ can be configured through the USING_LOG4CXX CMake option.

A user familiarised with the log4cxx library should expect no trouble creating their own custom logger, but NeoPZ has several loggers available with sane defaults. However, one is able to easily change the verbosity levels (and adding their own loggers) through the configuration file.

Configuring the logger for an application

The configuration of the loggers can be done through a call to

static inline void TPZLogger::InitializePZLOG()

Initializes logger using default NeoPZ config.

The default configuration file is $INSTALL_DIR/include/Util/log4cxx.cfg (or $BUILD_DIR/Util/log4cxx.cfg when inside the NeoPZ buildtree). This file is generated based on the $SOURCE_DIR/Util/log4cxx.cfg, which should not be modified by the user.

Note

If the log4cxx.cfg in the source directory is modified (by a user that does not care about this documentation, or by means of a git pull), then it will be copied to both the build and install directories. Any existing configuration file will be renamed with a -backup suffix.

Alternatively, the user can provide a custom configuration file and call

static void TPZLogger::InitializePZLOG(const std::string &configfile)

Initializes logger using custom config in configfile.

which is the recommended method for external projects, since each might have quite distinct verbosity levels for their loggers.