Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ProcStats.h

Go to the documentation of this file.
00001 #ifndef ATLASAUDITOR_PROCSTATS_H
00002 #define ATLASAUDITOR_PROCSTATS_H
00003 
00004 // Class: ProcStats
00005 // Description:  Keeps statistics on memory usage
00006 // Author: Jim Kowalkowski (FNAL), modified by M. Shapiro (LBNL)
00007 
00008 
00009 #include <string>
00010 #include <vector>
00011 
00012 struct procInfo
00013 {
00014         procInfo() {}
00015         procInfo(double sz, double rss_sz): vsize(sz),rss(rss_sz) {}
00016 
00017         bool operator==(const procInfo& p) const
00018                 { return vsize==p.vsize && rss==p.rss; }
00019 
00020         // see proc(4) man pages for units and a description
00021         double vsize;   // in MB (used to be in pages?)
00022         double rss;             // in MB (used to be in pages?)
00023 };
00024 
00025 class ProcStats
00026 {
00027 public:
00028         static ProcStats* instance();
00029 
00030         bool fetch(procInfo& fill_me);
00031         double pageSize() const { return pg_size; }
00032 
00033 private:
00034         ProcStats();
00035         ~ProcStats();
00036 
00037         struct cleanup
00038         {
00039                 cleanup() { }
00040                 ~cleanup();
00041         };
00042 
00043         friend struct cleanup;
00044 
00045         int fd;
00046         double pg_size;
00047         procInfo curr;
00048         std::string fname;
00049         char buf[500];
00050         bool valid;
00051 
00052         static ProcStats* inst;
00053 };
00054 
00055 #endif
00056 

Generated at Wed Nov 21 12:20:02 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000