www.mooseframework.org
PerfGraphData.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 "PerfGraphData.h"
11 #include "SubProblem.h"
12 
13 #include "libmesh/system.h"
14 
16 
18 
21 {
23 
24  MooseEnum data_type("SELF CHILDREN TOTAL SELF_AVG CHILDREN_AVG TOTAL_AVG SELF_PERCENT "
25  "CHILDREN_PERCENT TOTAL_PERCENT CALLS");
26 
27  params.addRequiredParam<std::string>("section_name", "The name of the section to get data for");
28 
30  "data_type", data_type, "The type of data to retrieve for the section_name");
31 
32  params.addClassDescription("Retrieves timing information from the PerfGraph.");
33  return params;
34 }
35 
37  : GeneralPostprocessor(parameters),
38  _data_type(getParam<MooseEnum>("data_type")),
39  _section_name(getParam<std::string>("section_name"))
40 {
41 }
42 
43 Real
45 {
46  switch (_data_type)
47  {
48  case 0:
49  case 1:
50  case 2:
51  case 3:
52  case 4:
53  case 5:
54  case 6:
55  case 7:
56  case 8:
57  return _perf_graph.getTime(static_cast<PerfGraph::TimeType>(_data_type), _section_name);
58  case 9:
60  }
61 
62  mooseError("Unknown selection for data_type!");
63 }
PerfGraphInterface::_perf_graph
PerfGraph & _perf_graph
The performance graph to add to.
Definition: PerfGraphInterface.h:67
MooseObject::mooseError
void mooseError(Args &&... args) const
Definition: MooseObject.h:141
registerMooseObject
registerMooseObject("MooseApp", PerfGraphData)
GeneralPostprocessor::validParams
static InputParameters validParams()
Definition: GeneralPostprocessor.C:15
MooseEnum
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
GeneralPostprocessor
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
Definition: GeneralPostprocessor.h:27
PerfGraphData::validParams
static InputParameters validParams()
Definition: PerfGraphData.C:20
PerfGraphData::PerfGraphData
PerfGraphData(const InputParameters &parameters)
Definition: PerfGraphData.C:36
InputParameters::addClassDescription
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
Definition: InputParameters.C:70
PerfGraph::getTime
Real getTime(const TimeType type, const std::string &section_name)
Get a reference to the time for a section.
Definition: PerfGraph.C:90
defineLegacyParams
defineLegacyParams(PerfGraphData)
SubProblem.h
PerfGraphData
Definition: PerfGraphData.h:27
PerfGraphData::_section_name
const std::string & _section_name
Definition: PerfGraphData.h:41
PerfGraphData::_data_type
const int _data_type
Definition: PerfGraphData.h:39
std
Definition: TheWarehouse.h:80
PerfGraphData::getValue
virtual Real getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
Definition: PerfGraphData.C:44
PerfGraphData.h
PerfGraph::getNumCalls
unsigned long int getNumCalls(const std::string &section_name)
Get the number of calls for a section.
Definition: PerfGraph.C:74
InputParameters::addRequiredParam
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
Definition: InputParameters.h:1176