LCOV - code coverage report
Current view: top level - src/interfaces - PerfGraphInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: fef103 Lines: 34 34 100.0 %
Date: 2025-09-03 20:01:23 Functions: 9 9 100.0 %
Legend: Lines: hit not hit

          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      443671 : PerfGraphInterface::validParams()
      17             : {
      18      443671 :   InputParameters params = emptyInputParameters();
      19      443671 :   return params;
      20             : }
      21             : 
      22      883751 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object)
      23      883751 :   : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>(
      24             :         MooseBase::app_param, "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
      25     1767502 :     _prefix(moose_object->type())
      26             : {
      27      883751 : }
      28             : 
      29       23453 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object, const std::string prefix)
      30       23453 :   : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>(
      31             :         MooseBase::app_param, "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
      32       46906 :     _prefix(prefix)
      33             : {
      34       23453 : }
      35             : 
      36      136920 : PerfGraphInterface::PerfGraphInterface(MooseApp & moose_app, const std::string prefix)
      37      136920 :   : _pg_moose_app(moose_app), _prefix(prefix)
      38             : {
      39      136920 : }
      40             : 
      41     3773839 : PerfGraphInterface::PerfGraphInterface(PerfGraph & perf_graph, const std::string prefix)
      42     3773839 :   : _pg_moose_app(perf_graph.mooseApp()), _prefix(prefix)
      43             : {
      44     3773839 : }
      45             : 
      46             : std::string
      47   102116562 : PerfGraphInterface::timedSectionName(const std::string & section_name) const
      48             : {
      49   102116562 :   return _prefix.empty() ? "" : (_prefix + "::") + section_name;
      50             : }
      51             : 
      52             : PerfID
      53    61845782 : PerfGraphInterface::registerTimedSection(const std::string & section_name,
      54             :                                          const unsigned int level) const
      55             : {
      56    61845782 :   const auto timed_section_name = timedSectionName(section_name);
      57    61845782 :   if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
      58     4058262 :     return moose::internal::getPerfGraphRegistry().registerSection(timed_section_name, level);
      59             :   else
      60    57787520 :     return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
      61    61845782 : }
      62             : 
      63             : PerfID
      64    37245346 : 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    37245346 :   const auto timed_section_name = timedSectionName(section_name);
      70    37245346 :   if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
      71     6050868 :     return moose::internal::getPerfGraphRegistry().registerSection(
      72     6050868 :         timedSectionName(section_name), level, live_message, print_dots);
      73             :   else
      74    34219912 :     return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
      75    37245346 : }
      76             : 
      77             : PerfGraph &
      78      188971 : PerfGraphInterface::perfGraph()
      79             : {
      80      188971 :   return _pg_moose_app.perfGraph();
      81             : }

Generated by: LCOV version 1.14