https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
PerfGraph Class Reference

The PerfGraph will hold the master list of all registered performance segments and the head PerfNode. More...

#include <PerfGraph.h>

Inheritance diagram for PerfGraph:
[legend]

Classes

struct  CumulativeSectionInfo
 Use to hold the cumulative time and memory for each section, which comes from all of the PerfNodes that contribute to said section. More...
 
class  SectionIncrement
 Use to hold an increment of time and memory for a section This is used in the LivePrint capability. More...
 

Public Types

enum  DataType {
  SELF , CHILDREN , TOTAL , SELF_AVG ,
  CHILDREN_AVG , TOTAL_AVG , SELF_PERCENT , CHILDREN_PERCENT ,
  TOTAL_PERCENT , SELF_MEMORY , CHILDREN_MEMORY , TOTAL_MEMORY ,
  CALLS
}
 For retrieving values. More...
 
using PerfGraphRegistry = moose::internal::PerfGraphRegistry
 

Public Member Functions

 PerfGraph (const std::string &root_name, MooseApp &app, const bool live_all, const bool perf_graph_live)
 Create a new PerfGraph.
 
 ~PerfGraph ()
 Destructor.
 
void print (const ConsoleStream &console, unsigned int level)
 Print the tree out.
 
void printHeaviestBranch (const ConsoleStream &console)
 Print out the heaviest branch through the tree.
 
void printHeaviestSections (const ConsoleStream &console, const unsigned int num_sections)
 Print out the heaviest sections that were timed.
 
bool active () const
 Whether or not timing is active.
 
void setActive (bool active)
 Turn on or off timing.
 
void enableLivePrint ()
 Enables Live Print.
 
void disableLivePrint ()
 Completely disables Live Print (cannot be restarted)
 
void setLivePrintAll (bool active)
 Forces all sections to be output live.
 
void setLiveTimeLimit (Real time_limit)
 Set the time limit before a message prints.
 
void setLiveMemoryLimit (unsigned int mem_limit)
 Sert the memory limit before a message prints.
 
Real sectionData (const DataType type, const std::string &section_name, const bool must_exist=true)
 Gets a PerfGraph result pertaining to a section.
 
void update ()
 Updates the time section_time and time for all currently running nodes.
 
std::size_t getMaxMemory () const
 Get the maximum memory allocation in MB.
 
MooseAppmooseApp ()
 
const PerfNoderootNode () const
 
template<typename Functor >
void treeRecurse (const Functor &act, const unsigned int level=MOOSE_MAX_STACK_SIZE, const bool heaviest=false) const
 

Static Public Member Functions

static MooseEnum dataTypeEnum ()
 DataType in a MooseEnum for use in InputParameters in objects that query the PerfGraph with sectionData.
 

Protected Types

enum  IncrementState { STARTED , PRINTED , FINISHED }
 The execution state of an increment. More...
 
typedef VariadicTable< std::string, unsigned long int, Real, Real, Real, long int, Real, Real, Real, long intFullTable
 
typedef VariadicTable< std::string, unsigned long int, Real, Real, Real, long intHeaviestTable
 

Protected Member Functions

void addToExecutionList (const PerfID id, const IncrementState state, const std::chrono::time_point< std::chrono::steady_clock > time, const long int memory)
 Add the information to the execution list.
 
void push (const PerfID id)
 Add a Node onto the end of the end of the current callstack.
 
void pop ()
 Remove a Node from the end of the current scope.
 
void recursivelyUpdate (const PerfNode &current_node)
 Updates the cumulative self/children/total time and memory for each section across all nodes that contribute to said section in _cumulative_section_info.
 

Protected Attributes

MooseApp_moose_app
 The MooseApp.
 
bool _live_print_all
 Whether or not to put everything in the perf graph.
 
bool _disable_live_print
 Whether or not live print is disabled (cannot be turned on again)
 
PerfGraphRegistry_perf_graph_registry
 The PerfGraphRegistry.
 
const libMesh::processor_id_type _pid
 This processor id.
 
const std::string _root_name
 Name of the root node.
 
const PerfID _root_node_id
 The id for the root node.
 
const std::unique_ptr< PerfNode_root_node
 The root node of the graph.
 
int _current_position
 The current node position in the stack.
 
std::array< PerfNode *, MOOSE_MAX_STACK_SIZE > _stack
 The full callstack. Currently capped at a depth of 100.
 
std::array< SectionIncrement, MAX_EXECUTION_LIST_SIZE > _execution_list
 A circular buffer for holding the execution list, this is read by the printing loop.
 
std::atomic< unsigned int_execution_list_begin
 Where the print thread should start reading the execution list.
 
std::atomic< unsigned int_execution_list_end
 Where the print thread should stop reading the execution list.
 
std::unordered_map< std::string, CumulativeSectionInfo_cumulative_section_info
 The cumulative time and memory for each section.
 
std::vector< CumulativeSectionInfo * > _cumulative_section_info_ptrs
 Pointers into _cumulative_section_info indexed on PerfID This is here for convenience and speed so we don't need to iterate over the above map much - and it makes it easier to sort.
 
std::atomic< std::size_t > _max_memory
 Maximum memory encountered during push and pop.
 
bool _active
 Whether or not timing is active.
 
std::promise< bool > _done
 The promise to the print thread that will signal when to stop.
 
bool _destructing
 Tell the print thread to teardown.
 
std::mutex _destructing_mutex
 The mutex to use with a condition_variable predicate to guard _destructing.
 
std::condition_variable _finished_section
 The condition_variable to wake the print thread.
 
std::atomic< Real > _live_print_time_limit
 The time limit before a message is printed (in seconds)
 
std::atomic< unsigned int_live_print_mem_limit
 The memory limit before a message is printed (in MB)
 
const std::unique_ptr< PerfGraphLivePrint_live_print
 The object that is doing live printing.
 
std::thread _print_thread
 The thread for printing sections as they execute.
 
const ConsoleStream _console
 An instance of helper class to write streams to the Console objects.
 

Private Member Functions

FullTable treeTable (const unsigned int level, const bool heaviest=false)
 Helper for building a VariadicTable that represents the tree.
 
template<typename Functor >
void treeRecurseInternal (const PerfNode &node, const Functor &act, const unsigned int level, const bool heaviest, unsigned int current_depth) const
 
void updateMaxMemory (const std::size_t current_memory)
 Update _max_memory if current_memory > _max_memory.
 

Friends

class PerfGuard
 
class PerfGraphLivePrint
 
void dataStore (std::ostream &, PerfGraph &, void *)
 
void dataLoad (std::istream &, PerfGraph &, void *)
 

