https://mooseframework.inl.gov
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
PerfGraphLivePrint Class Reference

This is effectively a functor that runs on a separate thread and watches the state of the call stack to see if things need to be printed about what the application is doing. More...

#include <PerfGraphLivePrint.h>

Inheritance diagram for PerfGraphLivePrint:
[legend]

Public Member Functions

 PerfGraphLivePrint (PerfGraph &perf_graph, MooseApp &app)
 
void start ()
 Start printing. More...
 

Protected Attributes

const ConsoleStream _console
 An instance of helper class to write streams to the Console objects. More...
 

Private Member Functions

void printLiveMessage (PerfGraph::SectionIncrement &section_increment)
 Print the live message. More...
 
void printStats (PerfGraph::SectionIncrement &section_increment_start, PerfGraph::SectionIncrement &section_increment_finish)
 Print the stats. More...
 
void printStackUpToLast ()
 Print everything underneath the current top of the stack. More...
 
void inSamePlace ()
 What to do if we're still in the same spot. More...
 
void iterateThroughExecutionList ()
 What to do if there are new things in the execution list. More...
 

Private Attributes

const unsigned int WRAP_LENGTH = 90
 Number of columns before wrapping. More...
 
const MooseApp_app
 The app performing this print. More...
 
PerfGraph_perf_graph
 Reference to the PerfGraph to work with. More...
 
const moose::internal::PerfGraphRegistry_perf_graph_registry
 Reference to the PerfGraphRegistry for convenience. More...
 
std::array< PerfGraph::SectionIncrement, MAX_EXECUTION_LIST_SIZE > & _execution_list
 Convenience reference to the execution_list within the PerfGraph. More...
 
std::atomic< bool > _currently_destructing
 True when we stop printing. More...
 
std::atomic< Real > & _time_limit
 Limit (in seconds) before printing. More...
 
std::atomic< unsigned int > & _mem_limit
 Limit (in MB) More...
 
unsigned int _stack_level
 This is one beyond the last thing on the stack. More...
 
std::array< PerfGraph::SectionIncrement, MOOSE_MAX_STACK_SIZE > _print_thread_stack
 The current stack for what the print thread has seen. More...
 
unsigned int _current_execution_list_end
 The end of the execution list This is (safely) copied from PerfGraph so that it is consistent for an entire iteration. More...
 
unsigned int _current_execution_list_last
 The actual last entry in the list This is useful because it is a circular queue - so this is not just end - 1 (although, often it will be) More...
 
unsigned int _last_execution_list_end
 Where the end of the execution list was during the last call If this == the current_end... More...
 
PerfGraph::SectionIncrement_last_printed_increment
 Which increment was last printed. More...
 
unsigned long long int _last_num_printed
 The output count from the console the last time we printed. More...
 
unsigned long long int _console_num_printed
 The current output count from the console. More...
 
bool _stack_top_print_dots
 Whether or not the top thing on the stack is set to print dots. More...
 

Detailed Description

This is effectively a functor that runs on a separate thread and watches the state of the call stack to see if things need to be printed about what the application is doing.

Definition at line 27 of file PerfGraphLivePrint.h.

Constructor & Destructor Documentation

◆ PerfGraphLivePrint()

PerfGraphLivePrint::PerfGraphLivePrint ( PerfGraph perf_graph,
MooseApp app 
)

Definition at line 14 of file PerfGraphLivePrint.C.

