00001 #ifndef __XRD_STATS_H__
00002 #define __XRD_STATS_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <stdlib.h>
00016
00017 #include "XrdSys/XrdSysPthread.hh"
00018
00019 #define XRD_STATS_ALL 0x000000FF
00020 #define XRD_STATS_INFO 0x00000001
00021 #define XRD_STATS_BUFF 0x00000002
00022 #define XRD_STATS_LINK 0x00000004
00023 #define XRD_STATS_POLL 0x00000008
00024 #define XRD_STATS_PROC 0x00000010
00025 #define XRD_STATS_PROT 0x00000020
00026 #define XRD_STATS_SCHD 0x00000040
00027 #define XRD_STATS_SGEN 0x00000080
00028 #define XRD_STATS_SYNC 0x40000000
00029 #define XRD_STATS_SYNCA 0x20000000
00030
00031 class XrdStats
00032 {
00033 public:
00034
00035 void Report(char **Dest=0, int iVal=600, int Opts=0);
00036
00037 void Lock() {statsMutex.Lock();}
00038
00039 const char *Stats(int opts);
00040
00041 void UnLock() {statsMutex.UnLock();}
00042
00043 XrdStats(const char *hn, int port, const char *in, const char *pn);
00044
00045 ~XrdStats() {if (buff) free(buff);}
00046
00047 private:
00048
00049 int InfoStats(char *buff, int blen, int dosync=0);
00050 int ProcStats(char *buff, int blen, int dosync=0);
00051
00052 static long tBoot;
00053
00054 XrdSysMutex statsMutex;
00055
00056 char *buff;
00057 int blen;
00058 int Hlen;
00059 char *Head;
00060 const char *myHost;
00061 const char *myName;
00062 int myPort;
00063 };
00064 #endif