xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdMon
XrdMonCtrBuffer.hh
Go to the documentation of this file.
1
/*****************************************************************************/
2
/* */
3
/* XrdMonCtrBuffer.hh */
4
/* */
5
/* (c) 2005 by the Board of Trustees of the Leland Stanford, Jr., University */
6
/* All Rights Reserved */
7
/* Produced by Jacek Becla for Stanford University under contract */
8
/* DE-AC02-76SF00515 with the Department of Energy */
9
/*****************************************************************************/
10
11
// $Id$
12
13
#ifndef XRDMONCTRBUFFER_HH
14
#define XRDMONCTRBUFFER_HH
15
16
#include "
XrdSys/XrdSysPthread.hh
"
17
class
XrdMonCtrPacket
;
18
19
// It is a fast and simple list: elements are added
20
// at the tail when they are received.
21
// Archiver retrives them from the head.
22
// Multithreaded safe. It is a singleton.
23
24
class
XrdMonCtrBuffer
{
25
public
:
26
static
XrdMonCtrBuffer
*
instance
();
27
void
push_back
(
XrdMonCtrPacket
* p);
28
XrdMonCtrPacket
*
pop_front
();
29
void
printList
(
const
char
*);
30
31
private
:
32
XrdMonCtrBuffer
();
33
void
collectStats
();
34
35
private
:
36
struct
Elem
{
37
Elem
(
XrdMonCtrPacket
* p) :
packet
(p),
next
(0) {}
38
XrdMonCtrPacket
*
packet
;
39
Elem
*
next
;
40
};
41
42
Elem
*
_head
;
43
Elem
*
_tail
;
44
int
_noElems
;
45
46
XrdSysMutex
_mutex
;
47
XrdSysCondVar
_cond
;
48
49
// statistics
50
int
_max
;
// maximum _noElems in the list
51
int
_aver
;
// average noElems in the list
52
int
_noKInAver
;
// no of elements [in 1000s] used to calculate average
53
int
_last1Kmax
;
// max noElems in the list, last 0-1000 pop_front()
54
int
_last1Ktotal
;
// total number of noElems, last 0-1000 pop_front()
55
int
_counter1K
;
// number of pop_front() in the "last1K"
56
57
static
XrdMonCtrBuffer
*
_instance
;
58
};
59
60
#endif
/* XRDMONCTRBUFFER_HH */
Generated by
1.8.3.1