https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
PerfGuard Class Reference

Scope guard for starting and stopping timing for a node. More...

#include <PerfGuard.h>

Public Member Functions

 PerfGuard (PerfGraph &graph, const PerfID id)
 Start timing for the given ID.
 
 ~PerfGuard ()
 Stop timing.
 

Protected Attributes

PerfGraph_graph
 The graph we're working on.
 

Detailed Description

Scope guard for starting and stopping timing for a node.

Note that the PerfGuard timing itself will take approximately 0.00015 milliseconds.

That might not sound very long - but you still don't want that in the inside of tiny loops

Definition at line 25 of file PerfGuard.h.

Constructor & Destructor Documentation

◆ PerfGuard()

PerfGuard::PerfGuard ( PerfGraph graph,
const PerfID  id 
)

Start timing for the given ID.

Parameters
graphThe graph to add time into
idThe unique id of the section

Definition at line 16 of file PerfGuard.C.

16 : _graph(graph)
17{
18 _graph.push(id);
19#ifdef LIBMESH_HAVE_NVTX_API
20 nvtxRangePushA(moose::internal::getPerfGraphRegistry().sectionInfo(id)._name.c_str());
21#endif
22}
void push(const PerfID id)
Add a Node onto the end of the end of the current callstack.
Definition PerfGraph.C:186
PerfGraph & _graph
The graph we're working on.
Definition PerfGuard.h:43
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.

◆ ~PerfGuard()

PerfGuard::~PerfGuard ( )

Stop timing.

Definition at line 24 of file PerfGuard.C.

25{
26 _graph.pop();
27#ifdef LIBMESH_HAVE_NVTX_API
28 nvtxRangePop();
29#endif
30}
void pop()
Remove a Node from the end of the current scope.
Definition PerfGraph.C:236

Member Data Documentation

◆ _graph

PerfGraph& PerfGuard::_graph
protected

The graph we're working on.

Definition at line 43 of file PerfGuard.h.

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


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