chombo-discharge
Loading...
Searching...
No Matches
CD_MemoryReport.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_MEMORYREPORT_H
14#define CD_MEMORYREPORT_H
15
16// Std includes
17#include <iosfwd>
18#include <string>
19
20// Chombo includes
21#include <REAL.H>
22#include <Vector.H>
23
24// Our includes
25#include <CD_ParticleMemory.H>
26#include <CD_NamespaceHeader.H>
27
31namespace MemoryReport {
32
36void
38
46void
47getMaxMinMemoryUsage(Real& a_maxPeak, Real& a_minPeak, Real& a_maxUnfreed, Real& a_minUnfreed);
48
55void
56getMemoryUsage(Vector<Real>& a_peak, Vector<Real>& a_unfreed);
57
72void
73getResidentSetSize(Real& a_currentRSS, Real& a_peakRSS);
74
84void
85getMaxMinResidentSetSize(Real& a_maxCurrent, Real& a_minCurrent, Real& a_maxPeak, Real& a_minPeak);
86
97std::string
98bytesAsMB(const long long a_bytes);
99
106std::string
107bytesAsMB(const Real a_bytes);
108
132void
133printMemoryTable(std::ostream& a_out, const std::string& a_indent);
134} // namespace MemoryReport
135
136#include <CD_NamespaceFooter.H>
137
138#endif
Process-wide accounting of the memory held by particle data.
Namespace containing utility functions for reporting memory usage in various formats.
Definition CD_MemoryReport.H:31
void getResidentSetSize(Real &a_currentRSS, Real &a_peakRSS)
Get the calling process' current and peak resident set size.
Definition CD_MemoryReport.cpp:134
void getMaxMinResidentSetSize(Real &a_maxCurrent, Real &a_minCurrent, Real &a_maxPeak, Real &a_minPeak)
Get the global maximum and minimum resident set size over all ranks.
Definition CD_MemoryReport.cpp:170
std::string bytesAsMB(const long long a_bytes)
Format a byte count as megabytes for a report line.
Definition CD_MemoryReport.cpp:186
void getMemoryUsage(Vector< Real > &a_peak, Vector< Real > &a_unfreed)
Get peak and unfreed memory usage per rank.
Definition CD_MemoryReport.cpp:92
void getMaxMinMemoryUsage()
Print the global maximum and minimum memory usage. This includes peak memory and unfreed memory.
Definition CD_MemoryReport.cpp:32
void printMemoryTable(std::ostream &a_out, const std::string &a_indent)
Write the full memory report as a table.
Definition CD_MemoryReport.cpp:204