LCOV - code coverage report
Current view: top level - include/reporters - PerfGraphReporter.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 2 2 100.0 %
Date: 2026-05-29 20:35:17 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 "GeneralReporter.h"
      13             : 
      14             : class PerfNode;
      15             : class PerfGraph;
      16             : 
      17             : /**
      18             :  * Reports the full graph from the PerfGraph
      19             :  */
      20             : class PerfGraphReporter : public GeneralReporter
      21             : {
      22             : public:
      23             :   static InputParameters validParams();
      24             : 
      25             :   PerfGraphReporter(const InputParameters & parameters);
      26             : 
      27          42 :   void initialize() override {}
      28             :   void finalize() override;
      29          42 :   void execute() override {}
      30             : 
      31             :   /// The reporter values that this object declares; used within the
      32             :   /// CommonOutputAction to single out values from this reporter
      33             :   static const std::vector<ReporterValueName> value_names;
      34             : 
      35             :   /**
      36             :    * Structure that holds the PerfGraph in JSON.
      37             :    *
      38             :    * We build the JSON itself during execute() as it is
      39             :    * a complex tree and it's easier to not have an intermediate
      40             :    * data type.
      41             :    */
      42             :   struct PerfGraphJSON
      43             :   {
      44             :     nlohmann::json value;
      45             :   };
      46             : 
      47             : private:
      48             :   /// "graph" entry in the reporter; the actual graph
      49             :   PerfGraphJSON & _graph;
      50             :   /// "_max_memory_this_proc" entry in the reporter; max memory for this rank
      51             :   std::size_t & _max_memory_this_rank;
      52             :   /// "max_memory_per_proc" entry in the reporter; max memory across all ranks
      53             :   std::vector<std::size_t> & _max_memory_per_rank;
      54             : };
      55             : 
      56             : void to_json(nlohmann::json & json, const PerfGraphReporter::PerfGraphJSON & perf_graph_json);
      57             : 
      58             : /**
      59             :  * Store and load methods for const PerfGraph *, used in the PerfGraphReporter,
      60             :  * which do nothing.
      61             :  *
      62             :  * They do nothing because the recover capability is retained in the
      63             :  * PerfGraph itself, which will recover and append a previously ran
      64             :  * graph to the current PerfGraph.
      65             :  */
      66             : ///@{
      67             : void dataStore(std::ostream &, PerfGraphReporter::PerfGraphJSON &, void *);
      68             : void dataLoad(std::istream &, PerfGraphReporter::PerfGraphJSON &, void *);
      69             : ///@}

Generated by: LCOV version 1.14