libMesh
Loading...
Searching...
No Matches
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, bool per_entity=false)
 
 ~PerfItem ()
 

Private Attributes

const char * _label
 
const char * _header
 
bool _enabled
 
PerfLog & _perflog
 
bool _per_entity
 Whether the event fires once per mesh entity or more often; see PerfLog::fast_push().
 

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,
bool  per_entity = false 
)
inline

Definition at line 66 of file libmesh_logging.h.

70 :
71 _label(label),
72 _header(header),
73 _enabled(enabled),
74 _perflog(*my_perflog),
75 _per_entity(per_entity)
76 {
77 if (_enabled)
78 _perflog.fast_push(label, header, _per_entity);
79 }
void fast_push(const char *label, const char *header="", bool per_entity=false)
Push the event label onto the stack, pausing any active event.
Definition perf_log.h:515
const char * _header
const char * _label
bool _per_entity
Whether the event fires once per mesh entity or more often; see PerfLog::fast_push().

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

◆ ~PerfItem()

libMesh::PerfItem::~PerfItem ( )
inline

Definition at line 81 of file libmesh_logging.h.

82 {
83 if (_enabled)
85 }
void fast_pop(const char *label, const char *header="", bool per_entity=false) noexcept
Pop the event label off the stack, resuming any lower event.
Definition perf_log.h:558

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

Member Data Documentation

◆ _enabled

bool libMesh::PerfItem::_enabled
private

Definition at line 90 of file libmesh_logging.h.

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

◆ _header

const char* libMesh::PerfItem::_header
private

Definition at line 89 of file libmesh_logging.h.

Referenced by ~PerfItem().

◆ _label

const char* libMesh::PerfItem::_label
private

Definition at line 88 of file libmesh_logging.h.

Referenced by ~PerfItem().

◆ _per_entity

bool libMesh::PerfItem::_per_entity
private

Whether the event fires once per mesh entity or more often; see PerfLog::fast_push().

Definition at line 97 of file libmesh_logging.h.

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

◆ _perflog

PerfLog& libMesh::PerfItem::_perflog
private

Definition at line 91 of file libmesh_logging.h.

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


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