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
46struct {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
52enum 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
63inline 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
76inline 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
94inline 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
107inline 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
unsigned int kXR_unt32
Definition: XPtypes.hh:90
Definition: XrdXrootdFileStats.hh:36
void wrOps(int wsz)
Definition: XrdXrootdFileStats.hh:94
void rvOps(int rsz, int ssz)
Definition: XrdXrootdFileStats.hh:76
double write
Definition: XrdXrootdFileStats.hh:49
XrdXrootdFileStats()
Definition: XrdXrootdFileStats.hh:126
char monLvl
Definition: XrdXrootdFileStats.hh:41
double read
Definition: XrdXrootdFileStats.hh:46
monLevel
Definition: XrdXrootdFileStats.hh:52
@ monSsq
Definition: XrdXrootdFileStats.hh:52
@ monOps
Definition: XrdXrootdFileStats.hh:52
@ monOff
Definition: XrdXrootdFileStats.hh:52
@ monOn
Definition: XrdXrootdFileStats.hh:52
double readv
Definition: XrdXrootdFileStats.hh:47
void wvOps(int wsz, int ssz)
Definition: XrdXrootdFileStats.hh:107
short MonEnt
Definition: XrdXrootdFileStats.hh:40
~XrdXrootdFileStats()
Definition: XrdXrootdFileStats.hh:127
long long fSize
Definition: XrdXrootdFileStats.hh:43
XrdXrootdMonStatXFR xfr
Definition: XrdXrootdFileStats.hh:44
double rsegs
Definition: XrdXrootdFileStats.hh:48
void rdOps(int rsz)
Definition: XrdXrootdFileStats.hh:63
char xfrXeq
Definition: XrdXrootdFileStats.hh:42
XrdXrootdMonStatOPS ops
Definition: XrdXrootdFileStats.hh:45
void Init()
Definition: XrdXrootdFileStats.hh:54
kXR_unt32 FileID
Definition: XrdXrootdFileStats.hh:39
struct XrdXrootdFileStats::@116 ssq
Definition: XrdXrootdMonData.hh:217
long long rsegs
Definition: XrdXrootdMonData.hh:223
short rsMax
Definition: XrdXrootdMonData.hh:222
int rvMax
Definition: XrdXrootdMonData.hh:227
int write
Definition: XrdXrootdMonData.hh:220
int read
Definition: XrdXrootdMonData.hh:218
int rvMin
Definition: XrdXrootdMonData.hh:226
int rdMax
Definition: XrdXrootdMonData.hh:225
int wrMin
Definition: XrdXrootdMonData.hh:228
short rsMin
Definition: XrdXrootdMonData.hh:221
int wrMax
Definition: XrdXrootdMonData.hh:229
int rdMin
Definition: XrdXrootdMonData.hh:224
int readv
Definition: XrdXrootdMonData.hh:219
Definition: XrdXrootdMonData.hh:249
long long readv
Definition: XrdXrootdMonData.hh:251
long long read
Definition: XrdXrootdMonData.hh:250
long long write
Definition: XrdXrootdMonData.hh:252