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