LCOV - code coverage report
Current view: top level - include/utils - PerfGuard.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 2 2 100.0 %
Date: 2025-07-17 01:28:37 Functions: 2 2 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             : #pragma once
      11             : 
      12             : #include "MooseTypes.h"
      13             : #include "PerfGraph.h"
      14             : 
      15             : /**
      16             :  * Scope guard for starting and stopping timing for a node
      17             :  *
      18             :  * Note that the PerfGuard timing itself will take
      19             :  * approximately 0.00015 milliseconds.
      20             :  *
      21             :  * That might not sound very long - but you still don't want
      22             :  * that in the inside of tiny loops
      23             :  */
      24             : class PerfGuard
      25             : {
      26             : public:
      27             :   /**
      28             :    * Start timing for the given ID
      29             :    *
      30             :    * @param graph The graph to add time into
      31             :    * @param id The unique id of the section
      32             :    */
      33    93256888 :   PerfGuard(PerfGraph & graph, const PerfID id) : _graph(graph) { _graph.push(id); }
      34             : 
      35             :   /**
      36             :    * Stop timing
      37             :    */
      38    93239038 :   ~PerfGuard() { _graph.pop(); }
      39             : 
      40             : protected:
      41             :   ///The graph we're working on
      42             :   PerfGraph & _graph;
      43             : };

Generated by: LCOV version 1.14