xrootd
XrdXrootdFileStats.hh
Go to the documentation of this file.
1#ifndef __XRDXROOTDFILESTATS__
2#define __XRDXROOTDFILESTATS__
3/******************************************************************************/
4/* */
5/* X r d X r o o t d F i l e S t a t s . h h */
6/* */
7/* (c) 2012 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/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
34
36{
37public:
38
39kXR_unt32 FileID; // Unique file id used for monitoring
40short MonEnt; // Set by mon: entry in reporting table or -1
41char monLvl; // Set by mon: level of data collection needed
42char xfrXeq; // Transfer has occurred
43long long fSize; // Size of file when opened
47struct {double read; // sum(read_size[i] **2) i = 1 to Ops.read
48 double readv; // sum(readv_size[i]**2) i = 1 to Ops.readv
49 double rsegs; // sum(readv_segs[i]**2) i = 1 to Ops.readv
50 double write; // sum(write_size[i]**2) i = 1 to Ops.write
51 } ssq;
52
53enum monLevel {monOff = 0, monOn = 1, monOps = 2, monSsq = 3};
54
55 void Init()
56 {FileID = 0; MonEnt = -1; monLvl = xfrXeq = 0;
57 memset(&xfr, 0, sizeof(xfr));
58 memset(&ops, 0, sizeof(ops));
59 memset(&prw, 0, sizeof(prw));
60 ops.rsMin = 0x7fff;
61 ops.rdMin = ops.rvMin = ops.wrMin = 0x7fffffff;
62 ssq.read = ssq.readv = ssq.write = ssq.rsegs = 0.0;
63 };
64
65inline void pgrOps(int rsz, bool isRetry=false)
66 {if (monLvl)
67 {prw.rBytes += rsz;
68 prw.rCount++;
69 if(isRetry) prw.rRetry++;
70 }
71 }
72
73inline void pgwOps(int wsz, bool isRetry=false)
74 {if (monLvl)
75 {prw.wBytes += wsz;
76 prw.wCount++;
77 if(isRetry) prw.wRetry++;
78 }
79 }
80
81inline void pgUpdt(int wErrs, int wFixd, int wUnc)
82 {if (monLvl)
83 {prw.wcsErr = wErrs;
84 prw.wRetry = wFixd;
85 prw.wcsUnc = wUnc;
86 }
87 }
88
89inline void rdOps(int rsz)
90 {if (monLvl)
91 {xfr.read += rsz; ops.read++; xfrXeq = 1;
92 if (monLvl > 1)
93 {if (rsz < ops.rdMin) ops.rdMin = rsz;
94 if (rsz > ops.rdMax) ops.rdMax = rsz;
95 if (monLvl > 2)
96 ssq.read += static_cast<double>(rsz)
97 * static_cast<double>(rsz);
98 }
99 }
100 }
101
102inline void rvOps(int rsz, int ssz)
103 {if (monLvl)
104 {xfr.readv += rsz; ops.readv++; ops.rsegs += ssz; xfrXeq=1;
105 if (monLvl > 1)
106 {if (rsz < ops.rvMin) ops.rvMin = rsz;
107 if (rsz > ops.rvMax) ops.rvMax = rsz;
108 if (ssz < ops.rsMin) ops.rsMin = ssz;
109 if (ssz > ops.rsMax) ops.rsMax = ssz;
110 if (monLvl > 2)
111 {ssq.readv += static_cast<double>(rsz)
112 * static_cast<double>(rsz);
113 ssq.rsegs += static_cast<double>(ssz)
114 * static_cast<double>(ssz);
115 }
116 }
117 }
118 }
119
120inline void wrOps(int wsz)
121 {if (monLvl)
122 {xfr.write += wsz; ops.write++; xfrXeq = 1;
123 if (monLvl > 1)
124 {if (wsz < ops.wrMin) ops.wrMin = wsz;
125 if (wsz > ops.wrMax) ops.wrMax = wsz;
126 if (monLvl > 2)
127 ssq.write += static_cast<double>(wsz)
128 * static_cast<double>(wsz);
129 }
130 }
131 }
132
133inline void wvOps(int wsz, int ssz) {wrOps(wsz);}
134/* !!! When we start reporting detail of writev's we will uncomment this
135 !!! For now writev's are treated as single write, not correct but at least
136 !!! the data gets counted.
137 {if (monLvl)
138 {xfr.writev += wsz; ops.writev++; ops.wsegs += ssz; xfrXeq=1;
139 if (monLvl > 1)
140 {if (wsz < ops.wvMin) ops.wvMin = wsz;
141 if (wsz > ops.wvMax) ops.wvMax = wsz;
142 if (ssz < ops.wsMin) ops.wsMin = ssz;
143 if (ssz > ops.wsMax) ops.wsMax = ssz;
144 if (monLvl > 2)
145 {ssq.writev+= static_cast<double>(wsz)
146 * static_cast<double>(wsz);
147 ssq.wsegs += static_cast<double>(ssz)
148 * static_cast<double>(ssz);
149 }
150 }
151 }
152 }
153*/
156};
157#endif
unsigned int kXR_unt32
Definition: XPtypes.hh:90
Definition: XrdXrootdFileStats.hh:36
void wrOps(int wsz)
Definition: XrdXrootdFileStats.hh:120
void rvOps(int rsz, int ssz)
Definition: XrdXrootdFileStats.hh:102
double write
Definition: XrdXrootdFileStats.hh:50
XrdXrootdFileStats()
Definition: XrdXrootdFileStats.hh:154
char monLvl
Definition: XrdXrootdFileStats.hh:41
XrdXrootdMonStatPRW prw
Definition: XrdXrootdFileStats.hh:46
double read
Definition: XrdXrootdFileStats.hh:47
void pgrOps(int rsz, bool isRetry=false)
Definition: XrdXrootdFileStats.hh:65
struct XrdXrootdFileStats::@158 ssq
void pgwOps(int wsz, bool isRetry=false)
Definition: XrdXrootdFileStats.hh:73
monLevel
Definition: XrdXrootdFileStats.hh:53
@ monSsq
Definition: XrdXrootdFileStats.hh:53
@ monOps
Definition: XrdXrootdFileStats.hh:53
@ monOff
Definition: XrdXrootdFileStats.hh:53
@ monOn
Definition: XrdXrootdFileStats.hh:53
double readv
Definition: XrdXrootdFileStats.hh:48
void wvOps(int wsz, int ssz)
Definition: XrdXrootdFileStats.hh:133
void pgUpdt(int wErrs, int wFixd, int wUnc)
Definition: XrdXrootdFileStats.hh:81
short MonEnt
Definition: XrdXrootdFileStats.hh:40
~XrdXrootdFileStats()
Definition: XrdXrootdFileStats.hh:155
long long fSize
Definition: XrdXrootdFileStats.hh:43
XrdXrootdMonStatXFR xfr
Definition: XrdXrootdFileStats.hh:44
double rsegs
Definition: XrdXrootdFileStats.hh:49
void rdOps(int rsz)
Definition: XrdXrootdFileStats.hh:89
char xfrXeq
Definition: XrdXrootdFileStats.hh:42
XrdXrootdMonStatOPS ops
Definition: XrdXrootdFileStats.hh:45
void Init()
Definition: XrdXrootdFileStats.hh:55
kXR_unt32 FileID
Definition: XrdXrootdFileStats.hh:39
Definition: XrdXrootdMonData.hh:248
long long rsegs
Definition: XrdXrootdMonData.hh:254
short rsMax
Definition: XrdXrootdMonData.hh:253
int rvMax
Definition: XrdXrootdMonData.hh:258
int write
Definition: XrdXrootdMonData.hh:251
int read
Definition: XrdXrootdMonData.hh:249
int rvMin
Definition: XrdXrootdMonData.hh:257
int rdMax
Definition: XrdXrootdMonData.hh:256
int wrMin
Definition: XrdXrootdMonData.hh:259
short rsMin
Definition: XrdXrootdMonData.hh:252
int wrMax
Definition: XrdXrootdMonData.hh:260
int rdMin
Definition: XrdXrootdMonData.hh:255
int readv
Definition: XrdXrootdMonData.hh:250
Definition: XrdXrootdMonData.hh:236
int wCount
Definition: XrdXrootdMonData.hh:241
long long wBytes
Definition: XrdXrootdMonData.hh:240
int wRetry
Definition: XrdXrootdMonData.hh:242
int wcsErr
Definition: XrdXrootdMonData.hh:243
int rCount
Definition: XrdXrootdMonData.hh:238
long long rBytes
Definition: XrdXrootdMonData.hh:237
int wcsUnc
Definition: XrdXrootdMonData.hh:244
int rRetry
Definition: XrdXrootdMonData.hh:239
Definition: XrdXrootdMonData.hh:280
long long readv
Definition: XrdXrootdMonData.hh:282
long long read
Definition: XrdXrootdMonData.hh:281
long long write
Definition: XrdXrootdMonData.hh:283