www.mooseframework.org
MemoryUsage.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 class MemoryUsage;
17 
18 template <>
20 
25 {
26 public:
28 
29  virtual void timestepSetup() override;
30 
31  virtual void initialize() override {}
32  virtual void execute() override;
33  virtual void finalize() override;
34  virtual PostprocessorValue getValue() override;
35 
36 protected:
37  enum class MemType
38  {
42  } _mem_type;
43 
44  enum class ValueType
45  {
46  total,
47  average,
50  } _value_type;
51 
54 
56  Real _value;
57 
60 
62  const bool _report_peak_value;
63 };
64 
MemoryUsage(const InputParameters &parameters)
Definition: MemoryUsage.C:39
virtual PostprocessorValue getValue() override
This will get called to actually grab the final value the postprocessor has calculated.
Definition: MemoryUsage.C:113
enum MemoryUsage::MemType _mem_type
InputParameters validParams< MemoryUsage >()
Definition: MemoryUsage.C:19
Real _value
memory usage metric in bytes
Definition: MemoryUsage.h:56
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
MemoryUtils::MemUnits _mem_units
The unit prefix for the reported memory statistics (kilobyte, megabyte, etc).
Definition: MemoryUsage.h:53
Mix-in class for querying memory metrics used by MemoryUsage and VectorMemoryUsage.
virtual void timestepSetup() override
Gets called at the beginning of the timestep before this object is asked to do its job...
Definition: MemoryUsage.C:52
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:65
Real PostprocessorValue
MOOSE typedefs.
Definition: MooseTypes.h:154
Output maximum, average, or total process memory usage.
Definition: MemoryUsage.h:24
virtual void execute() override
Execute method.
Definition: MemoryUsage.C:58
Real _peak_value
peak memory usage metric in bytes (of multiple samples in the current time step)
Definition: MemoryUsage.h:59
const bool _report_peak_value
report peak value for multiple samples in a time step
Definition: MemoryUsage.h:62
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
Definition: MemoryUsage.h:31
enum MemoryUsage::ValueType _value_type
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
Definition: MemoryUsage.C:82