00001 #ifndef FWCore_Services_ProcInfoFetcher_h 00002 #define FWCore_Services_ProcInfoFetcher_h 00003 // -*- C++ -*- 00004 // 00005 // Package: Services 00006 // Class : ProcInfoFetcher 00007 // 00016 // 00017 // Original Author: Chris Jones 00018 // Created: Sun May 6 11:14:28 CDT 2012 00019 // $Id: ProcInfoFetcher.h,v 1.1 2012/05/06 19:11:56 chrjones Exp $ 00020 // 00021 00022 // system include files 00023 00024 // user include files 00025 00026 // forward declarations 00027 namespace edm { 00028 namespace service { 00029 struct ProcInfo 00030 { 00031 ProcInfo():vsize(),rss() {} 00032 ProcInfo(double sz, double rss_sz): vsize(sz),rss(rss_sz) {} 00033 00034 bool operator==(const ProcInfo& p) const 00035 { return vsize==p.vsize && rss==p.rss; } 00036 00037 bool operator>(const ProcInfo& p) const 00038 { return vsize>p.vsize || rss>p.rss; } 00039 00040 // see proc(4) man pages for units and a description 00041 double vsize; // in MB (used to be in pages?) 00042 double rss; // in MB (used to be in pages?) 00043 }; 00044 00045 class ProcInfoFetcher { 00046 public: 00047 ProcInfoFetcher(); 00048 ~ProcInfoFetcher(); 00049 ProcInfoFetcher(ProcInfoFetcher const&) = delete; 00050 ProcInfoFetcher& operator=(ProcInfoFetcher const&) = delete; 00051 00052 ProcInfo fetch() const; 00053 private: 00054 double pg_size_; 00055 int fd_; 00056 mutable char buf_[500]; 00057 }; 00058 } 00059 } 00060 #endif