LCOV - code coverage report
Current view: top level - src/interfaces - PerfGraphInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 38 38 100.0 %
Date: 2026-05-29 20:35:17 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      349301 : PerfGraphInterface::validParams()
      17             : {
      18      349301 :   InputParameters params = emptyInputParameters();
      19      349301 :   return params;
      20             : }
      21             : 
      22      854753 : PerfGraphInterface::PerfGraphInterface(const MooseObject * moose_object)
      23      854753 :   : _pg_moose_app(*moose_object->parameters().getCheckedPointerParam<MooseApp *>(
      24             :         MooseBase::app_param, "PerfGraphInterface is unable to retrieve the MooseApp pointer!")),
      25     1709506 :     _prefix(moose_object->type())
      26             : {
      27      854753 : }
      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      133990 : PerfGraphInterface::PerfGraphInterface(MooseApp & moose_app, const std::string prefix)
      37      133990 :   : _pg_moose_app(moose_app), _prefix(prefix)
      38             : {
      39      133990 : }
      40             : 
      41     3758759 : PerfGraphInterface::PerfGraphInterface(PerfGraph & perf_graph, const std::string prefix)
      42     3758759 :   : _pg_moose_app(perf_graph.mooseApp()), _prefix(prefix)
      43             : {
      44     3758759 : }
      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    86515108 : PerfGraphInterface::timedSectionName(const std::string & section_name) const
      56             : {
      57    86515108 :   return _prefix.empty() ? "" : (_prefix + "::") + section_name;
      58             : }
      59             : 
      60             : PerfID
      61    60255995 : PerfGraphInterface::registerTimedSection(const std::string & section_name,
      62             :                                          const unsigned int level) const
      63             : {
      64    60255995 :   const auto timed_section_name = timedSectionName(section_name);
      65    60255995 :   if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
      66     4046406 :     return moose::internal::getPerfGraphRegistry().registerSection(timed_section_name, level);
      67             :   else
      68    56209589 :     return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
      69    60255995 : }
      70             : 
      71             : PerfID
      72    23292698 : 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    23292698 :   const auto timed_section_name = timedSectionName(section_name);
      78    23292698 :   if (!moose::internal::getPerfGraphRegistry().sectionExists(timed_section_name))
      79     5932830 :     return moose::internal::getPerfGraphRegistry().registerSection(
      80     5932830 :         timedSectionName(section_name), level, live_message, print_dots);
      81             :   else
      82    20326283 :     return moose::internal::getPerfGraphRegistry().sectionID(timed_section_name);
      83    23292698 : }
      84             : 
      85             : PerfGraph &
      86      229415 : PerfGraphInterface::perfGraph()
      87             : {
      88      229415 :   return _pg_moose_app.perfGraph();
      89             : }

Generated by: LCOV version 1.14