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, PerfLog *my_perflog=&perflog)
 
 ~PerfItem ()
 

Private Attributes

const char * _label
 
const char * _header
 
bool _enabled
 
PerfLog_perflog
 

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,
PerfLog my_perflog = &perflog 
)
inline

Definition at line 66 of file libmesh_logging.h.

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

69  :
70  _label(label),
71  _header(header),
72  _enabled(enabled),
73  _perflog(*my_perflog)
74  {
75  if (_enabled)
76  _perflog.fast_push(label, header);
77  }
void fast_push(const char *label, const char *header="")
Push the event label onto the stack, pausing any active event.
Definition: perf_log.h:494
const char * _header
const char * _label

◆ ~PerfItem()

libMesh::PerfItem::~PerfItem ( )
inline

Definition at line 79 of file libmesh_logging.h.

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

80  {
81  if (_enabled)
83  }
const char * _header
void fast_pop(const char *label, const char *header="") noexcept
Pop the event label off the stack, resuming any lower event.
Definition: perf_log.h:514
const char * _label

Member Data Documentation

◆ _enabled

bool libMesh::PerfItem::_enabled
private

Definition at line 88 of file libmesh_logging.h.

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

◆ _header

const char* libMesh::PerfItem::_header
private

Definition at line 87 of file libmesh_logging.h.

Referenced by ~PerfItem().

◆ _label

const char* libMesh::PerfItem::_label
private

Definition at line 86 of file libmesh_logging.h.

Referenced by ~PerfItem().

◆ _perflog

PerfLog& libMesh::PerfItem::_perflog
private

Definition at line 89 of file libmesh_logging.h.

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


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