xrootd
XrdXrootdMonData.hh
Go to the documentation of this file.
1 #ifndef __XRDXROOTDMONDATA__
2 #define __XRDXROOTDMONDATA__
3 /******************************************************************************/
4 /* */
5 /* X r d X r o o t d M o n D a t a . h h */
6 /* */
7 /* (c) 2004 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 "XProtocol/XPtypes.hh"
34 
35 /******************************************************************************/
36 /* P a c k e t D e f i n i t i o n s */
37 /******************************************************************************/
38 
40  {kXR_char code; // '='|'d'|'f'|'i'|'p'|'r'|'t'|'u'|'x'
41  kXR_char pseq; // packet sequence
42  kXR_unt16 plen; // packet length
43  kXR_int32 stod; // Unix time at Server Start
44  };
45 
47  {union {kXR_int64 val;
48  kXR_char id[8];
51  union {kXR_int32 buflen;
54  union {kXR_unt32 dictid;
56  };
57 
60  XrdXrootdMonTrace info[sizeof(XrdXrootdMonTrace)]; //This is really [n]
61  };
62 
64  {union {kXR_int32 Window;
65  struct {kXR_char Type;
68  } rdr; } arg0;
69  union {kXR_unt32 dictid;
71  };
72 
75  union {kXR_int64 sID;
76  kXR_char sXX[8]; };
77  XrdXrootdMonRedir info[sizeof(XrdXrootdMonRedir)]; //This is really [n]
78  };
79 
82  int tBeg; // time(0) of the first record
83  int tEnd; // time(0) of the last record
84  kXR_int64 sID; // Server id in lower 48 bits
85 }; // Information provider top 8 bits.
86 
90  char info[1024+256];
91  };
92 
99 const kXR_char XROOTD_MON_REDHOST = 0xf0; // No Modifier
101 
102 
105 const kXR_char XROOTD_MON_MAPFSTA = 'f'; // The "f" stream
106 const kXR_char XROOTD_MON_MAPGSTA = 'g'; // The "g" stream
108 const kXR_char XROOTD_MON_MAPMIGR = 'm'; // Internal use only!
111 const kXR_char XROOTD_MON_MAPSTAG = 's'; // Internal use only!
115 
116 const kXR_char XROOTD_MON_GSCCM = 'M'; // pfc: Cache context mgt info
117 const kXR_char XROOTD_MON_GSPFC = 'C'; // pfc: Cache monitoring info
118 const kXR_char XROOTD_MON_GSTCP = 'T'; // TCP connection statistics
119 
120 // The following bits are insert in the low order 4 bits of the MON_REDIRECT
121 // entry code to indicate the actual operation that was requestded.
122 //
123 const kXR_char XROOTD_MON_REDSID = 0xf0; // Server Identification
124 const kXR_char XROOTD_MON_REDTIME = 0x00; // Timing mark
125 
126 const kXR_char XROOTD_MON_REDIRECT = 0x80; // With Modifier below!
127 const kXR_char XROOTD_MON_REDLOCAL = 0x90; // With Modifier below!
128 
129 const kXR_char XROOTD_MON_CHMOD = 0x01; // Modifiers for the above
136 const kXR_char XROOTD_MON_MV = 0x08;
139 const kXR_char XROOTD_MON_RM = 0x0b;
143 
146 
147 const int XROOTD_MON_REDMASK = 0x00000ff;
148 const int XROOTD_MON_SRCMASK = 0x000000f;
149 const int XROOTD_MON_TRGMASK = 0x7fffff0;
150 const int XROOTD_MON_NEWSTID = 0x8000000;
151 
152 const long long XROOTD_MON_SIDMASK = 0x0000ffffffffffff;
153 const long long XROOTD_MON_PIDMASK = 0xff;
154 const long long XROOTD_MON_PIDSHFT = 56;
155 
156 /******************************************************************************/
157 /* " f " S t r e a m S p e c i f i c R e c o r d s */
158 /******************************************************************************/
159 
160 // The UDP buffer layout is as follows:
161 //
162 // XrdXrootdMonHeader with Code == XROOTD_MON_MAPFSTA
163 // XrdXrootdMonFileTOD with recType == isTime
164 // XrdXrootdMonFileHdr with recType == one of recTval (variable length)
165 // ... additional XrdXrootdMonFileHdr's (variable length)
166 // XrdXrootdMonFileTOD with recType == isTime
167 
169 {
170 enum recTval {isClose = 0, // Record for close
171  isOpen, // Record for open
172  isTime, // Record for time
173  isXfr, // Record for transfers
174  isDisc // Record for disconnection
175  };
176 
177 enum recFval {forced =0x01, // If recFlag == isClose close due to disconnect
178  hasOPS =0x02, // If recFlag == isClose MonStatXFR + MonStatOPS
179  hasSSQ =0x04, // If recFlag == isClose XFR + OPS + MonStatSSQ
180  hasCSE =0x04, // If recFlag == isClose XFR + OPS + MonStatSSQ
181  hasLFN =0x01, // If recFlag == isOpen the lfn is present
182  hasRW =0x02, // If recFlag == isOpen file opened r/w
183  hasSID =0x01 // if recFlag == isTime sID is present (new rec)
184  };
185 
186 char recType; // RecTval: isClose | isOpen | isTime | isXfr
187 char recFlag; // RecFval: Record type-specific flags
188 short recSize; // Size of this record in bytes
189 union
190 {
191 kXR_unt32 fileID; // dictid of file for all rectypes except "disc" & "time"
192 kXR_unt32 userID; // dictid of user for rectypes equal "disc"
193 short nRecs[2]; // isTime: nRecs[0] == isXfr recs nRecs[1] == total recs
194 };
195 };
196 
197 // The following record is always be present as the first record in the udp
198 // udp packet and should be used to establish the recording window.
199 //
201 {
203 int tBeg; // time(0) of following record
204 int tEnd; // time(0) when packet was sent
205 kXR_int64 sID; // Server id in lower 48 bits
206 };
207 
208 
209 // The following variable length structure exists in XrdXrootdMonFileOPN if
210 // "lfn" has been specified. It exists only when recFlag & hasLFN is TRUE.
211 // The user's dictid will be zero (missing) if user monitoring is not enabled.
212 //
214 {
215 kXR_unt32 user; // Monitoring dictid for the user, may be 0.
216 char lfn[1028];// Variable length, use recSize!
217 };
218 
219 // The following is reported when a file is opened. If "lfn" was specified and
220 // Hdr.recFlag & hasLFN is TRUE the XrdXrootdMonFileLFN structure is present.
221 // However, it variable in size and the next record will be found using recSize.
222 // The lfn is gauranteed to end with at least one null byte.
223 //
225 {
227 long long fsz; // 8 file size at time of open
228 XrdXrootdMonFileLFN ufn; // Present ONLY if recFlag & hasLFN is TRUE
229 };
230 
231 // The following data is collected on a per file basis
232 //
233 struct XrdXrootdMonStatPRW // 8 Bytes
234 {
235 long long rBytes; // Bytes read from file so far using pgread()
236 int rCount; // Number of operations
237 int rRetry; // Number of pgread retries (pages)
238 long long wBytes; // Bytes written to file so far using pgwrite()
239 int wCount; // Number of operations
240 int wRetry; // Number of pgwrite retries (corrections)
241 int wcsErr; // Number of pgwrite checksum errors
242 int wcsUnc; // Number of pgwrite uncorrected checksums
243 };
244 
245 struct XrdXrootdMonStatOPS // 48 Bytes
246 {
247 int read; // Number of read() calls
248 int readv; // Number of readv() calls
249 int write; // Number of write() calls
250 short rsMin; // Smallest readv() segment count
251 short rsMax; // Largest readv() segment count
252 long long rsegs; // Number of readv() segments
253 int rdMin; // Smallest read() request size
254 int rdMax; // Largest read() request size
255 int rvMin; // Smallest readv() request size
256 int rvMax; // Largest readv() request size
257 int wrMin; // Smallest write() request size
258 int wrMax; // Largest write() request size
259 };
260 
262 {
263 long long dlong;
264 double dreal;
265 };
266 
267 struct XrdXrootdMonStatSSQ // 32 Bytes (all values net ordered IEEE754)
268 {
269 XrdXrootdMonDouble read; // Sum (all read requests)**2 (size)
270 XrdXrootdMonDouble readv; // Sum (all readv requests)**2 (size as a unit)
271 XrdXrootdMonDouble rsegs; // Sum (all readv segments)**2 (count as a unit)
272 XrdXrootdMonDouble write; // Sum (all write requests)**2 (size)
273 };
274 
275 // The following transfer data is collected for each open file.
276 //
278 {
279 long long read; // Bytes read from file so far using read()
280 long long readv; // Bytes read from file so far using readv()
281 long long write; // Bytes written to file so far
282 };
283 
284 // The following is reported upon file close. This is a variable length record.
285 // The record always contains XrdXrootdMonStatXFR after XrdXrootdMonFileHdr.
286 // If (recFlag & hasOPS) TRUE XrdXrootdMonStatOPS follows XrdXrootdMonStatXFR
287 // If (recFlag & hasSSQ) TRUE XrdXrootdMonStatSQV follows XrdXrootdMonStatOPS
288 // The XrdXrootdMonStatSSQ information is present only if "ssq" was specified.
289 //
290 struct XrdXrootdMonFileCLS // 32 | 80 | 96 Bytes
291 {
292 XrdXrootdMonFileHdr Hdr; // Always present (recSize has full length)
293 XrdXrootdMonStatXFR Xfr; // Always present
294 XrdXrootdMonStatOPS Ops; // Only present when (recFlag & hasOPS) is True
295 XrdXrootdMonStatSSQ Ssq; // Only present when (recFlag & hasSSQ) is True
296 };
297 
298 // The following is reported when a user ends a session.
299 //
301 {
303 };
304 
305 // The following is reported each interval*count for each open file when "xfr"
306 // is specified. These records may be interspersed with other records.
307 //
308 struct XrdXrootdMonFileXFR // 32 Bytes
309 {
310 XrdXrootdMonFileHdr Hdr; // Always present with recType == isXFR
311 XrdXrootdMonStatXFR Xfr; // Always present
312 };
313 #endif
union XrdXrootdMonRedir::@149 arg0
unsigned char kXR_char
Definition: XPtypes.hh:65
const kXR_char XROOTD_MON_OPENR
Definition: XrdXrootdMonData.hh:133
short rsMax
Definition: XrdXrootdMonData.hh:251
const kXR_char XROOTD_MON_MAPINFO
Definition: XrdXrootdMonData.hh:107
double dreal
Definition: XrdXrootdMonData.hh:264
const kXR_char XROOTD_MON_BOUNDP
Definition: XrdXrootdMonData.hh:145
const kXR_char XROOTD_MON_REDIRECT
Definition: XrdXrootdMonData.hh:126
Definition: XrdXrootdMonData.hh:181
int rvMax
Definition: XrdXrootdMonData.hh:256
int rCount
Definition: XrdXrootdMonData.hh:236
kXR_unt32 dictid
Definition: XrdXrootdMonData.hh:89
short rsMin
Definition: XrdXrootdMonData.hh:250
const kXR_char XROOTD_MON_RM
Definition: XrdXrootdMonData.hh:139
XrdXrootdMonStatOPS Ops
Definition: XrdXrootdMonData.hh:294
const kXR_char XROOTD_MON_PREP
Definition: XrdXrootdMonData.hh:137
int rvMin
Definition: XrdXrootdMonData.hh:255
const kXR_char XROOTD_MON_RMDIR
Definition: XrdXrootdMonData.hh:140
kXR_char pseq
Definition: XrdXrootdMonData.hh:41
Definition: XrdXrootdMonData.hh:73
int wcsUnc
Definition: XrdXrootdMonData.hh:242
XrdXrootdMonFileLFN ufn
Definition: XrdXrootdMonData.hh:228
const kXR_char XROOTD_MON_FORCED
Definition: XrdXrootdMonData.hh:144
Definition: XrdXrootdMonData.hh:174
const kXR_char XROOTD_MON_QUERY
Definition: XrdXrootdMonData.hh:138
kXR_unt32 dictid
Definition: XrdXrootdMonData.hh:54
int tBeg
Definition: XrdXrootdMonData.hh:82
const kXR_char XROOTD_MON_MAPUSER
Definition: XrdXrootdMonData.hh:113
unsigned short kXR_unt16
Definition: XPtypes.hh:67
const kXR_char XROOTD_MON_STAT
Definition: XrdXrootdMonData.hh:141
const kXR_char XROOTD_MON_LOCATE
Definition: XrdXrootdMonData.hh:130
int wCount
Definition: XrdXrootdMonData.hh:239
Definition: XrdXrootdMonData.hh:224
const kXR_char XROOTD_MON_GSTCP
Definition: XrdXrootdMonData.hh:118
kXR_int64 sID
Definition: XrdXrootdMonData.hh:75
Definition: XrdXrootdMonData.hh:46
int rRetry
Definition: XrdXrootdMonData.hh:237
kXR_int64 val
Definition: XrdXrootdMonData.hh:47
kXR_char Type
Definition: XrdXrootdMonData.hh:65
const kXR_char XROOTD_MON_DISC
Definition: XrdXrootdMonData.hh:95
const kXR_char XROOTD_MON_MAPGSTA
Definition: XrdXrootdMonData.hh:106
Definition: XrdXrootdMonData.hh:170
Definition: XrdXrootdMonData.hh:300
struct XrdXrootdMonRedir::@149::@151 rdr
XrdXrootdMonStatSSQ Ssq
Definition: XrdXrootdMonData.hh:295
XrdXrootdMonFileHdr Hdr
Definition: XrdXrootdMonData.hh:292
Definition: XrdXrootdMonData.hh:277
const long long XROOTD_MON_PIDMASK
Definition: XrdXrootdMonData.hh:153
XrdXrootdMonFileHdr Hdr
Definition: XrdXrootdMonData.hh:202
XrdXrootdMonHeader hdr
Definition: XrdXrootdMonData.hh:59
union XrdXrootdMonRedir::@150 arg1
const long long XROOTD_MON_PIDSHFT
Definition: XrdXrootdMonData.hh:154
Definition: XrdXrootdMonData.hh:87
const kXR_char XROOTD_MON_GSCCM
Definition: XrdXrootdMonData.hh:116
long long wBytes
Definition: XrdXrootdMonData.hh:238
const kXR_char XROOTD_MON_TRUNC
Definition: XrdXrootdMonData.hh:142
kXR_unt32 userID
Definition: XrdXrootdMonData.hh:192
const int XROOTD_MON_SRCMASK
Definition: XrdXrootdMonData.hh:148
XrdXrootdMonDouble readv
Definition: XrdXrootdMonData.hh:270
union XrdXrootdMonTrace::@146 arg0
XrdXrootdMonHeader hdr
Definition: XrdXrootdMonData.hh:81
Definition: XrdXrootdMonData.hh:245
const kXR_char XROOTD_MON_APPID
Definition: XrdXrootdMonData.hh:93
XrdXrootdMonDouble read
Definition: XrdXrootdMonData.hh:269
long long fsz
Definition: XrdXrootdMonData.hh:227
XrdXrootdMonHeader hdr
Definition: XrdXrootdMonData.hh:74
const int XROOTD_MON_REDMASK
Definition: XrdXrootdMonData.hh:147
int tEnd
Definition: XrdXrootdMonData.hh:204
kXR_unt16 plen
Definition: XrdXrootdMonData.hh:42
Definition: XrdXrootdMonData.hh:58
char info[1024+256]
Definition: XrdXrootdMonData.hh:90
XrdXrootdMonTrace info[sizeof(XrdXrootdMonTrace)]
Definition: XrdXrootdMonData.hh:60
Definition: XrdXrootdMonData.hh:233
int tBeg
Definition: XrdXrootdMonData.hh:203
Definition: XrdXrootdMonData.hh:178
const kXR_char XROOTD_MON_MAPMIGR
Definition: XrdXrootdMonData.hh:108
const kXR_char XROOTD_MON_REDSID
Definition: XrdXrootdMonData.hh:123
const kXR_char XROOTD_MON_GSPFC
Definition: XrdXrootdMonData.hh:117
int wrMin
Definition: XrdXrootdMonData.hh:257
recTval
Definition: XrdXrootdMonData.hh:170
const kXR_char XROOTD_MON_MAPFSTA
Definition: XrdXrootdMonData.hh:105
kXR_int32 buflen
Definition: XrdXrootdMonData.hh:51
kXR_int64 sID
Definition: XrdXrootdMonData.hh:84
const kXR_char XROOTD_MON_READV
Definition: XrdXrootdMonData.hh:97
const kXR_char XROOTD_MON_MV
Definition: XrdXrootdMonData.hh:136
union XrdXrootdMonTrace::@147 arg1
Definition: XrdXrootdMonData.hh:180
long long dlong
Definition: XrdXrootdMonData.hh:263
Definition: XrdXrootdMonData.hh:261
const kXR_char XROOTD_MON_MAPREDR
Definition: XrdXrootdMonData.hh:110
char recFlag
Definition: XrdXrootdMonData.hh:187
kXR_char Dent
Definition: XrdXrootdMonData.hh:66
const kXR_char XROOTD_MON_MAPPURG
Definition: XrdXrootdMonData.hh:109
XrdXrootdMonRedir info[sizeof(XrdXrootdMonRedir)]
Definition: XrdXrootdMonData.hh:77
kXR_unt32 dictid
Definition: XrdXrootdMonData.hh:69
Definition: XrdXrootdMonData.hh:177
Definition: XrdXrootdMonData.hh:63
int wcsErr
Definition: XrdXrootdMonData.hh:241
Definition: XrdXrootdMonData.hh:290
const kXR_char XROOTD_MON_MAPSTAG
Definition: XrdXrootdMonData.hh:111
const kXR_char XROOTD_MON_OPEN
Definition: XrdXrootdMonData.hh:96
XrdXrootdMonFileHdr Hdr
Definition: XrdXrootdMonData.hh:310
const int XROOTD_MON_TRGMASK
Definition: XrdXrootdMonData.hh:149
const kXR_char XROOTD_MON_MAPIDNT
Definition: XrdXrootdMonData.hh:103
const kXR_char XROOTD_MON_MAPPATH
Definition: XrdXrootdMonData.hh:104
kXR_char sXX[8]
Definition: XrdXrootdMonData.hh:76
Definition: XrdXrootdMonData.hh:200
int wrMax
Definition: XrdXrootdMonData.hh:258
Definition: XrdXrootdMonData.hh:80
kXR_int16 Port
Definition: XrdXrootdMonData.hh:67
const kXR_char XROOTD_MON_REDTIME
Definition: XrdXrootdMonData.hh:124
unsigned int kXR_unt32
Definition: XPtypes.hh:90
short recSize
Definition: XrdXrootdMonData.hh:188
Definition: XrdXrootdMonData.hh:183
XrdXrootdMonFileHdr Hdr
Definition: XrdXrootdMonData.hh:226
union XrdXrootdMonTrace::@148 arg2
const kXR_char XROOTD_MON_WINDOW
Definition: XrdXrootdMonData.hh:100
kXR_char code
Definition: XrdXrootdMonData.hh:40
kXR_int32 Window
Definition: XrdXrootdMonData.hh:52
int wRetry
Definition: XrdXrootdMonData.hh:240
const kXR_char XROOTD_MON_CLOSE
Definition: XrdXrootdMonData.hh:94
int write
Definition: XrdXrootdMonData.hh:249
const kXR_char XROOTD_MON_MKDIR
Definition: XrdXrootdMonData.hh:135
short nRecs[2]
Definition: XrdXrootdMonData.hh:193
Definition: XrdXrootdMonData.hh:39
Definition: XrdXrootdMonData.hh:267
int read
Definition: XrdXrootdMonData.hh:247
kXR_unt32 wTot
Definition: XrdXrootdMonData.hh:53
char recType
Definition: XrdXrootdMonData.hh:186
Definition: XrdXrootdMonData.hh:182
XrdXrootdMonFileHdr Hdr
Definition: XrdXrootdMonData.hh:302
XrdXrootdMonStatXFR Xfr
Definition: XrdXrootdMonData.hh:311
XrdXrootdMonDouble rsegs
Definition: XrdXrootdMonData.hh:271
kXR_unt32 user
Definition: XrdXrootdMonData.hh:215
kXR_unt32 fileID
Definition: XrdXrootdMonData.hh:191
Definition: XrdXrootdMonData.hh:308
long long readv
Definition: XrdXrootdMonData.hh:280
XrdXrootdMonDouble write
Definition: XrdXrootdMonData.hh:272
recFval
Definition: XrdXrootdMonData.hh:177
const kXR_char XROOTD_MON_OPENW
Definition: XrdXrootdMonData.hh:134
const int XROOTD_MON_NEWSTID
Definition: XrdXrootdMonData.hh:150
const kXR_char XROOTD_MON_OPENDIR
Definition: XrdXrootdMonData.hh:131
int kXR_int32
Definition: XPtypes.hh:89
Definition: XrdXrootdMonData.hh:179
int rdMax
Definition: XrdXrootdMonData.hh:254
XrdXrootdMonHeader hdr
Definition: XrdXrootdMonData.hh:88
kXR_int32 stod
Definition: XrdXrootdMonData.hh:43
Definition: XrdXrootdMonData.hh:173
Definition: XrdXrootdMonData.hh:171
Definition: XrdXrootdMonData.hh:168
int rdMin
Definition: XrdXrootdMonData.hh:253
const long long XROOTD_MON_SIDMASK
Definition: XrdXrootdMonData.hh:152
const kXR_char XROOTD_MON_MAPXFER
Definition: XrdXrootdMonData.hh:114
Definition: XrdXrootdMonData.hh:213
int tEnd
Definition: XrdXrootdMonData.hh:83
const kXR_char XROOTD_MON_REDHOST
Definition: XrdXrootdMonData.hh:99
XrdXrootdMonStatXFR Xfr
Definition: XrdXrootdMonData.hh:293
const kXR_char XROOTD_MON_REDLOCAL
Definition: XrdXrootdMonData.hh:127
kXR_unt32 rTot[2]
Definition: XrdXrootdMonData.hh:50
const kXR_char XROOTD_MON_READU
Definition: XrdXrootdMonData.hh:98
kXR_unt16 sVal[4]
Definition: XrdXrootdMonData.hh:49
long long kXR_int64
Definition: XPtypes.hh:98
char lfn[1028]
Definition: XrdXrootdMonData.hh:216
kXR_int64 sID
Definition: XrdXrootdMonData.hh:205
long long write
Definition: XrdXrootdMonData.hh:281
const kXR_char XROOTD_MON_MAPTRCE
Definition: XrdXrootdMonData.hh:112
const kXR_char XROOTD_MON_OPENC
Definition: XrdXrootdMonData.hh:132
long long rsegs
Definition: XrdXrootdMonData.hh:252
long long read
Definition: XrdXrootdMonData.hh:279
int readv
Definition: XrdXrootdMonData.hh:248
const kXR_char XROOTD_MON_CHMOD
Definition: XrdXrootdMonData.hh:129
Definition: XrdXrootdMonData.hh:172
kXR_int32 Window
Definition: XrdXrootdMonData.hh:64
short kXR_int16
Definition: XPtypes.hh:66
long long rBytes
Definition: XrdXrootdMonData.hh:235