16  _app(app),
17  _perf_graph(perf_graph),
19  _execution_list(perf_graph._execution_list),
23  _stack_level(0),
31 {
32 }
PerfGraph::SectionIncrement * _last_printed_increment
Which increment was last printed.
unsigned long long int _last_num_printed
The output count from the console the last time we printed.
bool _stack_top_print_dots
Whether or not the top thing on the stack is set to print dots.
unsigned int _current_execution_list_end
The end of the execution list This is (safely) copied from PerfGraph so that it is consistent for an ...
std::atomic< unsigned int > _live_print_mem_limit
The memory limit before a message is printed (in MB)
Definition: PerfGraph.h:402
std::atomic< bool > _currently_destructing
True when we stop printing.
std::array< PerfGraph::SectionIncrement, MAX_EXECUTION_LIST_SIZE > & _execution_list
Convenience reference to the execution_list within the PerfGraph.
unsigned int _last_execution_list_end
Where the end of the execution list was during the last call If this == the current_end...
ConsoleStreamInterface(MooseApp &app)
A class for providing a helper stream object for writting message to all the Output objects...
std::atomic< unsigned int > & _mem_limit
Limit (in MB)
const MooseApp & _app
The app performing this print.
PerfGraph & _perf_graph
Reference to the PerfGraph to work with.
unsigned int _current_execution_list_last
The actual last entry in the list This is useful because it is a circular queue - so this is not just...
unsigned long long int _console_num_printed
The current output count from the console.
const moose::internal::PerfGraphRegistry & _perf_graph_registry
Reference to the PerfGraphRegistry for convenience.
unsigned int _stack_level
This is one beyond the last thing on the stack.
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.
std::atomic< Real > _live_print_time_limit
The time limit before a message is printed (in seconds)
Definition: PerfGraph.h:399
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:358
std::atomic< Real > & _time_limit
Limit (in seconds) before printing.

Member Function Documentation

◆ inSamePlace()

void PerfGraphLivePrint::inSamePlace ( )
private

What to do if we're still in the same spot.

Definition at line 210 of file PerfGraphLivePrint.C.

Referenced by start().

211 {
212  // If someone else printed since, then we need to start over, and set everything on the stack to
213  // printed Everything is set to printed because if something printed and we're still in the same
214  // place then we need to NOT print out the beginning message
216  {
217  _last_printed_increment = nullptr;
218 
219  for (unsigned int s = 0; s < _stack_level; s++)
220  _print_thread_stack[s]._state = PerfGraph::IncrementState::PRINTED;
221 
222  return;
223  }
224 
225  // Only print if there is something to print!
226  if (_stack_level > 0)
227  {
230 
232 
234 
235  // Reset this each time
236  _stack_top_print_dots = true;
237  }
238 }
PerfGraph::SectionIncrement * _last_printed_increment
Which increment was last printed.
unsigned long long int _last_num_printed
The output count from the console the last time we printed.
bool _stack_top_print_dots
Whether or not the top thing on the stack is set to print dots.
std::array< PerfGraph::SectionIncrement, MOOSE_MAX_STACK_SIZE > _print_thread_stack
The current stack for what the print thread has seen.
const PerfGraphSectionInfo & sectionInfo(const PerfID section_id) const
Given a PerfID return the PerfGraphSectionInfo The ID.
bool _print_dots
Whether or not to print dots while this section runs.
unsigned long long int _console_num_printed
The current output count from the console.
const moose::internal::PerfGraphRegistry & _perf_graph_registry
Reference to the PerfGraphRegistry for convenience.
void printStackUpToLast()
Print everything underneath the current top of the stack.
void printLiveMessage(PerfGraph::SectionIncrement &section_increment)
Print the live message.
unsigned int _stack_level
This is one beyond the last thing on the stack.

◆ iterateThroughExecutionList()

void PerfGraphLivePrint::iterateThroughExecutionList ( )
private

What to do if there are new things in the execution list.

Definition at line 241 of file PerfGraphLivePrint.C.

Referenced by start().

