xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 {
37 public:
38 
39 kXR_unt32 FileID; // Unique file id used for monitoring
40 short MonEnt; // Set by mon: entry in reporting table or -1
41 char monLvl; // Set by mon: level of data collection needed
42 char xfrXeq; // Transfer has occurred
43 long long fSize; // Size of file when opened
46 struct {double read; // sum(read_size[i] **2) i = 1 to Ops.read
47  double readv; // sum(readv_size[i]**2) i = 1 to Ops.readv
48  double rsegs; // sum(readv_segs[i]**2) i = 1 to Ops.readv
49  double write; // sum(write_size[i]**2) i = 1 to Ops.write
50  } ssq;
51 
52 enum monLevel {monOff = 0, monOn = 1, monOps = 2, monSsq = 3};
53 
54  void Init()
55  {FileID = 0; MonEnt = -1; monLvl = xfrXeq = 0;
56  memset(&xfr, 0, sizeof(xfr));
57  memset(&ops, 0, sizeof(ops));
58  ops.rsMin = 0x7fff;
59  ops.rdMin = ops.rvMin = ops.wrMin = 0x7fffffff;
60  ssq.read = ssq.readv = ssq.write = ssq.rsegs = 0.0;
61  };
62 
63 inline void rdOps(int rsz)
64  {if (monLvl)
65  {xfr.read += rsz; ops.read++; xfrXeq = 1;
66  if (monLvl > 1)
67  {if (rsz < ops.rdMin) ops.rdMin = rsz;
68  if (rsz > ops.rdMax) ops.rdMax = rsz;
69  if (monLvl > 2)
70  ssq.read += static_cast<double>(rsz)
71  * static_cast<double>(rsz);
72  }
73  }
74  }
75 
76 inline void rvOps(int rsz, int ssz)
77  {if (monLvl)
78  {xfr.readv += rsz; ops.readv++; ops.rsegs += ssz; xfrXeq=1;
79  if (monLvl > 1)
80  {if (rsz < ops.rvMin) ops.rvMin = rsz;
81  if (rsz > ops.rvMax) ops.rvMax = rsz;
82  if (ssz < ops.rsMin) ops.rsMin = ssz;
83  if (ssz > ops.rsMax) ops.rsMax = ssz;
84  if (monLvl > 2)
85  {ssq.readv += static_cast<double>(rsz)
86  * static_cast<double>(rsz);
87  ssq.rsegs += static_cast<double>(ssz)
88  * static_cast<double>(ssz);
89  }
90  }
91  }
92  }
93 
94 inline void wrOps(int wsz)
95  {if (monLvl)
96  {xfr.write += wsz; ops.write++; xfrXeq = 1;
97  if (monLvl > 1)
98  {if (wsz < ops.wrMin) ops.wrMin = wsz;
99  if (wsz > ops.wrMax) ops.wrMax = wsz;
100  if (monLvl > 2)
101  ssq.write += static_cast<double>(wsz)
102  * static_cast<double>(wsz);
103  }
104  }
105  }
106 
107 inline void wvOps(int wsz, int ssz) {}
108 /* When we start reporting detail of writev's we will uncomment this
109  {if (monLvl)
110  {xfr.writev += wsz; ops.writev++; ops.wsegs += ssz; xfrXeq=1;
111  if (monLvl > 1)
112  {if (wsz < ops.wvMin) ops.wvMin = wsz;
113  if (wsz > ops.wvMax) ops.wvMax = wsz;
114  if (ssz < ops.wsMin) ops.wsMin = ssz;
115  if (ssz > ops.wsMax) ops.wsMax = ssz;
116  if (monLvl > 2)
117  {ssq.writev+= static_cast<double>(wsz)
118  * static_cast<double>(wsz);
119  ssq.wsegs += static_cast<double>(ssz)
120  * static_cast<double>(ssz);
121  }
122  }
123  }
124  }
125 */
128 };
129 #endif
short rsMax
Definition: XrdXrootdMonData.hh:238
int rvMax
Definition: XrdXrootdMonData.hh:243
short rsMin
Definition: XrdXrootdMonData.hh:237
int rvMin
Definition: XrdXrootdMonData.hh:242
void Init()
Definition: XrdXrootdFileStats.hh:54
char xfrXeq
Definition: XrdXrootdFileStats.hh:42
double readv
Definition: XrdXrootdFileStats.hh:47
double rsegs
Definition: XrdXrootdFileStats.hh:48
Definition: XrdXrootdMonData.hh:264
double write
Definition: XrdXrootdFileStats.hh:49
Definition: XrdXrootdMonData.hh:232
Definition: XrdXrootdFileStats.hh:52
Definition: XrdXrootdFileStats.hh:52
double read
Definition: XrdXrootdFileStats.hh:46
int wrMin
Definition: XrdXrootdMonData.hh:244
struct XrdXrootdFileStats::@137 ssq
void rvOps(int rsz, int ssz)
Definition: XrdXrootdFileStats.hh:76
char monLvl
Definition: XrdXrootdFileStats.hh:41
~XrdXrootdFileStats()
Definition: XrdXrootdFileStats.hh:127
int wrMax
Definition: XrdXrootdMonData.hh:245
XrdXrootdFileStats()
Definition: XrdXrootdFileStats.hh:126
unsigned int kXR_unt32
Definition: XPtypes.hh:90
Definition: XrdXrootdFileStats.hh:35
XrdXrootdMonStatXFR xfr
Definition: XrdXrootdFileStats.hh:44
int write
Definition: XrdXrootdMonData.hh:236
void wrOps(int wsz)
Definition: XrdXrootdFileStats.hh:94
int read
Definition: XrdXrootdMonData.hh:234
void wvOps(int wsz, int ssz)
Definition: XrdXrootdFileStats.hh:107
long long readv
Definition: XrdXrootdMonData.hh:267
Definition: XrdXrootdFileStats.hh:52
monLevel
Definition: XrdXrootdFileStats.hh:52
int rdMax
Definition: XrdXrootdMonData.hh:241
XrdXrootdMonStatOPS ops
Definition: XrdXrootdFileStats.hh:45
short MonEnt
Definition: XrdXrootdFileStats.hh:40
int rdMin
Definition: XrdXrootdMonData.hh:240
void rdOps(int rsz)
Definition: XrdXrootdFileStats.hh:63
Definition: XrdXrootdFileStats.hh:52
long long fSize
Definition: XrdXrootdFileStats.hh:43
long long write
Definition: XrdXrootdMonData.hh:268
kXR_unt32 FileID
Definition: XrdXrootdFileStats.hh:39
long long rsegs
Definition: XrdXrootdMonData.hh:239
long long read
Definition: XrdXrootdMonData.hh:266
int readv
Definition: XrdXrootdMonData.hh:235