xrootd
XrdStats.hh
Go to the documentation of this file.
1 #ifndef __XRD_STATS_H__
2 #define __XRD_STATS_H__
3 /******************************************************************************/
4 /* */
5 /* X r d S t a t s . h h */
6 /* */
7 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved. See XrdInfo.cc for complete License Terms */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC03-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 #include <stdlib.h>
14 
15 #include "XrdSys/XrdSysPthread.hh"
16 
17 #define XRD_STATS_ALL 0x000000FF
18 #define XRD_STATS_INFO 0x00000001
19 #define XRD_STATS_BUFF 0x00000002
20 #define XRD_STATS_LINK 0x00000004
21 #define XRD_STATS_POLL 0x00000008
22 #define XRD_STATS_PROC 0x00000010
23 #define XRD_STATS_PROT 0x00000020
24 #define XRD_STATS_SCHD 0x00000040
25 #define XRD_STATS_SGEN 0x00000080
26 #define XRD_STATS_SYNC 0x40000000
27 #define XRD_STATS_SYNCA 0x20000000
28 
29 class XrdScheduler;
30 class XrdBuffManager;
31 
32 class XrdStats
33 {
34 public:
35 
36 void Report(char **Dest=0, int iVal=600, int Opts=0);
37 
38 void Lock() {statsMutex.Lock();} // Call before doing Stats()
39 
40 const char *Stats(int opts);
41 
42 void UnLock() {statsMutex.UnLock();} // Call after inspecting buffer
43 
45  const char *hn, int port, const char *in, const char *pn);
46 
47  ~XrdStats() {if (buff) free(buff);}
48 
49 private:
50 
51 int InfoStats(char *buff, int blen, int dosync=0);
52 int ProcStats(char *buff, int blen, int dosync=0);
53 
54 static long tBoot; // Time at boot time
55 
60 
61 char *buff; // Used by all callers
62 int blen;
63 int Hlen;
64 char *Head;
65 const char *myHost;
66 const char *myName;
67 int myPort;
68 };
69 #endif