www.mooseframework.org
PerfGraphOutput.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 // Moose includes
11 #include "PerfGraphOutput.h"
12 #include "MooseApp.h"
15 #include "ConsoleUtils.h"
16 
18 
19 template <>
22 {
23  // Get the base class parameters
25 
26  // Hide/show variable output options
27  params.addParam<std::vector<VariableName>>(
28  "hide",
29  "A list of the variables and postprocessors that should NOT be output to the"
30  "file (may include Variables, ScalarVariables, and Postprocessor names).");
31 
32  params.set<ExecFlagEnum>("execute_on") = {EXEC_FINAL};
33 
34  params.addParam<unsigned int>(
35  "level", 1, "The level of detail to output. Higher levels will yield more detail.");
36 
37  params.addParam<bool>("heaviest_branch",
38  false,
39  "Whether or not to print out the trace through the code that took the "
40  "longest amount of time");
41 
42  params.addParam<unsigned int>("heaviest_sections",
43  0,
44  "The number of sections to print out showing the parts of the code "
45  "that take the most time. When '0' it won't print at all.");
46 
47  params.addClassDescription("Controls output of the PerfGraph: the performance log for MOOSE");
48 
49  // Return the InputParameters
50  return params;
51 }
52 
54  : Output(parameters),
55  _level(getParam<unsigned int>("level")),
56  _heaviest_branch(getParam<bool>("heaviest_branch")),
57  _heaviest_sections(getParam<unsigned int>("heaviest_sections"))
58 {
59 }
60 
61 bool
63 {
64  // We don't want the Perflog to get dumped at odd times. Ignore the FORCED flag.
65  return _execute_on.contains(type);
66 }
67 
68 void
70 {
71  if (!_app.getParam<bool>("no_timing"))
72  {
74 
75  if (_heaviest_branch)
77 
80  }
81 }
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:24
ExecFlagEnum _execute_on
The common Execution types; this is used as the default execution type for everything except system i...
Definition: Output.h:185
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
unsigned int _level
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual bool shouldOutput(const ExecFlagType &type) override
Handles logic for determining if a step should be output.
registerMooseObject("MooseApp", PerfGraphOutput)
const std::string & type() const
Get the type of this object.
Definition: MooseObject.h:53
Based class for output objects.
Definition: Output.h:41
bool contains(const std::string &value) const
Contains methods for seeing if a value is in the MultiMooseEnum.
virtual void output(const ExecFlagType &type) override
Overload this function with the desired output activities.
InputParameters validParams< Output >()
Definition: Output.C:29
void print(const ConsoleStream &console, unsigned int level)
Print the tree out.
Definition: PerfGraph.C:334
const T & getParam(const std::string &name)
Retrieve a parameter for the object.
Definition: MooseApp.h:935
MatType type
void printHeaviestBranch(const ConsoleStream &console)
Print out the heaviest branch through the tree.
Definition: PerfGraph.C:371
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:21
MooseApp & _app
The MooseApp this object is associated with.
Definition: MooseObject.h:177
unsigned int _heaviest_sections
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...
PerfGraphOutput(const InputParameters &parameters)
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
Class for output information regarding Controls to the screen.
void printHeaviestSections(const ConsoleStream &console, const unsigned int num_sections)
Print out the heaviest sections that were timed.
Definition: PerfGraph.C:408
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
InputParameters validParams< PerfGraphOutput >()
const ExecFlagType EXEC_FINAL
PerfGraph & perfGraph()
Get the PerfGraph for this app.
Definition: MooseApp.h:104