Line data Source code
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 : #include "PerfGraphInterface.h" 11 : #include "PerfGraphRegistry.h" 12 : 13 : #include "MooseApp.h" 14 : 15 : InputParameters 16 455660 : PerfGraphInterface::validParams() 17 : { 18 455660 : InputParameters params = emptyInputParameters(); 19 455660 : return params; 20 : } 21 : 22 904322 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object) 23 904322 : : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>( 24 : MooseBase::app_param, "PerfGraphInterface is unable to retrieve the MooseApp pointer!")), 25 1808644 : _prefix(moose_object->type()) 26 : { 27 904322 : } 28 : 29 23567 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object, const std::string prefix) 30 23567 : : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>( 31 : MooseBase::app_param, "PerfGraphInterface is unable to retrieve the MooseApp pointer!")), 32 47134 : _prefix(prefix) 33 : { 34 23567 : } 35 : 36 140148 : PerfGraphInterface::PerfGraphInterface(MooseApp & moose_app, const std::string prefix) 37 140148 : : _pg_moose_app(moose_app), _prefix(prefix) 38 : { 39 140148 : } 40 : 41 3922425 : PerfGraphInterface::PerfGraphInterface(PerfGraph & perf_graph, const std::string prefix) 42 3922425 : : _pg_moose_app(perf_graph.mooseApp()), _prefix(prefix) 43 : { 44 3922425 : } 45 : 46 : std::string 47 105359411 : PerfGraphInterface::timedSectionName(const std::string & section_name) const 48 : { 49 105359411 : return _prefix.empty() ? "" : (_prefix + "::") + section_name; 50 : } 51 : 52 : PerfID 53 64471168 : PerfGraphInterface::registerTimedSection(const std::string & section_name, 54 : const unsigned int level) const 55 : { 56 64471168 : const auto timed_section_name = timedSectionName(section_name); 57 64471168 : if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name)) 58 4229871 : return moose::internal::getPerfGraphRegistry().registerSection(timed_section_name, level); 59 : else 60 60241297 : return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name); 61 64471168 : } 62 : 63 : PerfID 64 37789116 : PerfGraphInterface::registerTimedSection(const std::string & section_name, 65 : const unsigned int level, 66 : const std::string & live_message, 67 : const bool print_dots) const 68 : { 69 37789116 : const auto timed_section_name = timedSectionName(section_name); 70 37789116 : if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name)) 71 6198254 : return moose::internal::getPerfGraphRegistry().registerSection( 72 6198254 : timedSectionName(section_name), level, live_message, print_dots); 73 : else 74 34689989 : return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name); 75 37789116 : } 76 : 77 : PerfGraph & 78 192832 : PerfGraphInterface::perfGraph() 79 : { 80 192832 : return _pg_moose_app.perfGraph(); 81 : }