The Gaudi Framework  master (9f3f8895)
Loading...
Searching...
No Matches
ProcStats.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11
12#pragma once
13
14// Class: ProcStats
15// Description: Reports the memory usage (virtual size and RSS) of the current process
16// Author: Jim Kowalkowski (FNAL), modified by M. Shapiro (LBNL)
17
18#if defined( __linux__ )
19# include <unistd.h>
20#endif
21
22struct procInfo {
23 double vsize{ 0 }; // virtual memory size, in MB
24 double rss{ 0 }; // resident set size, in MB
25};
26
27class ProcStats {
28
29public:
30 static ProcStats* instance();
34 bool fetch( procInfo& fill_me );
35
36private:
37 ProcStats() = default;
38
39#if defined( __linux__ )
40 long m_pageSize{ sysconf( _SC_PAGESIZE ) };
41#endif
42};
bool fetch(procInfo &fill_me)
Fill fill_me with the current memory usage of this process.
Definition ProcStats.cpp:27
ProcStats()=default
static ProcStats * instance()
Definition ProcStats.cpp:22
double vsize
Definition ProcStats.h:23
double rss
Definition ProcStats.h:24