Detailed Description

The PerfGraph will hold the master list of all registered performance segments and the head PerfNode.

Definition at line 43 of file PerfGraph.h.

Member Typedef Documentation

◆ FullTable

typedef VariadicTable<std::string, unsigned long int, Real, Real, Real, long int, Real, Real, Real, long int> PerfGraph::FullTable
protected

Definition at line 211 of file PerfGraph.h.

◆ HeaviestTable

typedef VariadicTable<std::string, unsigned long int, Real, Real, Real, long int> PerfGraph::HeaviestTable
protected

Definition at line 213 of file PerfGraph.h.

◆ PerfGraphRegistry

Definition at line 46 of file PerfGraph.h.

Member Enumeration Documentation

◆ DataType

For retrieving values.

Enumerator
SELF 
CHILDREN 
TOTAL 
SELF_AVG 
CHILDREN_AVG 
TOTAL_AVG 
SELF_PERCENT 
CHILDREN_PERCENT 
TOTAL_PERCENT 
SELF_MEMORY 
CHILDREN_MEMORY 
TOTAL_MEMORY 
CALLS 

Definition at line 51 of file PerfGraph.h.

◆ IncrementState

enum PerfGraph::IncrementState
protected

The execution state of an increment.

Enumerator
STARTED 

Section just started running.

PRINTED 

This section has already started printing.

FINISHED 

The section is complete.

Definition at line 248 of file PerfGraph.h.

249 {
251 STARTED,
252
254 PRINTED,
255
258 };
@ PRINTED
This section has already started printing.
Definition PerfGraph.h:254
@ FINISHED
The section is complete.
Definition PerfGraph.h:257
@ STARTED
Section just started running.
Definition PerfGraph.h:251

Constructor & Destructor Documentation

◆ PerfGraph()

PerfGraph::PerfGraph ( const std::string &  root_name,
MooseApp app,
const bool  live_all,
const bool  perf_graph_live 
)

Create a new PerfGraph.

Parameters
root_nameThe name of the root node
appThe MooseApp this PerfGraph is for
live_allWhether every message should be printed
perf_graph_liveEnable/disable PerfGraphLive (permanently)

Definition at line 28 of file PerfGraph.C.

33 _moose_app(app),
34 _live_print_all(live_all),
35 _disable_live_print(!perf_graph_live),
37 _pid(app.comm().rank()),
38 _root_name(root_name),
40 _root_node(std::make_unique<PerfNode>(_root_node_id)),
42 _stack(),
45 _max_memory(0),
46 _active(true),
47 _destructing(false),
50 _live_print(std::make_unique<PerfGraphLivePrint>(*this, app))
51{
53}
An inteface for the _console for outputting to the Console object.
PerfGraphRegistry & _perf_graph_registry
The PerfGraphRegistry.
Definition PerfGraph.h:344
std::atomic< Real > _live_print_time_limit
The time limit before a message is printed (in seconds)
Definition PerfGraph.h:409
std::atomic< unsigned int > _execution_list_begin
Where the print thread should start reading the execution list.
Definition PerfGraph.h:368
const PerfID _root_node_id
The id for the root node.
Definition PerfGraph.h:353
std::atomic< unsigned int > _live_print_mem_limit
The memory limit before a message is printed (in MB)
Definition PerfGraph.h:412
bool _active
Whether or not timing is active.
Definition PerfGraph.h:394
const std::unique_ptr< PerfGraphLivePrint > _live_print
The object that is doing live printing.
Definition PerfGraph.h:415
const libMesh::processor_id_type _pid
This processor id.
Definition PerfGraph.h:347
std::atomic< std::size_t > _max_memory
Maximum memory encountered during push and pop.
Definition PerfGraph.h:391
int _current_position
The current node position in the stack.
Definition PerfGraph.h:359
MooseApp & _moose_app
The MooseApp.
Definition PerfGraph.h:335
const std::unique_ptr< PerfNode > _root_node
The root node of the graph.
Definition PerfGraph.h:356
std::atomic< unsigned int > _execution_list_end
Where the print thread should stop reading the execution list.
Definition PerfGraph.h:371
std::array< PerfNode *, MOOSE_MAX_STACK_SIZE > _stack
The full callstack. Currently capped at a depth of 100.
Definition PerfGraph.h:362
void push(const PerfID id)
Add a Node onto the end of the end of the current callstack.
Definition PerfGraph.C:186
bool _disable_live_print
Whether or not live print is disabled (cannot be turned on again)
Definition PerfGraph.h:341
bool _live_print_all
Whether or not to put everything in the perf graph.
Definition PerfGraph.h:338
bool _destructing
Tell the print thread to teardown.
Definition PerfGraph.h:400
const std::string _root_name
Name of the root node.
Definition PerfGraph.h:350
processor_id_type rank() const
const Parallel::Communicator & comm() const
PerfID registerSection(const std::string &section_name, const unsigned int level)
Call to register a named section for timing.
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.

◆ ~PerfGraph()

PerfGraph::~PerfGraph ( )

Destructor.

Definition at line 55 of file PerfGraph.C.

void disableLivePrint()
Completely disables Live Print (cannot be restarted)
Definition PerfGraph.C:68

Member Function Documentation

◆ active()

bool PerfGraph::active ( ) const
inline

Whether or not timing is active.

When not active no timing information will be kept

Definition at line 124 of file PerfGraph.h.

124{ return _active; }

Referenced by setActive(), and setLivePrintAll().

◆ addToExecutionList()

void PerfGraph::addToExecutionList ( const PerfID  id,
const IncrementState  state,
const std::chrono::time_point< std::chrono::steady_clock >  time,
const long int  memory 
)
inlineprotected

Add the information to the execution list.

Should only be called by push() and pop()

Definition at line 155 of file PerfGraph.C.

159{
160 auto & section_increment = _execution_list[_execution_list_end];
161
162 section_increment._id = id;
163 section_increment._state = state;
164 section_increment._time = time;
165 section_increment._memory = memory;
166 section_increment._beginning_num_printed = _console.numPrinted();
167
168 // A note about this next section of code:
169 // It is only EVER run on the main thread - and therefore there can be
170 // no race conditions. All that is important here is that the print
171 // thread always sees a consistent value for _execution_list_end
172 auto next_execution_list_end = _execution_list_end + 1;
173
174 // Are we at the end of our circular buffer?
175 if (next_execution_list_end >= MAX_EXECUTION_LIST_SIZE)
176 next_execution_list_end = 0;
177
178 // This "release" will synchronize the above memory changes with the
179 // "acquire" in the printing thread
180 // All of the above memory operations will be seen by the
181 // printing thread before the printing thread sees this new value
182 _execution_list_end.store(next_execution_list_end, std::memory_order_release);
183}
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
unsigned long long int numPrinted() const
The number of times something has been printed.
std::array< SectionIncrement, MAX_EXECUTION_LIST_SIZE > _execution_list
A circular buffer for holding the execution list, this is read by the printing loop.
Definition PerfGraph.h:365

