ATLAS Offline Software
Loading...
Searching...
No Matches
python.utils.AtlRunQueryMemUtil Namespace Reference

Functions

 _VmB (VmKey)
 memory (since=0.0)
 resident (since=0.0)
 stacksize (since=0.0)

Variables

str _proc_status = '/proc/%d/status' % os.getpid()
dict _scale

Function Documentation

◆ _VmB()

python.utils.AtlRunQueryMemUtil._VmB ( VmKey)
protected
Private.

Definition at line 10 of file AtlRunQueryMemUtil.py.

10def _VmB(VmKey):
11 '''Private.
12 '''
13 # get pseudo file /proc/<pid>/status
14 try:
15 t = open(_proc_status)
16 v = t.read()
17 t.close()
18 except (OSError,ValueError):
19 return 0.0 # non-Linux?
20 # get VmKey line e.g. 'VmRSS: 9999 kB\n ...'
21 i = v.index(VmKey)
22 v = v[i:].split(None, 3) # whitespace
23 if len(v) < 3:
24 return 0.0 # invalid format?
25 # convert Vm value to bytes
26 return float(v[1]) * _scale[v[2]]
27
28
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177

◆ memory()

python.utils.AtlRunQueryMemUtil.memory ( since = 0.0)
Return memory usage in bytes.

Definition at line 29 of file AtlRunQueryMemUtil.py.

29def memory(since=0.0):
30 '''Return memory usage in bytes.
31 '''
32 return _VmB('VmSize:') - since
33
34

◆ resident()

python.utils.AtlRunQueryMemUtil.resident ( since = 0.0)
Return resident memory usage in bytes.

Definition at line 35 of file AtlRunQueryMemUtil.py.

35def resident(since=0.0):
36 '''Return resident memory usage in bytes.
37 '''
38 return _VmB('VmRSS:') - since
39
40

◆ stacksize()

python.utils.AtlRunQueryMemUtil.stacksize ( since = 0.0)
Return stack size in bytes.

Definition at line 41 of file AtlRunQueryMemUtil.py.

41def stacksize(since=0.0):
42 '''Return stack size in bytes.
43 '''
44 return _VmB('VmStk:') - since

Variable Documentation

◆ _proc_status

str python.utils.AtlRunQueryMemUtil._proc_status = '/proc/%d/status' % os.getpid()
protected

Definition at line 5 of file AtlRunQueryMemUtil.py.

◆ _scale

dict python.utils.AtlRunQueryMemUtil._scale
protected
Initial value:
1= {'kB': 1024.0, 'mB': 1024.0*1024.0,
2 'KB': 1024.0, 'MB': 1024.0*1024.0}

Definition at line 7 of file AtlRunQueryMemUtil.py.