LCOV - code coverage report
Current view: top level - include/postprocessors - MemoryUsage.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 1 1 100.0 %
Date: 2025-07-17 01:28:37 Functions: 1 1 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 "GeneralPostprocessor.h"
      13             : #include "MemoryUsageReporter.h"
      14             : #include "MemoryUtils.h"
      15             : 
      16             : /**
      17             :  * Output maximum, average, or total process memory usage
      18             :  */
      19             : class MemoryUsage : public GeneralPostprocessor, public MemoryUsageReporter
      20             : {
      21             : public:
      22             :   static InputParameters validParams();
      23             : 
      24             :   MemoryUsage(const InputParameters & parameters);
      25             : 
      26             :   virtual void timestepSetup() override;
      27             : 
      28        1409 :   virtual void initialize() override {}
      29             :   virtual void execute() override;
      30             :   virtual void finalize() override;
      31             :   virtual PostprocessorValue getValue() const override;
      32             : 
      33             : protected:
      34             :   enum class MemType
      35             :   {
      36             :     physical_memory,
      37             :     virtual_memory,
      38             :     page_faults
      39             :   } _mem_type;
      40             : 
      41             :   enum class ValueType
      42             :   {
      43             :     total,
      44             :     average,
      45             :     max_process,
      46             :     min_process
      47             :   } _value_type;
      48             : 
      49             :   /// The unit prefix for the reported memory statistics (kilobyte, megabyte, etc).
      50             :   MemoryUtils::MemUnits _mem_units;
      51             : 
      52             :   /// memory usage metric in bytes
      53             :   Real _value;
      54             : 
      55             :   /// peak memory usage metric in bytes (of multiple samples in the current time step)
      56             :   Real _peak_value;
      57             : 
      58             :   /// report peak value for multiple samples in a time step
      59             :   const bool _report_peak_value;
      60             : };

Generated by: LCOV version 1.14