https://mooseframework.inl.gov
PerfGuard.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "MooseTypes.h"
13 #include "PerfGraph.h"
14 
24 class PerfGuard
25 {
26 public:
33  PerfGuard(PerfGraph & graph, const PerfID id) : _graph(graph) { _graph.push(id); }
34 
39 
40 protected:
43 };
PerfGuard(PerfGraph &graph, const PerfID id)
Start timing for the given ID.
Definition: PerfGuard.h:33
unsigned int PerfID
Definition: MooseTypes.h:212
Scope guard for starting and stopping timing for a node.
Definition: PerfGuard.h:24
~PerfGuard()
Stop timing.
Definition: PerfGuard.h:38
void pop()
Remove a Node from the end of the current scope.
Definition: PerfGraph.C:231
PerfGraph & _graph
The graph we're working on.
Definition: PerfGuard.h:42
void push(const PerfID id)
Add a Node onto the end of the end of the current callstack.
Definition: PerfGraph.C:185
The PerfGraph will hold the master list of all registered performance segments and the head PerfNode...
Definition: PerfGraph.h:43