XRootD
Loading...
Searching...
No Matches
XrdSsiStats.cc
Go to the documentation of this file.
1
/******************************************************************************/
2
/* */
3
/* X r d X r o o t d S t a t s . c c */
4
/* */
5
/* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University */
6
/* Produced by Andrew Hanushevsky for Stanford University under contract */
7
/* DE-AC02-76-SFO0515 with the Department of Energy */
8
/* */
9
/* This file is part of the XRootD software suite. */
10
/* */
11
/* XRootD is free software: you can redistribute it and/or modify it under */
12
/* the terms of the GNU Lesser General Public License as published by the */
13
/* Free Software Foundation, either version 3 of the License, or (at your */
14
/* option) any later version. */
15
/* */
16
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
17
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
18
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
19
/* License for more details. */
20
/* */
21
/* You should have received a copy of the GNU Lesser General Public License */
22
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
23
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
24
/* */
25
/* The copyright holder's institutional names and contributor's names may not */
26
/* be used to endorse or promote products derived from this software without */
27
/* specific prior written permission of the institution or contributor. */
28
/******************************************************************************/
29
30
#include <cstdio>
31
32
#include "
XrdSfs/XrdSfsInterface.hh
"
33
#include "
XrdSsi/XrdSsiStats.hh
"
34
35
/******************************************************************************/
36
/* G l o b a l s */
37
/******************************************************************************/
38
39
namespace
XrdSsi
40
{
41
XrdSsiStats
Stats
;
42
}
43
using namespace
XrdSsi
;
44
45
/******************************************************************************/
46
/* C o n s t r c u t o r */
47
/******************************************************************************/
48
49
XrdSsiStats::XrdSsiStats
()
50
{
51
52
fsP = 0;
53
54
ReqBytes
= 0;
// Stats: Number of requests bytes total
55
ReqMaxsz
= 0;
// Stats: Number of requests largest size
56
RspMDBytes
= 0;
// Stats: Number of metada response bytes
57
ReqAborts
= 0;
// Stats: Number of request aborts
58
ReqAlerts
= 0;
// Stats: Number of request alerts
59
ReqBound
= 0;
// Stats: Number of requests bound
60
ReqCancels
= 0;
// Stats: Number of request Finished()+cancel
61
ReqCount
= 0;
// Stats: Number of requests (total)
62
ReqFinForce
= 0;
// Stats: Number of request Finished()+forced
63
ReqFinished
= 0;
// Stats: Number of request Finished()
64
ReqGets
= 0;
// Stats: Number of requests -> GetRequest()
65
ReqPrepErrs
= 0;
// Stats: Number of request prepare errors
66
ReqProcs
= 0;
// Stats: Number of requests -> ProcessRequest()
67
ReqRedir
= 0;
// Stats: Number of request redirects
68
ReqRelBuf
= 0;
// Stats: Number of request -> RelRequestBuff()
69
ReqStalls
= 0;
// Stats: Number of request stalls
70
RspBad
= 0;
// Stats: Number of invalid responses
71
RspCallBK
= 0;
// Stats: Number of request callbacks
72
RspData
= 0;
// Stats: Number of data responses
73
RspErrs
= 0;
// Stats: Number of error responses
74
RspFile
= 0;
// Stats: Number of file responses
75
RspReady
= 0;
// Stats: Number of ready responses
76
RspStrm
= 0;
// Stats: Number of stream responses
77
RspUnRdy
= 0;
// Stats: Number of unready responses
78
SsiErrs
= 0;
// Stats: Number of SSI detected errors
79
ResAdds
= 0;
// Stats: Number of resource additions
80
ResRems
= 0;
// Stats: Number of resource removals
81
}
82
83
/******************************************************************************/
84
/* S t a t s */
85
/******************************************************************************/
86
87
int
XrdSsiStats::Stats
(
char
*buff,
int
blen)
88
{
89
static
const
char
statfmt[] =
"<stats id=\"ssi\"><err>%d</err>"
90
"<req>"
91
"<bytes>%lld</bytes><maxsz>%lld</maxsz><cnt>%d</cnt>"
92
"<bnd>%d</bnd><rdr>%d</rdr><dly>%d</dly>"
93
"<ab>%d</ab><proc>%d</proc><gets>%d</gets>"
94
"<relb>%d</relb><al>%d</al><fin>%d</fin>"
95
"<can>%d</can><finf>%d</finf><perr>%d</perr>"
96
"</req><rsp>"
97
"<bad>%d</bad><cbk>%d</cbk><data>%d</data><errs>%d</errs>"
98
"<file>%d</file><str>%d</str><rdy>%d</rdy><unr>%d</unr>"
99
"<mdb>%lld</mdb"
100
"</rsp><res>"
101
"<add>%d</add><rem>%d</rem>"
102
"</res></stats>"
;
103
// 1 2 3 4 5 6 7 8
104
static
const
long
long
LLMax = 0x7fffffffffffffffLL;
105
static
const
int
INMax = 0x7fffffff;
106
int
len;
107
108
// If no buffer, caller wants the maximum size we will generate
109
//
110
if
(!buff)
111
{
char
dummy[4096];
// Almost any size will do
112
len = snprintf(dummy,
sizeof
(dummy), statfmt, INMax,
113
/*<bytes>*/
LLMax, LLMax, INMax,
114
/*<bnd>*/
INMax, INMax, INMax,
115
/*<ab>*/
INMax, INMax, INMax,
116
/*<relb>*/
INMax, INMax, INMax,
117
/*<can>*/
INMax, INMax, INMax,
118
/*<bad>*/
INMax, INMax, INMax, INMax,
119
/*<file>*/
INMax, INMax, INMax, INMax, LLMax,
120
/*<res>*/
INMax, INMax);
121
return
len + (fsP ? fsP->
getStats
(0,0) : 0);
122
}
123
124
// Format our statistics
125
//
126
statsMutex
.
Lock
();
127
len = snprintf(buff, blen, statfmt,
SsiErrs
,
128
ReqBytes
,
ReqMaxsz
,
ReqCount
,
129
ReqBound
,
ReqRedir
,
ReqStalls
,
130
ReqAborts
,
ReqProcs
,
ReqGets
,
131
ReqRelBuf
,
ReqAlerts
,
ReqFinished
,
132
ReqCancels
,
ReqFinForce
,
ReqPrepErrs
,
133
RspBad
,
RspCallBK
,
RspData
,
RspErrs
,
134
RspFile
,
RspStrm
,
RspReady
,
RspUnRdy
,
135
RspMDBytes
,
ResAdds
,
ResRems
);
136
statsMutex
.
UnLock
();
137
138
// Now include filesystem statistics and return
139
//
140
if
(fsP) len += fsP->
getStats
(buff+len, blen-len);
141
return
len;
142
}
XrdSfsInterface.hh
XrdSsiStats.hh
XrdOucStats::statsMutex
XrdSysMutex statsMutex
Definition
XrdOucStats.hh:55
XrdSfsFileSystem::getStats
virtual int getStats(char *buff, int blen)=0
XrdSsiStats
Definition
XrdSsiStats.hh:38
XrdSsiStats::RspReady
int RspReady
Definition
XrdSsiStats.hh:61
XrdSsiStats::ResAdds
int ResAdds
Definition
XrdSsiStats.hh:65
XrdSsiStats::RspUnRdy
int RspUnRdy
Definition
XrdSsiStats.hh:63
XrdSsiStats::ReqRelBuf
int ReqRelBuf
Definition
XrdSsiStats.hh:54
XrdSsiStats::ReqCancels
int ReqCancels
Definition
XrdSsiStats.hh:46
XrdSsiStats::Stats
int Stats(char *buff, int blen)
Definition
XrdSsiStats.cc:87
XrdSsiStats::ReqAlerts
int ReqAlerts
Definition
XrdSsiStats.hh:44
XrdSsiStats::RspStrm
int RspStrm
Definition
XrdSsiStats.hh:62
XrdSsiStats::ReqMaxsz
long long ReqMaxsz
Definition
XrdSsiStats.hh:41
XrdSsiStats::RspMDBytes
long long RspMDBytes
Definition
XrdSsiStats.hh:42
XrdSsiStats::SsiErrs
int SsiErrs
Definition
XrdSsiStats.hh:64
XrdSsiStats::RspFile
int RspFile
Definition
XrdSsiStats.hh:60
XrdSsiStats::ReqAborts
int ReqAborts
Definition
XrdSsiStats.hh:43
XrdSsiStats::ReqBound
int ReqBound
Definition
XrdSsiStats.hh:45
XrdSsiStats::ReqStalls
int ReqStalls
Definition
XrdSsiStats.hh:55
XrdSsiStats::ReqGets
int ReqGets
Definition
XrdSsiStats.hh:50
XrdSsiStats::ReqFinished
int ReqFinished
Definition
XrdSsiStats.hh:49
XrdSsiStats::ReqFinForce
int ReqFinForce
Definition
XrdSsiStats.hh:48
XrdSsiStats::ResRems
int ResRems
Definition
XrdSsiStats.hh:66
XrdSsiStats::RspErrs
int RspErrs
Definition
XrdSsiStats.hh:59
XrdSsiStats::RspCallBK
int RspCallBK
Definition
XrdSsiStats.hh:57
XrdSsiStats::RspBad
int RspBad
Definition
XrdSsiStats.hh:56
XrdSsiStats::ReqCount
int ReqCount
Definition
XrdSsiStats.hh:47
XrdSsiStats::ReqPrepErrs
int ReqPrepErrs
Definition
XrdSsiStats.hh:51
XrdSsiStats::XrdSsiStats
XrdSsiStats()
Definition
XrdSsiStats.cc:49
XrdSsiStats::ReqRedir
int ReqRedir
Definition
XrdSsiStats.hh:53
XrdSsiStats::ReqBytes
long long ReqBytes
Definition
XrdSsiStats.hh:40
XrdSsiStats::ReqProcs
int ReqProcs
Definition
XrdSsiStats.hh:52
XrdSsiStats::RspData
int RspData
Definition
XrdSsiStats.hh:58
XrdSysMutex::Lock
void Lock()
Definition
XrdSysPthread.hh:222
XrdSysMutex::UnLock
void UnLock()
Definition
XrdSysPthread.hh:224
XrdSsi
Definition
XrdSsiClient.cc:65
XrdSsi::Stats
XrdSsiStats Stats
Definition
XrdSsiFileReq.cc:69
XrdSsi
XrdSsiStats.cc
Generated by
1.9.7