|
xrootd
|
00001 #ifndef __XRD_STATS_H__ 00002 #define __XRD_STATS_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d S t a t s . h h */ 00006 /* */ 00007 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC03-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 #include <stdlib.h> 00014 00015 #include "XrdSys/XrdSysPthread.hh" 00016 00017 #define XRD_STATS_ALL 0x000000FF 00018 #define XRD_STATS_INFO 0x00000001 00019 #define XRD_STATS_BUFF 0x00000002 00020 #define XRD_STATS_LINK 0x00000004 00021 #define XRD_STATS_POLL 0x00000008 00022 #define XRD_STATS_PROC 0x00000010 00023 #define XRD_STATS_PROT 0x00000020 00024 #define XRD_STATS_SCHD 0x00000040 00025 #define XRD_STATS_SGEN 0x00000080 00026 #define XRD_STATS_SYNC 0x40000000 00027 #define XRD_STATS_SYNCA 0x20000000 00028 00029 class XrdScheduler; 00030 class XrdBuffManager; 00031 00032 class XrdStats 00033 { 00034 public: 00035 00036 void Report(char **Dest=0, int iVal=600, int Opts=0); 00037 00038 void Lock() {statsMutex.Lock();} // Call before doing Stats() 00039 00040 const char *Stats(int opts); 00041 00042 void UnLock() {statsMutex.UnLock();} // Call after inspecting buffer 00043 00044 XrdStats(XrdSysError *eP, XrdScheduler *sP, XrdBuffManager *bP, 00045 const char *hn, int port, const char *in, const char *pn); 00046 00047 ~XrdStats() {if (buff) free(buff);} 00048 00049 private: 00050 00051 int InfoStats(char *buff, int blen, int dosync=0); 00052 int ProcStats(char *buff, int blen, int dosync=0); 00053 00054 static long tBoot; // Time at boot time 00055 00056 XrdScheduler *XrdSched; 00057 XrdSysError *XrdLog; 00058 XrdBuffManager *BuffPool; 00059 XrdSysMutex statsMutex; 00060 00061 char *buff; // Used by all callers 00062 int blen; 00063 int Hlen; 00064 char *Head; 00065 const char *myHost; 00066 const char *myName; 00067 int myPort; 00068 }; 00069 #endif
1.7.5