00001 #ifndef __XRD_STATS_H__
00002 #define __XRD_STATS_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <stdlib.h>
00033
00034 #include "XrdSys/XrdSysPthread.hh"
00035
00036 #define XRD_STATS_ALL 0x000000FF
00037 #define XRD_STATS_INFO 0x00000001
00038 #define XRD_STATS_BUFF 0x00000002
00039 #define XRD_STATS_LINK 0x00000004
00040 #define XRD_STATS_POLL 0x00000008
00041 #define XRD_STATS_PROC 0x00000010
00042 #define XRD_STATS_PROT 0x00000020
00043 #define XRD_STATS_SCHD 0x00000040
00044 #define XRD_STATS_SGEN 0x00000080
00045 #define XRD_STATS_SYNC 0x40000000
00046 #define XRD_STATS_SYNCA 0x20000000
00047
00048 class XrdScheduler;
00049 class XrdBuffManager;
00050
00051 class XrdStats
00052 {
00053 public:
00054
00055 void Report(char **Dest=0, int iVal=600, int Opts=0);
00056
00057 class CallBack
00058 {public: virtual void Info(const char *data, int dlen) = 0;
00059 CallBack() {}
00060 virtual ~CallBack() {}
00061 };
00062
00063 virtual
00064 void Stats(CallBack *InfoBack, int opts);
00065
00066 XrdStats(XrdSysError *eP, XrdScheduler *sP, XrdBuffManager *bP,
00067 const char *hn, int port, const char *in, const char *pn,
00068 const char *sn);
00069
00070 virtual ~XrdStats() {if (buff) free(buff);}
00071
00072 private:
00073
00074 const char *GenStats(int &rsz, int opts);
00075 int InfoStats(char *buff, int blen, int dosync=0);
00076 int ProcStats(char *buff, int blen, int dosync=0);
00077
00078 static long tBoot;
00079
00080 XrdScheduler *XrdSched;
00081 XrdSysError *XrdLog;
00082 XrdBuffManager *BuffPool;
00083 XrdSysMutex statsMutex;
00084
00085 char *buff;
00086 int blen;
00087 int Hlen;
00088 char *Head;
00089 const char *myHost;
00090 const char *myName;
00091 int myPort;
00092 };
00093 #endif