LCOV - code coverage report
Current view: top level - src/interfaces - PerfGraphInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33416 (b10b36) with base 9fbd27 Lines: 38 38 100.0 %
Date: 2026-07-23 16:15:30 Functions: 10 10 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      355342 : PerfGraphInterface::validParams()
      17             : {
      18      355342 :   InputParameters params = emptyInputParameters();
      19      355342 :   return params;
      20             : }
      21             : 
      22      871658 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object)
      23      871658 :   : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>(
      24             :         MooseBase::app_param, "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
      25     1743316 :     _prefix(moose_object->type())
      26             : {
      27      871658 : }
      28             : 
      29       24380 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object, const std::string prefix)
      30       24380 :   : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>(
      31             :         MooseBase::app_param, "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
      32       48760 :     _prefix(prefix)
      33             : {
      34       24380 : }
      35             : 
      36      136206 : PerfGraphInterface::PerfGraphInterface(MooseApp & moose_app, const std::string prefix)
      37      136206 :   : _pg_moose_app(moose_app), _prefix(prefix)
      38             : {
      39      136206 : }
      40             : 
      41     3880015 : PerfGraphInterface::PerfGraphInterface(PerfGraph & perf_graph, const std::string prefix)
      42     3880015 :   : _pg_moose_app(perf_graph.mooseApp()), _prefix(prefix)
      43             : {
      44     3880015 : }
      45             : 
      46             : #ifdef MOOSE_KOKKOS_ENABLED
      47        7983 : PerfGraphInterface::PerfGraphInterface(const PerfGraphInterface & object,
      48        7983 :                                        const Moose::Kokkos::FunctorCopy &)
      49        7983 :   : _pg_moose_app(object._pg_moose_app), _prefix(object._prefix)
      50             : {
      51        7983 : }
      52             : #endif
      53             : 
      54             : std::string
      55    86807111 : PerfGraphInterface::timedSectionName(const std::string & section_name) const
      56             : {
      57    86807111 :   return _prefix.empty() ? "" : (_prefix + "::") + section_name;
      58             : }
      59             : 
      60             : PerfID
      61    60429248 : PerfGraphInterface::registerTimedSection(const std::string & section_name,
      62             :                                          const unsigned int level) const
      63             : {
      64    60429248 :   const auto timed_section_name = timedSectionName(section_name);
      65    60429248 :   if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
      66     4166138 :     return moose::internal::getPerfGraphRegistry().registerSection(timed_section_name, level);
      67             :   else
      68    56263110 :     return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
      69    60429248 : }
      70             : 
      71             : PerfID
      72    23400188 : PerfGraphInterface::registerTimedSection(const std::string & section_name,
      73             :                                          const unsigned int level,
      74             :                                          const std::string & live_message,
      75             :                                          const bool print_dots) const
      76             : {
      77    23400188 :   const auto timed_section_name = timedSectionName(section_name);
      78    23400188 :   if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
      79     5955350 :     return moose::internal::getPerfGraphRegistry().registerSection(
      80     5955350 :         timedSectionName(section_name), level, live_message, print_dots);
      81             :   else
      82    20422513 :     return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
      83    23400188 : }
      84             : 
      85             : PerfGraph &
      86      232422 : PerfGraphInterface::perfGraph()
      87             : {
      88      232422 :   return _pg_moose_app.perfGraph();
      89             : }

Generated by: LCOV version 1.14