242 {
243  // Current position in the execution list
244  auto p = _last_execution_list_end;
245 
246  while (p != _current_execution_list_end)
247  {
248  // The ternary here is for wrapping around
249  auto next_p = p + 1 < MAX_EXECUTION_LIST_SIZE ? p + 1 : 0;
250 
251  auto & section_increment = _execution_list[p];
252 
253  // New section, add to the stack
254  if (section_increment._state == PerfGraph::IncrementState::STARTED)
255  {
256  section_increment._print_stack_level = _stack_level;
257 
258  // Store this increment in the stack
259  _print_thread_stack[_stack_level] = section_increment;
260 
261  _stack_level++;
262  }
263  else // This means it's finished need to see if we need to print it
264  {
265  mooseAssert(_stack_level, "Popping beyond the beginning of the stack!");
266 
267  // Get the beginning information for this section... it is the thing currently on the top of
268  // the stack
269  auto & section_increment_start = _print_thread_stack[_stack_level - 1];
270 
271  auto time_increment =
272  std::chrono::duration<double>(section_increment._time - section_increment_start._time)
273  .count();
274  auto memory_increment = section_increment._memory - section_increment_start._memory;
275 
276  // If it has already been printed or meets our criteria then print it and finish it
278  section_increment_start._state == PerfGraph::IncrementState::PRINTED ||
279  time_increment > _time_limit.load(std::memory_order_relaxed) ||
280  memory_increment > _mem_limit.load(std::memory_order_relaxed))
281  {
283 
284  printStats(section_increment_start, section_increment);
285  }
286 
287  _stack_level--;
288  }
289 
290  p = next_p;
291  }
292 }
unsigned int _current_execution_list_end
The end of the execution list This is (safely) copied from PerfGraph so that it is consistent for an ...
bool _live_print_all
Whether or not to put everything in the perf graph.
Definition: PerfGraph.h:331
std::array< PerfGraph::SectionIncrement, MOOSE_MAX_STACK_SIZE > _print_thread_stack
The current stack for what the print thread has seen.
std::array< PerfGraph::SectionIncrement, MAX_EXECUTION_LIST_SIZE > & _execution_list
Convenience reference to the execution_list within the PerfGraph.
unsigned int _last_execution_list_end
Where the end of the execution list was during the last call If this == the current_end...
void printStats(PerfGraph::SectionIncrement &section_increment_start, PerfGraph::SectionIncrement &section_increment_finish)
Print the stats.
std::atomic< unsigned int > & _mem_limit
Limit (in MB)
PerfGraph & _perf_graph
Reference to the PerfGraph to work with.
void printStackUpToLast()
Print everything underneath the current top of the stack.
unsigned int _stack_level
This is one beyond the last thing on the stack.
std::atomic< Real > & _time_limit
Limit (in seconds) before printing.

◆ printLiveMessage()

void PerfGraphLivePrint::printLiveMessage ( PerfGraph::SectionIncrement section_increment)
private

Print the live message.

Definition at line 35 of file PerfGraphLivePrint.C.

Referenced by inSamePlace(), and printStackUpToLast().

36 {
37  auto & section_info = _perf_graph_registry.sectionInfo(section_increment._id);
38 
39  // If we're not printing dots - we shouldn't be printing the message at all
40  if (!section_info._print_dots || !_stack_top_print_dots)
41  {
42  section_increment._state = PerfGraph::IncrementState::PRINTED;
43  _last_printed_increment = &section_increment;
44  return;
45  }
46 
47  // If the live_message is empty - just print the name
48  auto message =
49  !section_info._live_message.empty() ? section_info._live_message : section_info._name;
50 
51  // If this section is just started - but other stuff has printed before we got to print its
52  // message, we need to print it anyway because it could be lengthy and print unexplained
53  // dots to the console (until the Finished message). "Currently" conveys the message
54  // that we did not just start it, but we are doing that right now
56  section_increment._state == PerfGraph::IncrementState::STARTED &&
57  section_increment._beginning_num_printed != _console_num_printed)
58  {
59  message = "Currently " + message;
60  // The 10 is for "Currently "
61  section_increment._num_dots = 10;
62  }
63 
64  // This line is different - need to finish the last line
65  if (_last_printed_increment && _last_printed_increment != &section_increment &&
66  _last_printed_increment->_state == PerfGraph::IncrementState::PRINTED &&
67  section_info._print_dots)
68  _console << '\n';
69 
70  // Do we need to print dots?
71  if (_last_printed_increment && _last_printed_increment == &section_increment &&
72  section_increment._state == PerfGraph::IncrementState::PRINTED)
73  {
74  if (section_info._print_dots)
75  {
76  _console << ".";
77  section_increment._num_dots++;
78  }
79  }
80  // Printed before so print "Still"
81  else if (section_increment._state == PerfGraph::IncrementState::PRINTED)
82  {
83  _console << std::string(2 * section_increment._print_stack_level, ' ') << "Still " << message;
84 
85  // If we're not printing dots - just finish the line
86  if (!section_info._print_dots)
87  _console << '\n';
88 
89  // The 6 is for "Still "
90  section_increment._num_dots = 6;
91  }
92  else // Just print the message
93  {
94  _console << std::string(2 * section_increment._print_stack_level, ' ') << message;
95 
96  // If we're not printing dots - just finish the line
97  if (!section_info._print_dots)
98  _console << '\n';
99 
100  // Reset the dots since we're printing, except in the "Currently" case
101  if (section_increment._state != PerfGraph::IncrementState::STARTED ||
103  section_increment._beginning_num_printed == _console_num_printed)
104  section_increment._num_dots = 0;
105  }
106 
107  section_increment._state = PerfGraph::IncrementState::PRINTED;
108 
109  // Get the message to the screen
110  _console << std::flush;
111 
112  // Keep track of where we printed in the console
114 
115  _last_printed_increment = &section_increment;
116 }
PerfGraph::SectionIncrement * _last_printed_increment
Which increment was last printed.
unsigned long long int _last_num_printed
The output count from the console the last time we printed.
bool _stack_top_print_dots
Whether or not the top thing on the stack is set to print dots.
unsigned int _print_stack_level
How much to indent this section.
Definition: PerfGraph.h:277
IncrementState _state
Whether or not this increment is the start of an increment or the finishing of an increment...
Definition: PerfGraph.h:274
unsigned long long int numPrinted() const
The number of times something has been printed.
Definition: ConsoleStream.C:68
unsigned long long int _beginning_num_printed
The _console numPrinted() at the time this section was created.
Definition: PerfGraph.h:289
unsigned int _num_dots
How many dots have been printed for this section.
Definition: PerfGraph.h:280
const PerfGraphSectionInfo & sectionInfo(const PerfID section_id) const
Given a PerfID return the PerfGraphSectionInfo The ID.
unsigned long long int _console_num_printed
The current output count from the console.
const moose::internal::PerfGraphRegistry & _perf_graph_registry
Reference to the PerfGraphRegistry for convenience.
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.

◆ printStackUpToLast()

void PerfGraphLivePrint::printStackUpToLast ( )
private

Print everything underneath the current top of the stack.

Definition at line 191 of file PerfGraphLivePrint.C.

Referenced by inSamePlace(), and iterateThroughExecutionList().

192 {
193  if (_stack_level < 1)
194  return;
195 
196  // We need to print out everything on the stack before this that hasn't already been printed...
197  for (unsigned int s = 0; s < _stack_level - 1; s++)
198  {
199  auto & section = _print_thread_stack[s];
200 
201  // Hasn't been printed at all and nothing else has been printed since this started
202  if (section._state == PerfGraph::IncrementState::STARTED)
203  printLiveMessage(section);
204 
205  section._state = PerfGraph::IncrementState::PRINTED;
206  }
207 }
std::array< PerfGraph::SectionIncrement, MOOSE_MAX_STACK_SIZE > _print_thread_stack
The current stack for what the print thread has seen.
void printLiveMessage(PerfGraph::SectionIncrement &section_increment)
Print the live message.
unsigned int _stack_level
This is one beyond the last thing on the stack.

◆ printStats()

void PerfGraphLivePrint::printStats ( PerfGraph::SectionIncrement section_increment_start,
PerfGraph::SectionIncrement section_increment_finish 
)
private

Print the stats.

Definition at line 119 of file PerfGraphLivePrint.C.

Referenced by iterateThroughExecutionList().

121 {
122  if (_stack_level < 1)
123  return;
124 
125  mooseAssert(_perf_graph_registry.sectionExists(section_increment_start._id),
126  "Not found in map: " << section_increment_start._id);
127 
128  auto & section_info_start = _perf_graph_registry.sectionInfo(section_increment_start._id);
129 
130  // If the live_message is empty - just print the name
131  auto message = !section_info_start._live_message.empty() ? section_info_start._live_message
132  : section_info_start._name;
133 
134  auto time_increment =
135  std::chrono::duration<double>(section_increment_finish._time - section_increment_start._time)
136  .count();
137 
138  auto memory_total = section_increment_finish._memory;
139 
140  auto num_horizontal_chars = message.size() + (2 * section_increment_start._print_stack_level);
141 
142  // Add multiapps prefix size
143  if (!_app.isUltimateMaster())
144  num_horizontal_chars += _app.name().size() + 2;
145 
146  // Do we need to print "Finished"?
147  // This happens after something else printed in-between when this increment started and finished
148  if (!section_info_start._print_dots ||
149  (_last_printed_increment && _last_printed_increment != &section_increment_start) ||
150  (section_increment_start._beginning_num_printed !=
151  _console_num_printed)) // This means someone _else_ printed
152  {
153  // If we had printed some dots - we need to finish the line
155  _last_printed_increment->_state == PerfGraph::IncrementState::PRINTED &&
157  _console << '\n';
158 
159  _console << std::string(2 * section_increment_start._print_stack_level, ' ') << "Finished "
160  << message;
161 
162  // 9 is for "Finished "
163  num_horizontal_chars += 9;
164  }
165  else
166  num_horizontal_chars += section_increment_start._num_dots;
167 
168  // Actually do the printing
169  _console << std::setw(WRAP_LENGTH - num_horizontal_chars);
170 
171  _console << " [";
172  _console << COLOR_YELLOW;
173  _console << std::setw(6) << std::fixed << std::setprecision(2) << time_increment << " s";
174  _console << COLOR_DEFAULT;
175  _console << ']' << " [";
176  _console << COLOR_YELLOW << std::setw(5) << std::fixed;
177  _console << memory_total;
178  _console << " MB";
179  _console << COLOR_DEFAULT;
180  _console << ']';
181 
182  // If we're not printing dots - just finish the line
183  _console << std::endl;
184 
186 
187  _last_printed_increment = &section_increment_finish;
188 }
PerfGraph::SectionIncrement * _last_printed_increment
Which increment was last printed.
unsigned long long int _last_num_printed
The output count from the console the last time we printed.
long int _memory
Either the starting memory or final memory depending on _state.
Definition: PerfGraph.h:286
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
Definition: MooseApp.h:847
std::string _live_message
Message to print while the section is running.
bool sectionExists(const std::string &section_name) const
Whether or not a section with that name has been registered The name of the section.
unsigned int _print_stack_level
How much to indent this section.
Definition: PerfGraph.h:277
const unsigned int WRAP_LENGTH
Number of columns before wrapping.
virtual const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:57
IncrementState _state
Whether or not this increment is the start of an increment or the finishing of an increment...
Definition: PerfGraph.h:274
unsigned long long int numPrinted() const
The number of times something has been printed.
Definition: ConsoleStream.C:68
unsigned long long int _beginning_num_printed
The _console numPrinted() at the time this section was created.
Definition: PerfGraph.h:289
unsigned int _num_dots
How many dots have been printed for this section.
Definition: PerfGraph.h:280
const PerfGraphSectionInfo & sectionInfo(const PerfID section_id) const
Given a PerfID return the PerfGraphSectionInfo The ID.
const MooseApp & _app
The app performing this print.
bool _print_dots
Whether or not to print dots while this section runs.
std::chrono::time_point< std::chrono::steady_clock > _time
Either the starting time or final time depending on _state.
Definition: PerfGraph.h:283
unsigned long long int _console_num_printed
The current output count from the console.
const moose::internal::PerfGraphRegistry & _perf_graph_registry
Reference to the PerfGraphRegistry for convenience.
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
unsigned int _stack_level
This is one beyond the last thing on the stack.

◆ start()

void PerfGraphLivePrint::start ( )

Start printing.

Definition at line 295 of file PerfGraphLivePrint.C.

296 {
297  // Keep going until we're signaled to end
298  // Note that _currently_destructing can only be set to true in this thread
299  // Which means that by the time we make it back to the top of the loop, either
300  // there was nothing to process or everything has been processed.
301  while (!_currently_destructing)
302  {
303  std::unique_lock<std::mutex> lock(_perf_graph._destructing_mutex);
304 
305  // Wait for five seconds (by default), or until notified that a section is finished
306  // For a section to have finished the execution list has to have been appended to
307  // This keeps spurious wakeups from happening
308  // Note that the `lock` is only protecting _destructing since the execution list uses atomics.
309  // It must be atomic in order to keep the main thread from having to lock as it
310  // executes. The only downside to this is that it is possible for this thread to wake,
311  // check the condition, miss the notification, then wait. In our case this is not detrimental,
312  // as the only thing that will happen is we will wait 5 more seconds. This is also very
313  // unlikely.
314  // One other thing: wait_for() is not guaranteed to wait for 5 seconds. "Spurious" wakeups
315  // can occur - but the predicate here keeps us from doing anything in that case.
316  // This will either wait until 5 seconds have passed, the signal is sent, _or_ a spurious
317  // wakeup happens to find that there is work to do.
319  lock,
320  std::chrono::duration<Real>(_time_limit.load(std::memory_order_relaxed)),
321  [this]
322  {
323  // Get destructing first so that the execution_list will be in sync
325 
326  // The end will be one past the last
327  // This "acquire" synchronizes with the "release" in the PerfGraph
328  // to ensure that all of the writes to the execution list have been
329  // published to this thread for the "end" we're reading
331  _perf_graph._execution_list_end.load(std::memory_order_acquire);
332 
333  // Save off the number of things currently printed to the console
335 
336  // If we are destructing or there is new work to do... allow moving on
337  return this->_currently_destructing ||
339  });
340 
341  // If the PerfGraph is destructing and we don't have anything left to print - we need to quit
342  // Otherwise, if there are still things to print - do it... afterwards, the loop above
343  // will end because _done_future has been set in PerfGraph.
344  if (this->_currently_destructing &&
346  return;
347 
348  // The last entry in the current execution list for convenience
349  _current_execution_list_last = static_cast<long int>(_current_execution_list_end) - 1 >= 0
351  : MAX_EXECUTION_LIST_SIZE;
352 
353  // Only happens if nothing has been added
355  continue;
356 
357  // Iterate from the last thing printed (begin) to the last thing in the list (end)
358  // If the time or memory of any section is above the threshold, print everything in between and
359  // update begin
360 
361  // Are we still sitting in the same place as the last iteration? If so, we need to print
362  // progress and exit
364  inSamePlace();
365 
366  // This means that new stuff has been added to the execution list. We need to iterate through
367  // it, modifying the stack and printing anything that needs printing
369 
371 
373  }
374 }
unsigned long long int _last_num_printed
The output count from the console the last time we printed.
unsigned int _current_execution_list_end
The end of the execution list This is (safely) copied from PerfGraph so that it is consistent for an ...
void iterateThroughExecutionList()
What to do if there are new things in the execution list.
std::atomic< unsigned int > _execution_list_end
Where the print thread should stop reading the execution list.
Definition: PerfGraph.h:364
std::condition_variable _finished_section
The condition_variable to wake the print thread.
Definition: PerfGraph.h:396
std::atomic< bool > _currently_destructing
True when we stop printing.
unsigned int _last_execution_list_end
Where the end of the execution list was during the last call If this == the current_end...
unsigned long long int numPrinted() const
The number of times something has been printed.
Definition: ConsoleStream.C:68
std::mutex _destructing_mutex
The mutex to use with a condition_variable predicate to guard _destructing.
Definition: PerfGraph.h:393
PerfGraph & _perf_graph
Reference to the PerfGraph to work with.
unsigned int _current_execution_list_last
The actual last entry in the list This is useful because it is a circular queue - so this is not just...
unsigned long long int _console_num_printed
The current output count from the console.
bool _destructing
Tell the print thread to teardown.
Definition: PerfGraph.h:390
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
void inSamePlace()
What to do if we&#39;re still in the same spot.
std::atomic< Real > & _time_limit
Limit (in seconds) before printing.

Member Data Documentation

◆ _app

const MooseApp& PerfGraphLivePrint::_app
private

The app performing this print.

Definition at line 66 of file PerfGraphLivePrint.h.

Referenced by printStats().

◆ _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(), MeshOnlyAction::act(), SetupDebugAction::act(), MaterialOutputAction::act(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), PerfGraph::addToExecutionList(), SimplePredictor::apply(), SystemBase::applyScalingFactors(), MultiApp::backup(), FEProblemBase::backupMultiApps(), CoarsenedPiecewiseLinear::buildCoarsenedGrid(), MeshDiagnosticsGenerator::checkElementOverlap(), MeshDiagnosticsGenerator::checkElementTypes(), MeshDiagnosticsGenerator::checkElementVolumes(), FEProblemBase::checkExceptionAndStopSolve(), SolverSystem::checkInvalidSolution(), MeshDiagnosticsGenerator::checkLocalJacobians(), MeshDiagnosticsGenerator::checkNonConformalMesh(), MeshDiagnosticsGenerator::checkNonConformalMeshFromAdaptivity(), MeshDiagnosticsGenerator::checkNonMatchingEdges(), MeshDiagnosticsGenerator::checkNonPlanarSides(), FEProblemBase::checkProblemIntegrity(), ReferenceResidualConvergence::checkRelativeConvergence(), MeshDiagnosticsGenerator::checkSidesetsOrientation(), MeshDiagnosticsGenerator::checkWatertightNodesets(), MeshDiagnosticsGenerator::checkWatertightSidesets(), IterationAdaptiveDT::computeAdaptiveDT(), TransientBase::computeConstrainedDT(), DefaultMultiAppFixedPointConvergence::computeCustomConvergencePostprocessor(), NonlinearSystemBase::computeDamping(), FixedPointIterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInitialDT(), IterationAdaptiveDT::computeInterpolationDT(), LinearSystem::computeLinearSystemTags(), FEProblemBase::computeLinearSystemTags(), NonlinearSystemBase::computeScaling(), Problem::console(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MFEMSteady::execute(), MessageFromInput::execute(), SteadyBase::execute(), Eigenvalue::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), MeshGeneratorSystem::executeMeshGenerators(), ElementQualityChecker::finalize(), FEProblemBase::finishMultiAppStep(), MeshRepairGenerator::fixOverlappingNodes(), CoarsenBlockGenerator::generate(), MeshGenerator::generateInternal(), VariableCondensationPreconditioner::getDofToCondense(), InversePowerMethod::init(), NonlinearEigen::init(), FEProblemBase::initialAdaptMesh(), DefaultMultiAppFixedPointConvergence::initialize(), EigenExecutionerBase::inversePowerIteration(), FEProblemBase::joinAndFinalize(), TransientBase::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), FEProblemBase::logAdd(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), MooseBaseErrorInterface::mooseDeprecated(), MooseBaseErrorInterface::mooseInfo(), MooseBaseErrorInterface::mooseWarning(), MooseBaseErrorInterface::mooseWarningNonPrefixed(), ReferenceResidualConvergence::nonlinearConvergenceSetup(), ReporterDebugOutput::output(), PerfGraphOutput::output(), SolutionInvalidityOutput::output(), MaterialPropertyDebugOutput::output(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), Console::outputPostprocessors(), PseudoTimestep::outputPseudoTimestep(), Console::outputReporters(), DefaultMultiAppFixedPointConvergence::outputResidualNorm(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), AB2PredictorCorrector::postSolve(), ActionWarehouse::printActionDependencySets(), BlockRestrictionDebugOutput::printBlockRestrictionMap(), SolutionInvalidity::printDebug(), EigenExecutionerBase::printEigenvalue(), SecantSolve::printFixedPointConvergenceHistory(), SteffensenSolve::printFixedPointConvergenceHistory(), PicardSolve::printFixedPointConvergenceHistory(), FixedPointSolve::printFixedPointConvergenceReason(), printLiveMessage(), MaterialPropertyDebugOutput::printMaterialMap(), 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(), EigenProblem::solve(), NonlinearSystem::solve(), LinearSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), LStableDirk4::solve(), AStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), FixedPointSolve::solveStep(), start(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), TransientBase::takeStep(), TerminateChainControl::terminate(), Convergence::verboseOutput(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

◆ _console_num_printed

unsigned long long int PerfGraphLivePrint::_console_num_printed
private

The current output count from the console.

Definition at line 118 of file PerfGraphLivePrint.h.

Referenced by inSamePlace(), printLiveMessage(), printStats(), and start().

◆ _current_execution_list_end

unsigned int PerfGraphLivePrint::_current_execution_list_end
private

The end of the execution list This is (safely) copied from PerfGraph so that it is consistent for an entire iteration.

Definition at line 100 of file PerfGraphLivePrint.h.

Referenced by iterateThroughExecutionList(), and start().

◆ _current_execution_list_last

unsigned int PerfGraphLivePrint::_current_execution_list_last
private

The actual last entry in the list This is useful because it is a circular queue - so this is not just end - 1 (although, often it will be)

Definition at line 105 of file PerfGraphLivePrint.h.

Referenced by start().

◆ _currently_destructing

std::atomic<bool> PerfGraphLivePrint::_currently_destructing
private

True when we stop printing.

NOTE: Even though only one thread is supposed to touch this variable, we make it atomic to avoid potential memory leak errors when testing with libtorch. Doing this is not expected to influence the performance considerably.

Definition at line 83 of file PerfGraphLivePrint.h.

Referenced by start().

◆ _execution_list

std::array<PerfGraph::SectionIncrement, MAX_EXECUTION_LIST_SIZE>& PerfGraphLivePrint::_execution_list
private

Convenience reference to the execution_list within the PerfGraph.

Definition at line 75 of file PerfGraphLivePrint.h.

Referenced by iterateThroughExecutionList().

◆ _last_execution_list_end

unsigned int PerfGraphLivePrint::_last_execution_list_end
private

Where the end of the execution list was during the last call If this == the current_end...

then nothing has happened

Definition at line 109 of file PerfGraphLivePrint.h.

Referenced by iterateThroughExecutionList(), and start().

◆ _last_num_printed

unsigned long long int PerfGraphLivePrint::_last_num_printed
private

The output count from the console the last time we printed.

Definition at line 115 of file PerfGraphLivePrint.h.

Referenced by inSamePlace(), printLiveMessage(), printStats(), and start().

◆ _last_printed_increment

PerfGraph::SectionIncrement* PerfGraphLivePrint::_last_printed_increment
private

Which increment was last printed.

Definition at line 112 of file PerfGraphLivePrint.h.

Referenced by inSamePlace(), printLiveMessage(), and printStats().

◆ _mem_limit

std::atomic<unsigned int>& PerfGraphLivePrint::_mem_limit
private

Limit (in MB)

Definition at line 89 of file PerfGraphLivePrint.h.

Referenced by iterateThroughExecutionList().

◆ _perf_graph

PerfGraph& PerfGraphLivePrint::_perf_graph
private

Reference to the PerfGraph to work with.

Definition at line 69 of file PerfGraphLivePrint.h.

Referenced by iterateThroughExecutionList(), and start().

◆ _perf_graph_registry

const moose::internal::PerfGraphRegistry& PerfGraphLivePrint::_perf_graph_registry
private

Reference to the PerfGraphRegistry for convenience.

Definition at line 72 of file PerfGraphLivePrint.h.

Referenced by inSamePlace(), printLiveMessage(), and printStats().

◆ _print_thread_stack

std::array<PerfGraph::SectionIncrement, MOOSE_MAX_STACK_SIZE> PerfGraphLivePrint::_print_thread_stack
private

The current stack for what the print thread has seen.

Definition at line 95 of file PerfGraphLivePrint.h.

Referenced by inSamePlace(), iterateThroughExecutionList(), and printStackUpToLast().

◆ _stack_level

unsigned int PerfGraphLivePrint::_stack_level
private

This is one beyond the last thing on the stack.

Definition at line 92 of file PerfGraphLivePrint.h.

Referenced by inSamePlace(), iterateThroughExecutionList(), printStackUpToLast(), and printStats().

◆ _stack_top_print_dots

bool PerfGraphLivePrint::_stack_top_print_dots
private

Whether or not the top thing on the stack is set to print dots.

Definition at line 121 of file PerfGraphLivePrint.h.

Referenced by inSamePlace(), and printLiveMessage().

◆ _time_limit

std::atomic<Real>& PerfGraphLivePrint::_time_limit
private

Limit (in seconds) before printing.

Definition at line 86 of file PerfGraphLivePrint.h.

Referenced by iterateThroughExecutionList(), and start().

◆ WRAP_LENGTH

const unsigned int PerfGraphLivePrint::WRAP_LENGTH = 90
private

Number of columns before wrapping.

Definition at line 63 of file PerfGraphLivePrint.h.

Referenced by printStats().


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