1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#ifndef FWCore_Services_ProcInfoFetcher_h
#define FWCore_Services_ProcInfoFetcher_h
// -*- C++ -*-
//
// Package: Services
// Class : ProcInfoFetcher
//
/**\class ProcInfoFetcher ProcInfoFetcher.h FWCore/Services/interface/ProcInfoFetcher.h
Description:Class used to fetch process information
Usage:
<usage>
*/
//
// Original Author: Chris Jones
// Created: Sun May 6 11:14:28 CDT 2012
//
// system include files
// user include files
// forward declarations
namespace edm {
namespace service {
struct ProcInfo {
ProcInfo() : vsize(), rss() {}
ProcInfo(double sz, double rss_sz) : vsize(sz), rss(rss_sz) {}
bool operator==(const ProcInfo& p) const { return vsize == p.vsize && rss == p.rss; }
bool operator>(const ProcInfo& p) const { return vsize > p.vsize || rss > p.rss; }
// see proc(4) man pages for units and a description
double vsize; // in MB (used to be in pages?)
double rss; // in MB (used to be in pages?)
};
class ProcInfoFetcher {
public:
ProcInfoFetcher();
~ProcInfoFetcher();
ProcInfoFetcher(ProcInfoFetcher const&) = delete;
ProcInfoFetcher& operator=(ProcInfoFetcher const&) = delete;
ProcInfo fetch() const;
private:
double pg_size_;
int fd_;
mutable char buf_[500];
};
} // namespace service
} // namespace edm
#endif
|