00001 #ifndef __OLB_METER__H 00002 #define __OLB_METER__H 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O l b M e t e r . h h */ 00006 /* */ 00007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC03-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id: XrdOlbMeter.hh,v 1.8 2007/08/30 00:42:40 abh Exp $ 00014 00015 #include "XrdOuc/XrdOucTList.hh" 00016 #include "XrdSys/XrdSysError.hh" 00017 #include "XrdSys/XrdSysPthread.hh" 00018 #include "XrdOuc/XrdOucStream.hh" 00019 00020 class XrdOlbMeterFS; 00021 00022 class XrdOlbMeter 00023 { 00024 public: 00025 00026 int calcLoad(int pcpu, int pio, int pload, int pmem, int ppag); 00027 00028 int FreeSpace(int &tutil); 00029 00030 int isOn() {return Running;} 00031 00032 int Monitor(char *pgm, int itv); 00033 00034 char *Report(); 00035 00036 void *Run(); 00037 00038 void *RunFS(); 00039 00040 int numFS() {return fs_nums;} 00041 00042 void setParms(XrdOucTList *tlp, int warnDups); 00043 00044 XrdOlbMeter(); 00045 ~XrdOlbMeter(); 00046 00047 private: 00048 void calcSpace(); 00049 void informLoad(void); 00050 int isDup(struct stat &buf, XrdOlbMeterFS *baseFS); 00051 const char Scale(long long inval, long &outval); 00052 void SpaceMsg(int why); 00053 00054 XrdOucStream myMeter; 00055 XrdSysMutex cfsMutex; 00056 XrdSysMutex repMutex; 00057 XrdOucTList *fs_list; 00058 long long MinFree; 00059 long long HWMFree; 00060 long long dsk_tot; // Calculated only once 00061 long long dsk_free; 00062 long long dsk_maxf; 00063 int dsk_util; 00064 int dsk_calc; 00065 int fs_nums; // Calculated only once 00066 int noSpace; 00067 int Running; 00068 00069 char ubuff[64]; 00070 time_t rep_tod; 00071 time_t rep_todfs; 00072 char *monpgm; 00073 int monint; 00074 pthread_t montid; 00075 00076 unsigned int xeq_load; 00077 unsigned int cpu_load; 00078 unsigned int mem_load; 00079 unsigned int pag_load; 00080 unsigned int net_load; 00081 }; 00082 00083 namespace XrdOlb 00084 { 00085 extern XrdOlbMeter Meter; 00086 } 00087 #endif
1.7.1