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