xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdXrootd
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
33
#include "
XrdXrootd/XrdXrootdMonData.hh
"
34
35
class
XrdXrootdFileStats
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
44
XrdXrootdMonStatXFR
xfr
;
45
XrdXrootdMonStatOPS
ops
;
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
XrdXrootdFileStats
() {
Init
();}
108
~XrdXrootdFileStats
() {}
109
};
110
#endif
Generated by
1.8.3.1