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>
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 §ion_increment) |
Print the live message. More... | |
void | printStats (PerfGraph::SectionIncrement §ion_increment_start, PerfGraph::SectionIncrement §ion_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... | |
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.
Definition at line 14 of file PerfGraphLivePrint.C.
|
private |
What to do if we're still in the same spot.
Definition at line 210 of file PerfGraphLivePrint.C.
Referenced by start().
|
private |
What to do if there are new things in the execution list.
Definition at line 241 of file PerfGraphLivePrint.C.
Referenced by start().
|
private |
Print the live message.
Definition at line 35 of file PerfGraphLivePrint.C.
Referenced by inSamePlace(), and printStackUpToLast().
|
private |
Print everything underneath the current top of the stack.
Definition at line 191 of file PerfGraphLivePrint.C.
Referenced by inSamePlace(), and iterateThroughExecutionList().
|
private |
Print the stats.
Definition at line 119 of file PerfGraphLivePrint.C.
Referenced by iterateThroughExecutionList().
void PerfGraphLivePrint::start | ( | ) |
Start printing.
Definition at line 295 of file PerfGraphLivePrint.C.
|
private |
The app performing this print.
Definition at line 66 of file PerfGraphLivePrint.h.
Referenced by printStats().
|
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().
|
private |
The current output count from the console.
Definition at line 118 of file PerfGraphLivePrint.h.
Referenced by inSamePlace(), printLiveMessage(), printStats(), and start().
|
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().
|
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().
|
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().
|
private |
Convenience reference to the execution_list within the PerfGraph.
Definition at line 75 of file PerfGraphLivePrint.h.
Referenced by iterateThroughExecutionList().
|
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().
|
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().
|
private |
Which increment was last printed.
Definition at line 112 of file PerfGraphLivePrint.h.
Referenced by inSamePlace(), printLiveMessage(), and printStats().
|
private |
Limit (in MB)
Definition at line 89 of file PerfGraphLivePrint.h.
Referenced by iterateThroughExecutionList().
|
private |
Reference to the PerfGraph to work with.
Definition at line 69 of file PerfGraphLivePrint.h.
Referenced by iterateThroughExecutionList(), and start().
|
private |
Reference to the PerfGraphRegistry for convenience.
Definition at line 72 of file PerfGraphLivePrint.h.
Referenced by inSamePlace(), printLiveMessage(), and printStats().
|
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().
|
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().
|
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().
|
private |
Limit (in seconds) before printing.
Definition at line 86 of file PerfGraphLivePrint.h.
Referenced by iterateThroughExecutionList(), and start().
|
private |
Number of columns before wrapping.
Definition at line 63 of file PerfGraphLivePrint.h.
Referenced by printStats().