https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
14namespace moose
15{
16namespace internal
17{
18class PerfGraphRegistry;
19}
20}
21
28{
29public:
30 PerfGraphLivePrint(PerfGraph & perf_graph, MooseApp & app);
31
33 void start();
34
35private:
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};
An inteface for the _console for outputting to the Console object.
Base class for MOOSE-based applications.
Definition MooseApp.h:110
This is effectively a functor that runs on a separate thread and watches the state of the call stack ...
bool _stack_top_print_dots
Whether or not the top thing on the stack is set to print dots.
std::atomic< bool > _currently_destructing
True when we stop printing.
void inSamePlace()
What to do if we're still in the same spot.
void start()
Start printing.
const unsigned int WRAP_LENGTH
Number of columns before wrapping.
unsigned long long int _last_num_printed
The output count from the console the last time we printed.
std::array< PerfGraph::SectionIncrement, MOOSE_MAX_STACK_SIZE > _print_thread_stack
The current stack for what the print thread has seen.
void iterateThroughExecutionList()
What to do if there are new things in the execution list.
std::atomic< unsigned int > & _mem_limit
Limit (in MB)
void printLiveMessage(PerfGraph::SectionIncrement &section_increment)
Print the live message.
void printStackUpToLast()
Print everything underneath the current top of the stack.
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.
unsigned int _last_execution_list_end
Where the end of the execution list was during the last call If this == the current_end....
const MooseApp & _app
The app performing this print.
void printStats(PerfGraph::SectionIncrement &section_increment_start, PerfGraph::SectionIncrement &section_increment_finish)
Print the stats.
std::atomic< Real > & _time_limit
Limit (in seconds) before printing.
PerfGraph::SectionIncrement * _last_printed_increment
Which increment was last 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 ...
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.
std::array< PerfGraph::SectionIncrement, MAX_EXECUTION_LIST_SIZE > & _execution_list
Convenience reference to the execution_list within the PerfGraph.
PerfGraph & _perf_graph
Reference to the PerfGraph to work with.
Use to hold an increment of time and memory for a section This is used in the LivePrint capability.
Definition PerfGraph.h:265
The PerfGraph will hold the master list of all registered performance segments and the head PerfNode.
Definition PerfGraph.h:44
The place where all timed sections will be stored.