Referenced by pop(), and push().

◆ dataTypeEnum()

static MooseEnum PerfGraph::dataTypeEnum ( )
inlinestatic

DataType in a MooseEnum for use in InputParameters in objects that query the PerfGraph with sectionData.

Definition at line 72 of file PerfGraph.h.

73 {
74 return MooseEnum(
75 "SELF CHILDREN TOTAL SELF_AVG CHILDREN_AVG TOTAL_AVG SELF_PERCENT CHILDREN_PERCENT "
76 "TOTAL_PERCENT SELF_MEMORY CHILDREN_MEMORY TOTAL_MEMORY CALLS");
77 }
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55

Referenced by PerfGraphData::validParams().

◆ disableLivePrint()

void PerfGraph::disableLivePrint ( )

Completely disables Live Print (cannot be restarted)

Definition at line 68 of file PerfGraph.C.

69{
70 if (_pid == 0 && !_disable_live_print)
71 {
72 {
73 // Unlike using atomics for execution_thread_end
74 // here we actually lock to ensure that either the print thread
75 // immediately sees that we are destructing or is immediately
76 // notified with the below notification. Without doing this
77 // it would be possible (but unlikely) for the print thread to
78 // hang for 1 second at the end of execution (which would not be
79 // good anytime you are running lots of fast calculations back-to-back
80 // like during testing or stochastic sampling).
81 std::lock_guard<std::mutex> lock(_destructing_mutex);
82 _destructing = true;
83 }
84
85 _finished_section.notify_one();
86
87 _print_thread.join();
88
90 }
91}
std::condition_variable _finished_section
The condition_variable to wake the print thread.
Definition PerfGraph.h:406
std::mutex _destructing_mutex
The mutex to use with a condition_variable predicate to guard _destructing.
Definition PerfGraph.h:403
std::thread _print_thread
The thread for printing sections as they execute.
Definition PerfGraph.h:418

Referenced by CommonOutputAction::act(), MooseApp::setupOptions(), and ~PerfGraph().

◆ enableLivePrint()

void PerfGraph::enableLivePrint ( )

Enables Live Print.

Definition at line 58 of file PerfGraph.C.

59{
60 if (_pid == 0 && !_disable_live_print)
61 {
62 // Start the printing thread
63 _print_thread = std::thread([this] { this->_live_print->start(); });
64 }
65}

◆ getMaxMemory()

std::size_t PerfGraph::getMaxMemory ( ) const
inline

Get the maximum memory allocation in MB.

This is thread safe.

Definition at line 183 of file PerfGraph.h.

183{ return _max_memory; }

Referenced by updateMaxMemory().

◆ mooseApp()

MooseApp & PerfGraph::mooseApp ( )
inline
Returns
The MooseApp

Definition at line 188 of file PerfGraph.h.

188{ return _moose_app; }

◆ pop()

void PerfGraph::pop ( )
protected

Remove a Node from the end of the current scope.

Note: only accessible by using PerfGuard!

Definition at line 236 of file PerfGraph.C.

