www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PerfGraphInterface Class Reference

Interface for objects interacting with the PerfGraph. More...

#include <PerfGraphInterface.h>

Inheritance diagram for PerfGraphInterface:
[legend]

Public Member Functions

 PerfGraphInterface (const MooseObject *moose_object)
 For objects that are MooseObjects with a default prefix of type() More...
 
 PerfGraphInterface (const MooseObject *moose_object, const std::string prefix)
 For objects that are MooseObjects. More...
 
 PerfGraphInterface (PerfGraph &perf_graph, const std::string prefix="")
 For objects that aren't MooseObjects. More...
 
 PerfGraphInterface (MooseApp &moose_app, const std::string prefix="")
 For objects that construct the PerfGraphInterface before the PerfGraph is initialized (see MooseApp and OutputWarehouse) More...
 
virtual ~PerfGraphInterface ()=default
 
PerfGraphperfGraph ()
 Get the PerfGraph. More...
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 Call to register a named section for timing. More...
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 Call to register a named section for timing. More...
 
std::string timedSectionName (const std::string &section_name) const
 

Protected Attributes

MooseApp_pg_moose_app
 The MooseApp that owns the PerfGraph. More...
 
const std::string _prefix
 A prefix to use for all sections. More...
 

Detailed Description

Interface for objects interacting with the PerfGraph.

Enables getting PerfGraph information and registering PerfGraph timed sections.

Definition at line 59 of file PerfGraphInterface.h.

Constructor & Destructor Documentation

◆ PerfGraphInterface() [1/4]

PerfGraphInterface::PerfGraphInterface ( const MooseObject moose_object)

For objects that are MooseObjects with a default prefix of type()

Definition at line 22 of file PerfGraphInterface.C.

24  "_moose_app", "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
25  _prefix(moose_object->type())
26 {
27 }
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
Base class for MOOSE-based applications.
Definition: MooseApp.h:73
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:51
const std::string _prefix
A prefix to use for all sections.
const InputParameters & parameters() const
Get the parameters of the object.
MooseApp & _pg_moose_app
The MooseApp that owns the PerfGraph.

◆ PerfGraphInterface() [2/4]

PerfGraphInterface::PerfGraphInterface ( const MooseObject moose_object,
const std::string  prefix 
)

For objects that are MooseObjects.

Definition at line 29 of file PerfGraphInterface.C.

31  "_moose_app", "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
32  _prefix(prefix)
33 {
34 }
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
Base class for MOOSE-based applications.
Definition: MooseApp.h:73
const std::string _prefix
A prefix to use for all sections.
const InputParameters & parameters() const
Get the parameters of the object.
MooseApp & _pg_moose_app
The MooseApp that owns the PerfGraph.

◆ PerfGraphInterface() [3/4]

PerfGraphInterface::PerfGraphInterface ( PerfGraph perf_graph,
const std::string  prefix = "" 
)

For objects that aren't MooseObjects.

Definition at line 41 of file PerfGraphInterface.C.

42  : _pg_moose_app(perf_graph.mooseApp()), _prefix(prefix)
43 {
44 }
MooseApp & mooseApp()
Definition: PerfGraph.h:181
const std::string _prefix
A prefix to use for all sections.
MooseApp & _pg_moose_app
The MooseApp that owns the PerfGraph.

◆ PerfGraphInterface() [4/4]

PerfGraphInterface::PerfGraphInterface ( MooseApp moose_app,
const std::string  prefix = "" 
)

For objects that construct the PerfGraphInterface before the PerfGraph is initialized (see MooseApp and OutputWarehouse)

Definition at line 36 of file PerfGraphInterface.C.

37  : _pg_moose_app(moose_app), _prefix(prefix)
38 {
39 }
const std::string _prefix
A prefix to use for all sections.
MooseApp & _pg_moose_app
The MooseApp that owns the PerfGraph.

◆ ~PerfGraphInterface()

virtual PerfGraphInterface::~PerfGraphInterface ( )
virtualdefault

Member Function Documentation

◆ perfGraph()

PerfGraph & PerfGraphInterface::perfGraph ( )

Get the PerfGraph.

Definition at line 78 of file PerfGraphInterface.C.

Referenced by CommonOutputAction::act(), PerfGraphData::finalize(), and PerfGraphOutput::output().

79 {
80  return _pg_moose_app.perfGraph();
81 }
MooseApp & _pg_moose_app
The MooseApp that owns the PerfGraph.
PerfGraph & perfGraph()
Get the PerfGraph for this app.
Definition: MooseApp.h:133

◆ registerTimedSection() [1/2]

PerfID PerfGraphInterface::registerTimedSection ( const std::string &  section_name,
const unsigned int  level 
) const
protected

Call to register a named section for timing.

Parameters
section_nameThe name of the code section to be timed
levelThe importance of the timer - lower is more important (0 will always come out)
Returns
The ID of the section - use when starting timing

Definition at line 53 of file PerfGraphInterface.C.

55 {
56  const auto timed_section_name = timedSectionName(section_name);
57  if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
58  return moose::internal::getPerfGraphRegistry().registerSection(timed_section_name, level);
59  else
60  return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
61 }
PerfID registerSection(const std::string &section_name, const unsigned int level)
Call to register a named section for timing.
std::string timedSectionName(const std::string &section_name) const
PerfID sectionID(const std::string &section_name) const
Given a name return the PerfID The name of the section.
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.

◆ registerTimedSection() [2/2]

PerfID PerfGraphInterface::registerTimedSection ( const std::string &  section_name,
const unsigned int  level,
const std::string &  live_message,
const bool  print_dots = true 
) const
protected

Call to register a named section for timing.

Parameters
section_nameThe name of the code section to be timed
levelThe importance of the timer - lower is more important (0 will always come out)
live_messageThe message to be printed to the screen during execution
print_dotsWhether or not progress dots should be printed for this section
Returns
The ID of the section - use when starting timing

Definition at line 64 of file PerfGraphInterface.C.

68 {
69  const auto timed_section_name = timedSectionName(section_name);
70  if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
72  timedSectionName(section_name), level, live_message, print_dots);
73  else
74  return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
75 }
PerfID registerSection(const std::string &section_name, const unsigned int level)
Call to register a named section for timing.
std::string timedSectionName(const std::string &section_name) const
PerfID sectionID(const std::string &section_name) const
Given a name return the PerfID The name of the section.
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.

◆ timedSectionName()

std::string PerfGraphInterface::timedSectionName ( const std::string &  section_name) const
protected
Returns
The name of the timed section with the name section_name.

Optionally adds a prefix if one is defined.

Definition at line 47 of file PerfGraphInterface.C.

Referenced by registerTimedSection().

48 {
49  return _prefix.empty() ? "" : (_prefix + "::") + section_name;
50 }
const std::string _prefix
A prefix to use for all sections.

◆ validParams()

InputParameters PerfGraphInterface::validParams ( )
static

Definition at line 16 of file PerfGraphInterface.C.

17 {
19  return params;
20 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters emptyInputParameters()

Member Data Documentation

◆ _pg_moose_app

MooseApp& PerfGraphInterface::_pg_moose_app
protected

The MooseApp that owns the PerfGraph.

Definition at line 124 of file PerfGraphInterface.h.

Referenced by perfGraph().

◆ _prefix

const std::string PerfGraphInterface::_prefix
protected

A prefix to use for all sections.

Definition at line 127 of file PerfGraphInterface.h.

Referenced by timedSectionName().


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