Gaudi Framework, version v23r9
Home
Generated: Thu Jul 18 2013
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
GaudiAud
src
ProcStats.h
Go to the documentation of this file.
1
// $Id: ProcStats.h,v 1.2 2004/06/08 13:40:07 mato Exp $
2
#ifndef GAUDIAUD_PROCSTATS_H
3
#define GAUDIAUD_PROCSTATS_H
4
5
// Class: ProcStats
6
// Description: Keeps statistics on memory usage
7
// Author: Jim Kowalkowski (FNAL), modified by M. Shapiro (LBNL)
8
9
#include <
string
>
10
#include <
vector
>
11
12
struct
procInfo
13
{
14
procInfo
() :
vsize
(0),
rss
(0) {}
15
procInfo
(
double
sz,
double
rss_sz):
vsize
(sz),
rss
(rss_sz) {}
16
17
bool
operator==
(
const
procInfo
& p)
const
{
18
#ifdef __ICC
19
// disable icc remark #1572: floating-point equality and inequality comparisons are unreliable
20
#pragma warning(push)
21
#pragma warning(disable:1572)
22
#endif
23
24
return
vsize
==p.
vsize
&&
rss
==p.
rss
;
25
26
#ifdef __ICC
27
// re-enable icc remark #1572
28
#pragma warning(pop)
29
#endif
30
}
31
32
// see proc(4) man pages for units and a description
33
double
vsize
;
// in MB (used to be in pages?)
34
double
rss
;
// in MB (used to be in pages?)
35
};
36
37
class
ProcStats
38
{
39
public
:
40
static
ProcStats
*
instance
();
41
42
bool
fetch
(
procInfo
& fill_me);
43
double
pageSize
()
const
{
return
pg_size
; }
44
45
private
:
46
ProcStats
();
47
~ProcStats
();
48
49
struct
cleanup
50
{
51
cleanup
() { }
52
~cleanup
();
53
};
54
55
friend
struct
cleanup
;
56
57
int
fd
;
58
double
pg_size
;
59
procInfo
curr
;
60
std::string
fname
;
61
char
buf
[500];
62
bool
valid
;
63
64
static
ProcStats
*
inst
;
65
};
66
67
#endif
68
Generated at Thu Jul 18 2013 12:18:01 for Gaudi Framework, version v23r9 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004