www.mooseframework.org
PerfGraphInterface.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #include "PerfGraphInterface.h"
11 
12 #include "MooseApp.h"
13 
14 template <>
17 {
19  return params;
20 }
21 
23  : _pg_params(&moose_object->parameters()),
24  _perf_graph(
25  _pg_params
26  ->getCheckedPointerParam<MooseApp *>(
27  "_moose_app", "PerfGraphInterface is unable to retrieve the MooseApp pointer!")
28  ->perfGraph()),
29  _prefix(moose_object->type())
30 {
31 }
32 
33 PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object, const std::string prefix)
34  : _pg_params(&moose_object->parameters()),
35  _perf_graph(
36  _pg_params
37  ->getCheckedPointerParam<MooseApp *>(
38  "_moose_app", "PerfGraphInterface is unable to retrieve the MooseApp pointer!")
39  ->perfGraph()),
40  _prefix(prefix)
41 {
42 }
43 
44 PerfGraphInterface::PerfGraphInterface(PerfGraph & perf_graph, const std::string prefix)
45  : _perf_graph(perf_graph), _prefix(prefix)
46 {
47 }
48 
49 PerfID
50 PerfGraphInterface::registerTimedSection(const std::string & section_name, const unsigned int level)
51 {
52  if (_prefix != "")
53  return _perf_graph.registerSection(_prefix + "::" + section_name, level);
54  else
55  return _perf_graph.registerSection(section_name, level);
56 }
PerfID registerTimedSection(const std::string &section_name, const unsigned int level)
Call to register a named section for timing.
InputParameters validParams< PerfGraphInterface >()
Base class for MOOSE-based applications.
Definition: MooseApp.h:59
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
PerfGraph & _perf_graph
The performance graph to add to.
InputParameters emptyInputParameters()
unsigned int PerfID
Definition: MooseTypes.h:163
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
std::string _prefix
A prefix to use for all sections.
MatType type
PerfGraphInterface(const MooseObject *moose_object)
For objects that are MooseObjects with a default prefix of type()
PerfID registerSection(const std::string &section_name, unsigned int level)
Registers a named section of code.
Definition: PerfGraph.C:42
The PerfGraph will hold the master list of all registered performance segments and the head PerfNode...
Definition: PerfGraph.h:34