libMesh
Public Member Functions | Private Attributes | List of all members
libMesh::PerfItem Struct Reference

Used for logging something that naturally lasts as long as some enclosing scope, such as the current function. More...

#include <libmesh_logging.h>

Public Member Functions

 PerfItem (const char *label, const char *header, bool enabled=true)
 
 ~PerfItem ()
 

Private Attributes

const char * _label
 
const char * _header
 
bool _enabled
 

Detailed Description

Used for logging something that naturally lasts as long as some enclosing scope, such as the current function.

Makes it very easy to handle multiple return scenarios, since the event is popped in the destructor. Should not be used directly, instead use the LOG_SCOPE macro, which resolves to nothing at compile time if logging is disabled.

Author
John Peterson
Date
2016

Definition at line 64 of file libmesh_logging.h.

Constructor & Destructor Documentation

libMesh::PerfItem::PerfItem ( const char *  label,
const char *  header,
bool  enabled = true 
)

Definition at line 66 of file libmesh_logging.h.

References _enabled, libMesh::PerfLog::fast_push(), and libMesh::perflog.

68  :
69  _label(label),
70  _header(header),
71  _enabled(enabled)
72  {
73  if (_enabled)
74  libMesh::perflog.fast_push(label, header);
75  }
void fast_push(const char *label, const char *header="")
Push the event label onto the stack, pausing any active event.
Definition: perf_log.h:466
const char * _header
const char * _label
PerfLog perflog
A PerfLog object to log performance.
libMesh::PerfItem::~PerfItem ( )

Definition at line 77 of file libmesh_logging.h.

References _enabled, _header, _label, libMesh::PerfLog::fast_pop(), and libMesh::perflog.

78  {
79  if (_enabled)
81  }
const char * _header
void fast_pop(const char *label, const char *header="")
Pop the event label off the stack, resuming any lower event.
Definition: perf_log.h:486
const char * _label
PerfLog perflog
A PerfLog object to log performance.

Member Data Documentation

bool libMesh::PerfItem::_enabled
private

Definition at line 86 of file libmesh_logging.h.

Referenced by PerfItem(), and ~PerfItem().

const char* libMesh::PerfItem::_header
private

Definition at line 85 of file libmesh_logging.h.

Referenced by ~PerfItem().

const char* libMesh::PerfItem::_label
private

Definition at line 84 of file libmesh_logging.h.

Referenced by ~PerfItem().


The documentation for this struct was generated from the following file: