https://mooseframework.inl.gov
PerfGraphLivePrint.h
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 #pragma once
11 
12 #include "PerfGraph.h"
13 
14 namespace moose
15 {
16 namespace internal
17 {
18 class PerfGraphRegistry;
19 }
20 }
21 
28 {
29 public:
30  PerfGraphLivePrint(PerfGraph & perf_graph, MooseApp & app);
31 
33  void start();
34 
35 private:
39  void printLiveMessage(PerfGraph::SectionIncrement & section_increment);
40 
44  void printStats(PerfGraph::SectionIncrement & section_increment_start,
45  PerfGraph::SectionIncrement & section_increment_finish);
46 
50  void printStackUpToLast();
51 
55  void inSamePlace();
56 
61 
63  const unsigned int WRAP_LENGTH = 90;
64 
66  const MooseApp & _app;
67 
70 
73 
75  std::array<PerfGraph::SectionIncrement, MAX_EXECUTION_LIST_SIZE> & _execution_list;
76 
83  std::atomic<bool> _currently_destructing;
84 
86  std::atomic<Real> & _time_limit;
87 
89  std::atomic<unsigned int> & _mem_limit;
90 
92  unsigned int _stack_level;
93 
95  std::array<PerfGraph::SectionIncrement, MOOSE_MAX_STACK_SIZE> _print_thread_stack;
96 
101 
106 
110 
113 
115  unsigned long long int _last_num_printed;
116 
118  unsigned long long int _console_num_printed;
119 
122 };
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.
The place where all timed sections will be stored.
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.
Base class for MOOSE-based applications.
Definition: MooseApp.h:85
Use to hold an increment of time and memory for a section This is used in the LivePrint capability...
Definition: PerfGraph.h:257
const unsigned int WRAP_LENGTH
Number of columns before wrapping.
PerfGraphLivePrint(PerfGraph &perf_graph, MooseApp &app)
std::atomic< bool > _currently_destructing
True when we stop printing.
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.
An inteface for the _console for outputting to the Console object.
This is effectively a functor that runs on a separate thread and watches the state of the call stack ...
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.
void start()
Start printing.
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.
void inSamePlace()
What to do if we&#39;re still in the same spot.
unsigned int _stack_level
This is one beyond the last thing on the stack.
The PerfGraph will hold the master list of all registered performance segments and the head PerfNode...
Definition: PerfGraph.h:43
std::atomic< Real > & _time_limit
Limit (in seconds) before printing.