libMesh::PerfItem Struct Reference

#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

◆ PerfItem()

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

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="")
Definition: perf_log.h:466
PerfLog perflog("libMesh", #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING true #else false #endif)
const char * _header
const char * _label

◆ ~PerfItem()

libMesh::PerfItem::~PerfItem ( )
inline

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  }
PerfLog perflog("libMesh", #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING true #else false #endif)
const char * _header
void fast_pop(const char *label, const char *header="")
Definition: perf_log.h:486
const char * _label

Member Data Documentation

◆ _enabled

bool libMesh::PerfItem::_enabled
private

Definition at line 86 of file libmesh_logging.h.

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

◆ _header

const char* libMesh::PerfItem::_header
private

Definition at line 85 of file libmesh_logging.h.

Referenced by ~PerfItem().

◆ _label

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: