00001 #ifndef __XRDOFS_STATS_H__ 00002 #define __XRDOFS_STATS_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O f s S t a t s . h h */ 00006 /* */ 00007 /* (c) 2009 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-AC02-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id: XrdOfsStats.hh 29874 2009-08-21 16:56:04Z ganis $ 00014 00015 #include <stdlib.h> 00016 00017 #include "XrdSys/XrdSysPthread.hh" 00018 00019 class XrdOfsStats 00020 { 00021 public: 00022 00023 struct StatsData 00024 { 00025 int numOpenR; // Read 00026 int numOpenW; // Write 00027 int numOpenP; // Posc 00028 int numUnpsist; // Posc 00029 int numHandles; 00030 int numRedirect; 00031 int numStarted; 00032 int numReplies; 00033 int numErrors; 00034 int numDelays; 00035 int numSeventOK; 00036 int numSeventER; 00037 } Data; 00038 00039 XrdSysMutex sdMutex; 00040 00041 inline void Add(int &Cntr) {sdMutex.Lock(); Cntr++; sdMutex.UnLock();} 00042 00043 inline void Dec(int &Cntr) {sdMutex.Lock(); Cntr--; sdMutex.UnLock();} 00044 00045 int Report(char *Buff, int Blen); 00046 00047 void setRole(const char *theRole) {myRole = theRole;} 00048 00049 XrdOfsStats() {memset(&Data, 0, sizeof(Data));} 00050 ~XrdOfsStats() {} 00051 00052 private: 00053 00054 const char *myRole; 00055 }; 00056 #endif