ATLAS Offline Software
Loading...
Searching...
No Matches
InnerDetector
InDetDigitization
SCT_Digitization
src
getMemUsage.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
getMemUsage.h
"
6
#include <unistd.h>
7
#include <iostream>
8
#include <fstream>
9
#include <string>
10
11
namespace
PSUtils
12
{
13
MemStruct
getMemUsage
()
14
{
15
int
pid = getpid();
16
const
std::string ost=
"/proc/"
+std::to_string(pid)+
"/statm"
;
17
std::ifstream ifile( ost.c_str(), std::ifstream::in );
18
19
MemStruct
ms;
20
ifile>>ms;
21
ifile.close();
22
return
ms;
23
}
24
25
std::ostream&
operator<<
(std::ostream& os,
const
MemStruct
& s)
26
{
27
// sizes in pages
28
29
os <<
30
" totalSize "
<<s.totalSize<<
31
" physicalMemSize "
<<s.physicalMemSize<<
32
" sharedMemSize "
<<s.sharedMemSize<<
33
" stackSize "
<<s.stackSize;
34
return
os;
35
}
36
std::istream&
operator>>
(std::istream& is,
MemStruct
& s)
37
{
38
is
39
>>s.totalSize
40
>>s.physicalMemSize
41
>>s.sharedMemSize
42
>>s.textSize
43
>>s.sharedLibSize
44
>>s.stackSize
45
>>s.nDirtyPages;
46
return
is;
47
}
48
}
getMemUsage.h
PSUtils
Definition
getMemUsage.cxx:12
PSUtils::getMemUsage
MemStruct getMemUsage()
Definition
getMemUsage.cxx:13
PSUtils::operator<<
std::ostream & operator<<(std::ostream &os, const MemStruct &s)
Definition
getMemUsage.cxx:25
PSUtils::operator>>
std::istream & operator>>(std::istream &is, MemStruct &s)
Definition
getMemUsage.cxx:36
PSUtils::MemStruct
Definition
getMemUsage.h:14
Generated on
for ATLAS Offline Software by
1.14.0