GemaCoreLib
The GeMA Core library
Public Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
GmTimeMsg Class Reference

RAII object used to measure the elapsed time of an operation. More...

#include <gmLog.h>

Collaboration diagram for GmTimeMsg:
Collaboration graph
[legend]

Public Member Functions

 GmTimeMsg (const GmLogCategory &logger, QString msg)
 

Private Attributes

QElapsedTimer _timer
 Timer used to measure elapsed time.
 
const GmLogCategory_logger
 The logger used to emmit messages.
 
QString _msg
 Message title.
 

Static Private Attributes

static bool _collectTimeStatistics = false
 A global flag controlling whether we should collect per message statistics. Controled by GmSetCollectTimeStatistics() More...
 
static int _nestLevel = 0
 A global value storing the current nesting level (GmTimeMsg objects created in the scope of another one) More...
 

Friends

GMC_API_EXPORT bool GmSetCollectTimeStatistics (bool)
 Enables or disables the collection of time statistics from messages emmitted with GmTimeMsg.
 
GMC_API_EXPORT void GmLogTimeStatistics (const GmLogCategory &)
 Logs the current contents of the time statistics map using the given logger. Expects to be called from the main thread only.
 

Detailed Description

RAII object used to measure the elapsed time of an operation.

When the object is constructed, a timer is started. On destruction, the elapsed time is measured and a message is printed with gmTimeMsg().

Member Data Documentation

◆ _collectTimeStatistics

bool GmTimeMsg::_collectTimeStatistics = false
staticprivate

A global flag controlling whether we should collect per message statistics. Controled by GmSetCollectTimeStatistics()

The global flag controlling time statistics collection.

◆ _nestLevel

int GmTimeMsg::_nestLevel = 0
staticprivate

A global value storing the current nesting level (GmTimeMsg objects created in the scope of another one)

Nesting level for GmTimeMsg object creations.


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