xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdOuc
XrdOucStats.hh
Go to the documentation of this file.
1
#ifndef _XRDOUCSTATS_HH_
2
#define _XRDOUCSTATS_HH_
3
/******************************************************************************/
4
/* */
5
/* X r d O u c S t a t s . h h */
6
/* */
7
/* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */
8
/* All Rights Reserved */
9
/* Produced by Andrew Hanushevsky for Stanford University under contract */
10
/* DE-AC02-76-SFO0515 with the Department of Energy */
11
/******************************************************************************/
12
13
#include "
XrdSys/XrdSysAtomics.hh
"
14
15
#ifdef HAVE_ATOMICS
16
#define _statsINC(x) AtomicInc(x)
17
#else
18
#define _statsINC(x) statsMutex.Lock(); x++; statsMutex.UnLock()
19
#endif
20
21
class
XrdOucStats
22
{
23
public
:
24
25
inline
void
Bump
(
int
&val) {
_statsINC
(val);}
26
27
inline
void
Bump
(
long
long
&val) {
_statsINC
(val);}
28
29
XrdSysMutex
statsMutex
;
// Mutex to serialize updates
30
31
XrdOucStats
() {}
32
~XrdOucStats
() {}
33
};
34
#endif
Generated by
1.8.1.2