237{
238 if (!_active)
239 return;
240
241 auto current_time = std::chrono::steady_clock::now();
242
243 auto & current_node = _stack[_current_position];
244
245 MemoryUtils::Stats stats;
246 auto memory_success = MemoryUtils::getMemoryStats(stats);
247
248 long int current_memory = 0;
249
250 if (memory_success)
251 {
252 const auto memory_mb =
254 current_memory = memory_mb;
255 updateMaxMemory(memory_mb);
256 }
257 // If we weren't able to get the memory stats, let's just use the start memory
258 else if (_current_position !=
259 -1) // If we weren't able to get the memory stats, let's just use the start memory
260 current_memory = _stack[_current_position]->startMemory();
261
262 current_node->addTimeAndMemory(current_time, current_memory);
263
265
266 // Add this to the exection list
267 if ((_pid == 0 && !_disable_live_print) &&
268 (!_perf_graph_registry.readSectionInfo(current_node->id())._live_message.empty() ||
270 {
271 addToExecutionList(current_node->id(), IncrementState::FINISHED, current_time, current_memory);
272
273 // Tell the printing thread that a section has finished
274 //
275 // Note: no mutex is needed here because we're using an atomic
276 // in the predicate of the condition_variable in the thread
277 // This is technically correct - but there is a chance of missing a signal
278 // For us - that chance is low and doesn't matter (the timeout will just be hit
279 // instead). So - I would rather not have an extra lock here in the main thread.
280 _finished_section.notify_one();
281 }
282}
void updateMaxMemory(const std::size_t current_memory)
Update _max_memory if current_memory > _max_memory.
Definition PerfGraph.C:500
void addToExecutionList(const PerfID id, const IncrementState state, const std::chrono::time_point< std::chrono::steady_clock > time, const long int memory)
Add the information to the execution list.
Definition PerfGraph.C:155
const PerfGraphSectionInfo & readSectionInfo(PerfID section_id) const
Special accessor just for PerfGraph so that no locking is needed in PerfGraph.
std::string _live_message
Message to print while the section is running.
std::size_t convertBytes(std::size_t bytes, MemUnits unit)
convert bytes to selected unit prefix
bool getMemoryStats(Stats &stats)
get all memory stats for the current process stats The Stats object to fill with the data
Definition MemoryUtils.C:79
std::size_t _physical_memory
Definition MemoryUtils.h:23

Referenced by PerfGuard::~PerfGuard().

◆ print()

void PerfGraph::print ( const ConsoleStream console,
unsigned int  level 
)

Print the tree out.

Parameters
consoleThe output stream to output to
levelThe log level, the higher the number the more output you get

Definition at line 416 of file PerfGraph.C.

417{
418 console << "\nPerformance Graph:\n";
419 treeTable(level).print(console);
420}
FullTable treeTable(const unsigned int level, const bool heaviest=false)
Helper for building a VariadicTable that represents the tree.
Definition PerfGraph.C:353
void print(StreamType &stream)
Pretty print the table of data.

Referenced by PerfGraphOutput::output().

◆ printHeaviestBranch()

void PerfGraph::printHeaviestBranch ( const ConsoleStream console)

Print out the heaviest branch through the tree.

Parameters
consoleThe output stream to output to

Definition at line 423 of file PerfGraph.C.

424{
425 console << "\nHeaviest Branch:\n";
426 treeTable(MOOSE_MAX_STACK_SIZE, /* heaviest = */ true).print(console);
427}

Referenced by PerfGraphOutput::output().

◆ printHeaviestSections()

void PerfGraph::printHeaviestSections ( const ConsoleStream console,
const unsigned int  num_sections 
)

Print out the heaviest sections that were timed.

Parameters
consoleThe output stream to output to

Definition at line 430 of file PerfGraph.C.

431{
432 update();
433
434 console << "\nHeaviest Sections:\n";
435
436 // Indirect Sort The Self Time
437 std::vector<size_t> sorted;
440 sorted,
441 [](CumulativeSectionInfo * lhs, CumulativeSectionInfo * rhs)
442 {
443 if (lhs && rhs)
444 return lhs->_self > rhs->_self;
445
446 // If the LHS exists - it's definitely bigger than a non-existant RHS
447 if (lhs)
448 return true;
449
450 // Both don't exist - so it doesn't matter how we sort them
451 return false;
452 });
453
454 HeaviestTable vtable({"Section", "Calls", "Self(s)", "Avg.", "%", "Mem(MB)"}, 10);
455
456 vtable.setColumnFormat({VariadicTableColumnFormat::AUTO, // Section; doesn't matter
462 );
463
464 vtable.setColumnPrecision({
465 1, // Section
466 1, // Calls
467 3, // Time
468 3, // Avg.
469 2, // Percent
470 1 // Memory
471 });
472
473 mooseAssert(!_cumulative_section_info_ptrs.empty(),
474 "update() must be run before printHeaviestSections()!");
475
476 // The total time of the root node
477 auto total_root_time = _cumulative_section_info_ptrs[_root_node_id]->_total;
478
479 // Now print out the largest ones
480 for (unsigned int i = 0; i < num_sections; i++)
481 {
482 auto id = sorted[i];
483
485 continue;
486
487 const auto & entry = *_cumulative_section_info_ptrs[id];
488 vtable.addRow(_perf_graph_registry.sectionInfo(id)._name, // Section
489 entry._num_calls, // Calls
490 entry._self, // Time
491 entry._self / static_cast<Real>(entry._num_calls), // Avg.
492 100. * entry._self / total_root_time, // Percent
493 entry._self_memory); // Memory
494 }
495
496 vtable.print(console);
497}
void update()
Updates the time section_time and time for all currently running nodes.
Definition PerfGraph.C:285
VariadicTable< std::string, unsigned long int, Real, Real, Real, long int > HeaviestTable
Definition PerfGraph.h:213
std::vector< CumulativeSectionInfo * > _cumulative_section_info_ptrs
Pointers into _cumulative_section_info indexed on PerfID This is here for convenience and speed so we...
Definition PerfGraph.h:388
const PerfGraphSectionInfo & sectionInfo(const PerfID section_id) const
Given a PerfID return the PerfGraphSectionInfo @section_id The ID.
void indirectSort(RandomAccessIterator beg, RandomAccessIterator end, std::vector< size_t > &b)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by PerfGraphOutput::output().

◆ push()

void PerfGraph::push ( const PerfID  id)
protected

Add a Node onto the end of the end of the current callstack.

Note: only accessible by using PerfGuard!

Definition at line 186 of file PerfGraph.C.

187{
188 if (!_active)
189 return;
190
191 PerfNode * new_node = nullptr;
192
193 if (id == _root_node_id)
194 new_node = _root_node.get();
195 else
196 new_node = _stack[_current_position]->getChild(id);
197
198 MemoryUtils::Stats stats;
199 auto memory_success = MemoryUtils::getMemoryStats(stats);
200
201 long int start_memory = 0;
202
203 if (memory_success)
204 {
205 const auto memory_mb =
207 start_memory = memory_mb;
208 updateMaxMemory(memory_mb);
209 }
210 // If we weren't able to get the memory stats, let's just use the parent's
211 else if (_current_position != -1)
212 start_memory = _stack[_current_position]->startMemory();
213
214 // Set the start time
215 auto current_time = std::chrono::steady_clock::now();
216
217 new_node->setStartTimeAndMemory(current_time, start_memory);
218
219 // Increment the number of calls
220 new_node->incrementNumCalls();
221
223
224 if (_current_position >= MOOSE_MAX_STACK_SIZE)
225 mooseError("PerfGraph is out of stack space!");
226
227 _stack[_current_position] = new_node;
228
229 // Add this to the execution list unless the message is empty - but pre-emted by live_print_all
230 if ((_pid == 0 && !_disable_live_print) &&
232 addToExecutionList(id, IncrementState::STARTED, current_time, start_memory);
233}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
A node in the PerfGraph.
Definition PerfNode.h:26
PerfNode * getChild(const PerfID id)
Get a child node with the unique id given.
Definition PerfNode.h:93
void incrementNumCalls()
Increments the number of calls.
Definition PerfNode.h:76
void setStartTimeAndMemory(const std::chrono::time_point< std::chrono::steady_clock > time, const long int memory)
Set the current start time.
Definition PerfNode.h:41

Referenced by PerfGraph(), and PerfGuard::PerfGuard().

◆ recursivelyUpdate()

void PerfGraph::recursivelyUpdate ( const PerfNode current_node)
protected

Updates the cumulative self/children/total time and memory for each section across all nodes that contribute to said section in _cumulative_section_info.

Note: requires that the contents in each CumulativeSectionInfo in _cumulative_section_info be initially resized and zeroed

Parameters
current_nodeThe current node to work on

Definition at line 332 of file PerfGraph.C.

333{
334 const auto & section_name = _perf_graph_registry.readSectionInfo(current_node.id())._name;
335
336 // RHS insertion on purpose
337 auto & section_time = _cumulative_section_info[section_name];
338
339 section_time._self += current_node.selfTimeSec();
340 section_time._children += current_node.childrenTimeSec();
341 section_time._total += current_node.totalTimeSec();
342 section_time._num_calls += current_node.numCalls();
343
344 section_time._self_memory += current_node.selfMemory();
345 section_time._children_memory += current_node.childrenMemory();
346 section_time._total_memory += current_node.totalMemory();
347
348 for (auto & child_it : current_node.children())
349 recursivelyUpdate(*child_it.second);
350}
void recursivelyUpdate(const PerfNode &current_node)
Updates the cumulative self/children/total time and memory for each section across all nodes that con...
Definition PerfGraph.C:332
std::unordered_map< std::string, CumulativeSectionInfo > _cumulative_section_info
The cumulative time and memory for each section.
Definition PerfGraph.h:382
Real childrenTimeSec() const
The time this node's children took in seconds.
Definition PerfNode.h:142
Real selfTimeSec() const
Get the time this node took in seconds.
Definition PerfNode.h:116
long int totalMemory() const
Get the amount of memory added by this node.
Definition PerfNode.h:162
long int selfMemory() const
Get the amount of memory added by this node.
Definition PerfNode.C:41
long int childrenMemory() const
Get the amount of memory added by this node.
Definition PerfNode.C:47
Real totalTimeSec() const
The time this Node plus all of its children took in seconds.
Definition PerfNode.h:129
PerfID id() const
Get the ID of this Node.
Definition PerfNode.h:36
unsigned long int numCalls() const
Get the number of times this node was called.
Definition PerfNode.h:147

Referenced by recursivelyUpdate(), and update().

◆ rootNode()

const PerfNode & PerfGraph::rootNode ( ) const
inline
Returns
A constant reference to the root node

Definition at line 193 of file PerfGraph.h.

193{ return *_root_node; }

◆ sectionData()

Real PerfGraph::sectionData ( const DataType  type,
const std::string &  section_name,
const bool  must_exist = true 
)

Gets a PerfGraph result pertaining to a section.

Parameters
typeThe result type to retrieve
section_nameThe name of the section
must_existWhether not the section must exist; if false and the section does not exist, returns 0, if true and the section does not exist, exit with an error

Definition at line 94 of file PerfGraph.C.

97{
98 update();
99
100 const auto section_it =
101 _cumulative_section_info.find(section_name == "Root" ? _root_name : section_name);
102
103 if (section_it == _cumulative_section_info.end())
104 {
105 if (!must_exist || // isn't required to exist
106 _perf_graph_registry.sectionExists(section_name) // or, is required to exist and it does
107 )
108 return 0;
109
110 mooseError("Unknown PerfGraph section name \"",
111 section_name,
112 "\" in PerfGraph::sectionData().\nIf you are attempting to retrieve the root use "
113 "\"Root\".");
114 }
115
116 const CumulativeSectionInfo & section_info = section_it->second;
117
118 if (type == CALLS)
119 return section_info._num_calls;
120
121 const auto app_time = _cumulative_section_info_ptrs[_root_node_id]->_total;
122
123 switch (type)
124 {
125 case SELF:
126 return section_info._self;
127 case CHILDREN:
128 return section_info._children;
129 case TOTAL:
130 return section_info._total;
131 case SELF_AVG:
132 return section_info._self / static_cast<Real>(section_info._num_calls);
133 case CHILDREN_AVG:
134 return section_info._children / static_cast<Real>(section_info._num_calls);
135 case TOTAL_AVG:
136 return section_info._total / static_cast<Real>(section_info._num_calls);
137 case SELF_PERCENT:
138 return 100. * (section_info._self / app_time);
139 case CHILDREN_PERCENT:
140 return 100. * (section_info._children / app_time);
141 case TOTAL_PERCENT:
142 return 100. * (section_info._total / app_time);
143 case SELF_MEMORY:
144 return section_info._self_memory;
145 case CHILDREN_MEMORY:
146 return section_info._children_memory;
147 case TOTAL_MEMORY:
148 return section_info._total_memory;
149 default:
150 ::mooseError("Unknown DataType");
151 }
152}
bool sectionExists(const std::string &section_name) const
Whether or not a section with that name has been registered @section_name The name of the section.

Referenced by PerfGraphData::finalize().

◆ setActive()

void PerfGraph::setActive ( bool  active)
inline

Turn on or off timing.

Definition at line 129 of file PerfGraph.h.

129{ _active = active; }
bool active() const
Whether or not timing is active.
Definition PerfGraph.h:124

Referenced by CommonOutputAction::act(), and MooseApp::setupOptions().

◆ setLiveMemoryLimit()

void PerfGraph::setLiveMemoryLimit ( unsigned int  mem_limit)
inline

Sert the memory limit before a message prints.

Definition at line 157 of file PerfGraph.h.

158 {
159 _live_print_mem_limit.store(mem_limit, std::memory_order_relaxed);
160 }

Referenced by CommonOutputAction::act().

◆ setLivePrintAll()

void PerfGraph::setLivePrintAll ( bool  active)
inline

Forces all sections to be output live.

Definition at line 144 of file PerfGraph.h.

◆ setLiveTimeLimit()

void PerfGraph::setLiveTimeLimit ( Real  time_limit)
inline

Set the time limit before a message prints.

Definition at line 149 of file PerfGraph.h.

150 {
151 _live_print_time_limit.store(time_limit, std::memory_order_relaxed);
152 }

Referenced by CommonOutputAction::act().

◆ treeRecurse()

template<typename Functor >
void PerfGraph::treeRecurse ( const Functor &  act,
const unsigned int  level = MOOSE_MAX_STACK_SIZE,
const bool  heaviest = false 
) const

Definition at line 488 of file PerfGraph.h.

491{
492 mooseAssert(_root_node, "Root node does not exist; calling this too early");
493 treeRecurseInternal(*_root_node, act, level, heaviest, 0);
494}
void treeRecurseInternal(const PerfNode &node, const Functor &act, const unsigned int level, const bool heaviest, unsigned int current_depth) const
Definition PerfGraph.h:450

Referenced by treeTable().

◆ treeRecurseInternal()

template<typename Functor >
void PerfGraph::treeRecurseInternal ( const PerfNode node,
const Functor &  act,
const unsigned int  level,
const bool  heaviest,
unsigned int  current_depth 
) const
private

Definition at line 450 of file PerfGraph.h.

455{
456 mooseAssert(_perf_graph_registry.sectionExists(node.id()), "Unable to find section name!");
457
458 const auto & current_section_info = _perf_graph_registry.readSectionInfo(node.id());
459 if (current_section_info._level <= level)
460 {
461 mooseAssert(!_cumulative_section_info_ptrs.empty(), "update() must be run before treeRecurse!");
462 act(node, current_section_info, current_depth++);
463 }
464
465 if (heaviest)
466 {
467 const PerfNode * heaviest_child = nullptr;
468 for (const auto & child_it : node.children())
469 {
470 const auto & current_child = *child_it.second;
471
472 if (!heaviest_child || (current_child.totalTime() > heaviest_child->totalTime()))
473 heaviest_child = &current_child;
474 }
475
476 if (heaviest_child)
477 treeRecurseInternal(*heaviest_child, act, level, true, current_depth);
478 }
479 else
480 {
481 for (const auto & child_it : node.children())
482 treeRecurseInternal(*child_it.second, act, level, false, current_depth);
483 }
484}
std::chrono::steady_clock::duration totalTime() const
The time this Node plus all of it's children took.
Definition PerfNode.C:22

Referenced by treeRecurse(), and treeRecurseInternal().

◆ treeTable()

PerfGraph::FullTable PerfGraph::treeTable ( const unsigned int  level,
const bool  heaviest = false 
)
private

Helper for building a VariadicTable that represents the tree.

Parameters
levelThe level to print out below (<=)
heaviestShow only the heaviest branch

Definition at line 353 of file PerfGraph.C.

354{
355 update();
356
357 FullTable vtable({"Section",
358 "Calls",
359 "Self(s)",
360 "Avg(s)",
361 "%",
362 "Mem(MB)",
363 "Total(s)",
364 "Avg(s)",
365 "%",
366 "Mem(MB)"},
367 10);
368
369 vtable.setColumnFormat({
370 VariadicTableColumnFormat::AUTO, // Section Name
380 });
381
382 vtable.setColumnPrecision({
383 1, // Section Name
384 0, // Calls
385 3, // Self
386 3, // Avg.
387 2, // %
388 0, // Memory
389 3, // Total
390 3, // Avg.
391 2, // %
392 0, // Memory
393 });
394
395 auto act = [this, &vtable](const PerfNode & node,
396 const moose::internal::PerfGraphSectionInfo & section_info,
397 const unsigned int depth)
398 {
399 vtable.addRow(std::string(depth * 2, ' ') + section_info._name, // Section Name
400 node.numCalls(), // Calls
401 node.selfTimeSec(), // Self
402 node.selfTimeAvg(), // Avg.
403 100. * node.selfTimeSec() / _root_node->totalTimeSec(), // %
404 node.selfMemory(), // Memory
405 node.totalTimeSec(), // Total
406 node.totalTimeAvg(), // Avg.
407 100. * node.totalTimeSec() / _root_node->totalTimeSec(), // %
408 node.totalMemory()); // Memory
409 };
410 treeRecurse(act, level, heaviest);
411
412 return vtable;
413}
void treeRecurse(const Functor &act, const unsigned int level=MOOSE_MAX_STACK_SIZE, const bool heaviest=false) const
Definition PerfGraph.h:488
VariadicTable< std::string, unsigned long int, Real, Real, Real, long int, Real, Real, Real, long int > FullTable
Definition PerfGraph.h:211
Real totalTimeAvg() const
The average time this Node plus all of its children took in seconds.
Definition PerfNode.h:133
Real selfTimeAvg() const
The average time this node took in seconds.
Definition PerfNode.h:120
Used to hold metadata about the registered sections Note: this is a class instead of a struct because...

Referenced by print(), and printHeaviestBranch().

◆ update()

void PerfGraph::update ( )

Updates the time section_time and time for all currently running nodes.

Definition at line 285 of file PerfGraph.C.

286{
287 // First update all of the currently running nodes
288 auto now = std::chrono::steady_clock::now();
289
290 MemoryUtils::Stats stats;
292 auto now_memory =
294
295 for (int i = 0; i <= _current_position; i++)
296 {
297 auto node = _stack[i];
298 node->addTimeAndMemory(now, now_memory);
299 node->setStartTimeAndMemory(now, now_memory);
300 }
301
302 // Zero out the entries
303 for (auto & section_time_it : _cumulative_section_info)
304 {
305 auto & section_time = section_time_it.second;
306
307 section_time._num_calls = 0;
308 section_time._self = 0.;
309 section_time._children = 0.;
310 section_time._total = 0.;
311 section_time._self_memory = 0;
312 section_time._children_memory = 0;
313 section_time._total_memory = 0.;
314 }
315
317
318 // Update vector pointing to section times
319 // Note: we are doing this _after_ recursively filling
320 // because new entries may have been created
322
323 for (auto & section_time_it : _cumulative_section_info)
324 {
325 auto id = _perf_graph_registry.sectionID(section_time_it.first);
326
327 _cumulative_section_info_ptrs[id] = &section_time_it.second;
328 }
329}
PerfID sectionID(const std::string &section_name) const
Given a name return the PerfID @section_name The name of the section.

Referenced by printHeaviestSections(), sectionData(), and treeTable().

◆ updateMaxMemory()

void PerfGraph::updateMaxMemory ( const std::size_t  current_memory)
private

Update _max_memory if current_memory > _max_memory.

Definition at line 500 of file PerfGraph.C.

501{
502 // We shouldn't need to lock _max_memory in-between getting
503 // it and setting it as this should only ever be set outside
504 // of threads. _max_memory is an atomic so that getting it
505 // is thread safe.
506 if (current_memory > getMaxMemory())
507 _max_memory = current_memory;
508}
std::size_t getMaxMemory() const
Get the maximum memory allocation in MB.
Definition PerfGraph.h:183

Referenced by pop(), and push().

Friends And Related Symbol Documentation

◆ dataLoad

void dataLoad ( std::istream &  stream,
PerfGraph perf_graph,
void *  context 
)
friend

Definition at line 525 of file PerfGraph.C.

526{
527 // Load in all of the recovered sections and register those that do not exist yet
528 std::vector<moose::internal::PerfGraphSectionInfo> recovered_section_info;
529 dataLoad(stream, recovered_section_info, nullptr);
530 for (const auto & info : recovered_section_info)
531 {
532 if (info._live_message.size())
534 info._name, info._level, info._live_message, info._print_dots);
535 else
536 perf_graph._perf_graph_registry.registerSection(info._name, info._level);
537 }
538
539 // Update the current node time/memory/calls before loading the nodes as the load
540 // will append information to current nodes that exist
541 perf_graph.update();
542
543 // Recursively load all of the nodes; this will append information to matching nodes
544 // and will create new nodes for section paths that do not exist
545 dataLoad(stream, perf_graph._root_node, &perf_graph);
546}
friend void dataLoad(std::istream &, PerfGraph &, void *)
Definition PerfGraph.C:525
MPI_Info info

◆ dataStore

void dataStore ( std::ostream &  stream,
PerfGraph perf_graph,
void *  context 
)
friend

Definition at line 511 of file PerfGraph.C.

512{
513 // We need to store the registry id -> section info map so that we can add
514 // registered sections that may not be added yet during recover
515 dataStore(stream, perf_graph._perf_graph_registry._id_to_item, nullptr);
516
517 // Update before serializing the nodes so that the time/memory/calls are correct
518 perf_graph.update();
519
520 // Recursively serialize all of the nodes
521 dataStore(stream, perf_graph._root_node, nullptr);
522}
std::deque< Item > _id_to_item
Vector of IDs to Items.
friend void dataStore(std::ostream &, PerfGraph &, void *)
Definition PerfGraph.C:511

◆ PerfGraphLivePrint

friend class PerfGraphLivePrint
friend

Definition at line 422 of file PerfGraph.h.

◆ PerfGuard

friend class PerfGuard
friend

Definition at line 421 of file PerfGraph.h.

Member Data Documentation

◆ _active

bool PerfGraph::_active
protected

Whether or not timing is active.

Definition at line 394 of file PerfGraph.h.

Referenced by active(), pop(), push(), and setActive().

◆ _console

const ConsoleStream ConsoleStreamInterface::_console
inherited

An instance of helper class to write streams to the Console objects.

Definition at line 31 of file ConsoleStreamInterface.h.

Referenced by IterationAdaptiveDT::acceptStep(), MaterialOutputAction::act(), MeshOnlyAction::act(), SetupDebugAction::act(), FEProblemBase::adaptMesh(), Adaptivity::adaptMesh(), addToExecutionList(), SimplePredictor::apply(), SystemBase::applyScalingFactors(), MultiApp::backup(), FEProblemBase::backupMultiApps(), CoarsenedPiecewiseLinear::buildCoarsenedGrid(), DefaultSteadyStateConvergence::checkConvergence(), MeshDiagnosticsGenerator::checkElementOverlap(), MeshDiagnosticsGenerator::checkElementTypes(), MeshDiagnosticsGenerator::checkElementVolumes(), FEProblemBase::checkExceptionAndStopSolve(), SolverSystem::checkInvalidSolution(), MeshDiagnosticsGenerator::checkLocalJacobians(), MeshDiagnosticsGenerator::checkNonConformalMesh(), MeshDiagnosticsGenerator::checkNonConformalMeshFromAdaptivity(), MeshDiagnosticsGenerator::checkNonMatchingEdges(), MeshDiagnosticsGenerator::checkNonPlanarSides(), MeshDiagnosticsGenerator::checkPolygons(), FEProblemBase::checkProblemIntegrity(), ReferenceResidualConvergence::checkResidualConvergence(), MeshDiagnosticsGenerator::checkSidesetsOrientation(), MeshDiagnosticsGenerator::checkWatertightNodesets(), MeshDiagnosticsGenerator::checkWatertightSidesets(), IterationAdaptiveDT::computeAdaptiveDT(), TransientBase::computeConstrainedDT(), DefaultMultiAppFixedPointConvergence::computeCustomConvergencePostprocessor(), NonlinearSystemBase::computeDamping(), FixedPointIterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInitialDT(), IterationAdaptiveDT::computeInterpolationDT(), FEProblemBase::computeLinearSystemTags(), LinearSystem::computeLinearSystemTags(), NonlinearSystemBase::computeScaling(), Problem::console(), TimeStepper::constrainStep(), IterationAdaptiveDT::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), Eigenvalue::execute(), SteadyBase::execute(), MFEMSteady::execute(), MessageFromInput::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), MeshGeneratorSystem::executeMeshGenerators(), SidesetAroundSubdomainUpdater::finalize(), ElementQualityChecker::finalize(), FEProblemBase::finishMultiAppStep(), MeshRepairGenerator::fixOverlappingNodes(), SurfaceSubdomainsDelaunayRemesher::General2DDelaunay(), CoarsenBlockGenerator::generate(), OrientSurfaceMeshGenerator::generate(), PolyLineMeshFollowingNodeSetGenerator::generate(), MeshGenerator::generateInternal(), VariableCondensationPreconditioner::getDofToCondense(), InversePowerMethod::init(), NonlinearEigen::init(), FEProblemBase::initialAdaptMesh(), DefaultMultiAppFixedPointConvergence::initialize(), SubProblem::initialSetup(), EigenExecutionerBase::inversePowerIteration(), FEProblemBase::joinAndFinalize(), TransientBase::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), FEProblemBase::logAdd(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), SurfaceDelaunayGeneratorBase::meshNormalDeviation2D(), MooseBase::mooseDeprecated(), MooseBase::mooseDeprecatedNoTrace(), MooseBase::mooseInfo(), MooseBase::mooseWarning(), MooseBase::mooseWarningNonPrefixed(), ReferenceResidualConvergence::nonlinearConvergenceSetup(), Console::output(), DOFMapOutput::output(), MaterialPropertyDebugOutput::output(), PerfGraphOutput::output(), ReporterDebugOutput::output(), SolutionInvalidityOutput::output(), VariableResidualNormsDebugOutput::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), WebServerControl::outputMessage(), Console::outputPostprocessors(), PseudoTimestep::outputPseudoTimestep(), Console::outputReporters(), DefaultMultiAppFixedPointConvergence::outputResidualNorm(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), AB2PredictorCorrector::postSolve(), ActionWarehouse::printActionDependencySets(), BlockRestrictionDebugOutput::printBlockRestrictionGroups(), BlockRestrictionDebugOutput::printBlockRestrictionMap(), BlockRestrictionDebugOutput::printBoundaryRestrictionGroups(), SolutionInvalidity::printDebug(), EigenExecutionerBase::printEigenvalue(), PicardSolve::printFixedPointConvergenceHistory(), SecantSolve::printFixedPointConvergenceHistory(), SteffensenSolve::printFixedPointConvergenceHistory(), FixedPointSolve::printFixedPointConvergenceReason(), PerfGraphLivePrint::printLiveMessage(), MaterialPropertyDebugOutput::printMaterialMap(), PerfGraphLivePrint::printStats(), NEML2Action::printSummary(), AutomaticMortarGeneration::projectPrimaryNodesSinglePair(), AutomaticMortarGeneration::projectSecondaryNodesSinglePair(), CoarsenBlockGenerator::recursiveCoarsen(), SolutionTimeAdaptiveDT::rejectStep(), MultiApp::restore(), FEProblemBase::restoreMultiApps(), FEProblemBase::restoreSolutions(), NonlinearSystemBase::setInitialSolution(), MooseApp::setupOptions(), Checkpoint::shouldOutput(), SubProblem::showFunctorRequestors(), SubProblem::showFunctors(), FullSolveMultiApp::showStatusMessage(), FEProblemSolve::solve(), FixedPointSolve::solve(), LinearSystem::solve(), NonlinearSystem::solve(), AStableDirk4::solve(), ExplicitRK2::solve(), ExplicitTVDRK2::solve(), ImplicitMidpoint::solve(), LStableDirk2::solve(), LStableDirk3::solve(), LStableDirk4::solve(), EigenProblem::solve(), FixedPointSolve::solveStep(), TransientMultiApp::solveStep(), MeshRepairGenerator::splitNonConvexPolygons(), PerfGraphLivePrint::start(), WebServerControl::startServer(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), TransientBase::takeStep(), MFEMTransient::takeStep(), TerminateChainControl::terminate(), SubProblem::timestepSetup(), FEProblemBase::updateMeshXFEM(), Convergence::verboseOutput(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

◆ _cumulative_section_info

std::unordered_map<std::string, CumulativeSectionInfo> PerfGraph::_cumulative_section_info
protected

The cumulative time and memory for each section.

This is updated on update() Note that this is total cumulative time/memory across every place that section is in the graph

I'm making this a map so that we can give out references to the values The three values are: self, children The map is on std::string because we might need to be able to retrieve timing values in a "late binding" situation before the section has been registered.

Definition at line 382 of file PerfGraph.h.

Referenced by recursivelyUpdate(), sectionData(), and update().

◆ _cumulative_section_info_ptrs

std::vector<CumulativeSectionInfo *> PerfGraph::_cumulative_section_info_ptrs
protected

Pointers into _cumulative_section_info indexed on PerfID This is here for convenience and speed so we don't need to iterate over the above map much - and it makes it easier to sort.

Definition at line 388 of file PerfGraph.h.

Referenced by printHeaviestSections(), sectionData(), treeRecurseInternal(), and update().

◆ _current_position

int PerfGraph::_current_position
protected

The current node position in the stack.

Definition at line 359 of file PerfGraph.h.

Referenced by pop(), push(), and update().

◆ _destructing

bool PerfGraph::_destructing
protected

Tell the print thread to teardown.

Definition at line 400 of file PerfGraph.h.

Referenced by disableLivePrint().

◆ _destructing_mutex

std::mutex PerfGraph::_destructing_mutex
protected

The mutex to use with a condition_variable predicate to guard _destructing.

Definition at line 403 of file PerfGraph.h.

Referenced by disableLivePrint(), and PerfGraphLivePrint::start().

◆ _disable_live_print

bool PerfGraph::_disable_live_print
protected

Whether or not live print is disabled (cannot be turned on again)

Definition at line 341 of file PerfGraph.h.

Referenced by disableLivePrint(), enableLivePrint(), pop(), and push().

◆ _done

std::promise<bool> PerfGraph::_done
protected

The promise to the print thread that will signal when to stop.

Definition at line 397 of file PerfGraph.h.

◆ _execution_list

std::array<SectionIncrement, MAX_EXECUTION_LIST_SIZE> PerfGraph::_execution_list
protected

A circular buffer for holding the execution list, this is read by the printing loop.

Definition at line 365 of file PerfGraph.h.

Referenced by addToExecutionList().

◆ _execution_list_begin

std::atomic<unsigned int> PerfGraph::_execution_list_begin
protected

Where the print thread should start reading the execution list.

Definition at line 368 of file PerfGraph.h.

◆ _execution_list_end

std::atomic<unsigned int> PerfGraph::_execution_list_end
protected

Where the print thread should stop reading the execution list.

Definition at line 371 of file PerfGraph.h.

Referenced by addToExecutionList().

◆ _finished_section

std::condition_variable PerfGraph::_finished_section
protected

The condition_variable to wake the print thread.

Definition at line 406 of file PerfGraph.h.

Referenced by disableLivePrint(), pop(), and PerfGraphLivePrint::start().

◆ _live_print

const std::unique_ptr<PerfGraphLivePrint> PerfGraph::_live_print
protected

The object that is doing live printing.

Definition at line 415 of file PerfGraph.h.

Referenced by enableLivePrint().

◆ _live_print_all

bool PerfGraph::_live_print_all
protected

Whether or not to put everything in the perf graph.

Definition at line 338 of file PerfGraph.h.

Referenced by PerfGraphLivePrint::iterateThroughExecutionList(), pop(), push(), and setLivePrintAll().

◆ _live_print_mem_limit

std::atomic<unsigned int> PerfGraph::_live_print_mem_limit
protected

The memory limit before a message is printed (in MB)

Definition at line 412 of file PerfGraph.h.

Referenced by setLiveMemoryLimit().

◆ _live_print_time_limit

std::atomic<Real> PerfGraph::_live_print_time_limit
protected

The time limit before a message is printed (in seconds)

Definition at line 409 of file PerfGraph.h.

Referenced by setLiveTimeLimit().

◆ _max_memory

std::atomic<std::size_t> PerfGraph::_max_memory
protected

Maximum memory encountered during push and pop.

Definition at line 391 of file PerfGraph.h.

Referenced by getMaxMemory(), and updateMaxMemory().

◆ _moose_app

MooseApp& PerfGraph::_moose_app
protected

The MooseApp.

Definition at line 335 of file PerfGraph.h.

Referenced by mooseApp().

◆ _perf_graph_registry

PerfGraphRegistry& PerfGraph::_perf_graph_registry
protected

The PerfGraphRegistry.

Definition at line 344 of file PerfGraph.h.

Referenced by pop(), printHeaviestSections(), push(), recursivelyUpdate(), sectionData(), treeRecurseInternal(), and update().

◆ _pid

const libMesh::processor_id_type PerfGraph::_pid
protected

This processor id.

Definition at line 347 of file PerfGraph.h.

Referenced by disableLivePrint(), enableLivePrint(), pop(), and push().

◆ _print_thread

std::thread PerfGraph::_print_thread
protected

The thread for printing sections as they execute.

Definition at line 418 of file PerfGraph.h.

Referenced by disableLivePrint(), and enableLivePrint().

◆ _root_name

const std::string PerfGraph::_root_name
protected

Name of the root node.

Definition at line 350 of file PerfGraph.h.

Referenced by sectionData().

◆ _root_node

const std::unique_ptr<PerfNode> PerfGraph::_root_node
protected

The root node of the graph.

Definition at line 356 of file PerfGraph.h.

Referenced by push(), rootNode(), treeRecurse(), treeTable(), and update().

◆ _root_node_id

const PerfID PerfGraph::_root_node_id
protected

The id for the root node.

Definition at line 353 of file PerfGraph.h.

Referenced by PerfGraph(), printHeaviestSections(), push(), and sectionData().

◆ _stack

std::array<PerfNode *, MOOSE_MAX_STACK_SIZE> PerfGraph::_stack
protected

The full callstack. Currently capped at a depth of 100.

Definition at line 362 of file PerfGraph.h.

Referenced by pop(), push(), and update().


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