xrootd
XrdOfsStats.hh
Go to the documentation of this file.
1 #ifndef __XRDOFS_STATS_H__
2 #define __XRDOFS_STATS_H__
3 /******************************************************************************/
4 /* */
5 /* X r d O f s S t a t s . h h */
6 /* */
7 /* (c) 2009 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-AC02-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 // $Id$
14 
15 #include <stdlib.h>
16 
17 #include "XrdSys/XrdSysPthread.hh"
18 
20 {
21 public:
22 
23 struct StatsData
24 {
25 int numOpenR; // Read
26 int numOpenW; // Write
27 int numOpenP; // Posc
28 int numUnpsist; // Posc
37 } Data;
38 
40 
41 inline void Add(int &Cntr) {sdMutex.Lock(); Cntr++; sdMutex.UnLock();}
42 
43 inline void Dec(int &Cntr) {sdMutex.Lock(); Cntr--; sdMutex.UnLock();}
44 
45  int Report(char *Buff, int Blen);
46 
47  void setRole(const char *theRole) {myRole = theRole;}
48 
49  XrdOfsStats() {memset(&Data, 0, sizeof(Data));}
51 
52 private:
53 
54 const char *myRole;
55 };
56 #endif