LCOV - code coverage report
Current view: top level - src/interfaces - PerfGraphInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 34 34 100.0 %
Date: 2025-07-17 01:28:37 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      342927 : PerfGraphInterface::validParams()
      17             : {
      18      342927 :   InputParameters params = emptyInputParameters();
      19      342927 :   return params;
      20             : }
      21             : 
      22      776850 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object)
      23      776850 :   : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>(
      24             :         "_moose_app", "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
      25     1553700 :     _prefix(moose_object->type())
      26             : {
      27      776850 : }
      28             : 
      29       21615 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object, const std::string prefix)
      30       21615 :   : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>(
      31             :         "_moose_app", "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
      32       43230 :     _prefix(prefix)
      33             : {
      34       21615 : }
      35             : 
      36      125510 : PerfGraphInterface::PerfGraphInterface(MooseApp & moose_app, const std::string prefix)
      37      125510 :   : _pg_moose_app(moose_app), _prefix(prefix)
      38             : {
      39      125510 : }
      40             : 
      41     3429484 : PerfGraphInterface::PerfGraphInterface(PerfGraph & perf_graph, const std::string prefix)
      42     3429484 :   : _pg_moose_app(perf_graph.mooseApp()), _prefix(prefix)
      43             : {
      44     3429484 : }
      45             : 
      46             : std::string
      47    93819726 : PerfGraphInterface::timedSectionName(const std::string & section_name) const
      48             : {
      49   187639452 :   return _prefix.empty() ? "" : (_prefix + "::") + section_name;
      50             : }
      51             : 
      52             : PerfID
      53    56908329 : PerfGraphInterface::registerTimedSection(const std::string & section_name,
      54             :                                          const unsigned int level) const
      55             : {
      56    56908329 :   const auto timed_section_name = timedSectionName(section_name);
      57    56908329 :   if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
      58     3690088 :     return moose::internal::getPerfGraphRegistry().registerSection(timed_section_name, level);
      59             :   else
      60    53218241 :     return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
      61    56908329 : }
      62             : 
      63             : PerfID
      64    34172497 : 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    34172497 :   const auto timed_section_name = timedSectionName(section_name);
      70    34172497 :   if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
      71     5477800 :     return moose::internal::getPerfGraphRegistry().registerSection(
      72     5477800 :         timedSectionName(section_name), level, live_message, print_dots);
      73             :   else
      74    31433597 :     return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
      75    34172497 : }
      76             : 
      77             : PerfGraph &
      78      172335 : PerfGraphInterface::perfGraph()
      79             : {
      80      172335 :   return _pg_moose_app.perfGraph();
      81             : }

Generated by: LCOV version 1.14