LCOV - code coverage report
Current view: top level - src/interfaces - PerfGraphInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32463 (9b8a52) with base a052fd Lines: 38 38 100.0 %
Date: 2026-05-26 14:49:46 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      349323 : PerfGraphInterface::validParams()
      17             : {
      18      349323 :   InputParameters params = emptyInputParameters();
      19      349323 :   return params;
      20             : }
      21             : 
      22      854872 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object)
      23      854872 :   : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>(
      24             :         MooseBase::app_param, "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
      25     1709744 :     _prefix(moose_object->type())
      26             : {
      27      854872 : }
      28             : 
      29       24023 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object, const std::string prefix)
      30       24023 :   : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>(
      31             :         MooseBase::app_param, "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
      32       48046 :     _prefix(prefix)
      33             : {
      34       24023 : }
      35             : 
      36      134012 : PerfGraphInterface::PerfGraphInterface(MooseApp & moose_app, const std::string prefix)
      37      134012 :   : _pg_moose_app(moose_app), _prefix(prefix)
      38             : {
      39      134012 : }
      40             : 
      41     3759483 : PerfGraphInterface::PerfGraphInterface(PerfGraph & perf_graph, const std::string prefix)
      42     3759483 :   : _pg_moose_app(perf_graph.mooseApp()), _prefix(prefix)
      43             : {
      44     3759483 : }
      45             : 
      46             : #ifdef MOOSE_KOKKOS_ENABLED
      47        7931 : PerfGraphInterface::PerfGraphInterface(const PerfGraphInterface & object,
      48        7931 :                                        const Moose::Kokkos::FunctorCopy &)
      49        7931 :   : _pg_moose_app(object._pg_moose_app), _prefix(object._prefix)
      50             : {
      51        7931 : }
      52             : #endif
      53             : 
      54             : std::string
      55    86553362 : PerfGraphInterface::timedSectionName(const std::string & section_name) const
      56             : {
      57    86553362 :   return _prefix.empty() ? "" : (_prefix + "::") + section_name;
      58             : }
      59             : 
      60             : PerfID
      61    60285113 : PerfGraphInterface::registerTimedSection(const std::string & section_name,
      62             :                                          const unsigned int level) const
      63             : {
      64    60285113 :   const auto timed_section_name = timedSectionName(section_name);
      65    60285113 :   if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
      66     4047222 :     return moose::internal::getPerfGraphRegistry().registerSection(timed_section_name, level);
      67             :   else
      68    56237891 :     return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
      69    60285113 : }
      70             : 
      71             : PerfID
      72    23301260 : 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    23301260 :   const auto timed_section_name = timedSectionName(section_name);
      78    23301260 :   if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
      79     5933978 :     return moose::internal::getPerfGraphRegistry().registerSection(
      80     5933978 :         timedSectionName(section_name), level, live_message, print_dots);
      81             :   else
      82    20334271 :     return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
      83    23301260 : }
      84             : 
      85             : PerfGraph &
      86      229448 : PerfGraphInterface::perfGraph()
      87             : {
      88      229448 :   return _pg_moose_app.perfGraph();
      89             : }

Generated by: LCOV version 1.14