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 const kXR_char XROOTD_MON_GSHTP = 'H'; // Request processing activity from HTTP protocol
125 
126 // The following bits are insert in the low order 4 bits of the MON_REDIRECT
127 // entry code to indicate the actual operation that was requestded.
128 //
129 const kXR_char XROOTD_MON_REDSID = 0xf0; // Server Identification
130 const kXR_char XROOTD_MON_REDTIME = 0x00; // Timing mark
131 
132 const kXR_char XROOTD_MON_REDIRECT = 0x80; // With Modifier below!
133 const kXR_char XROOTD_MON_REDLOCAL = 0x90; // With Modifier below!
134 
135 const kXR_char XROOTD_MON_CHMOD = 0x01; // Modifiers for the above
142 const kXR_char XROOTD_MON_MV = 0x08;
145 const kXR_char XROOTD_MON_RM = 0x0b;
149 
152 
153 const int XROOTD_MON_REDMASK = 0x00000ff;
154 const int XROOTD_MON_SRCMASK = 0x000000f;
155 const int XROOTD_MON_TRGMASK = 0x7fffff0;
156 const int XROOTD_MON_NEWSTID = 0x8000000;
157 
158 const long long XROOTD_MON_SIDMASK = 0x0000ffffffffffff;
159 const long long XROOTD_MON_PIDMASK = 0xff;
160 const long long XROOTD_MON_PIDSHFT = 56;
161 
162 /******************************************************************************/
163 /* " f " S t r e a m S p e c i f i c R e c o r d s */
164 /******************************************************************************/
165 
166 // The UDP buffer layout is as follows:
167 //
168 // XrdXrootdMonHeader with Code == XROOTD_MON_MAPFSTA
169 // XrdXrootdMonFileTOD with recType == isTime
170 // XrdXrootdMonFileHdr with recType == one of recTval (variable length)
171 // ... additional XrdXrootdMonFileHdr's (variable length)
172 // XrdXrootdMonFileTOD with recType == isTime
173 
175 {
176 enum recTval {isClose = 0, // Record for close
177  isOpen, // Record for open
178  isTime, // Record for time
179  isXfr, // Record for transfers
180  isDisc // Record for disconnection
181  };
182 
183 enum recFval {forced =0x01, // If recFlag == isClose close due to disconnect
184  hasOPS =0x02, // If recFlag == isClose MonStatXFR + MonStatOPS
185  hasSSQ =0x04, // If recFlag == isClose XFR + OPS + MonStatSSQ
186  hasCSE =0x04, // If recFlag == isClose XFR + OPS + MonStatSSQ
187  hasLFN =0x01, // If recFlag == isOpen the lfn is present
188  hasRW =0x02, // If recFlag == isOpen file opened r/w
189  hasSID =0x01 // if recFlag == isTime sID is present (new rec)
190  };
191 
192 char recType; // RecTval: isClose | isOpen | isTime | isXfr
193 char recFlag; // RecFval: Record type-specific flags
194 short recSize; // Size of this record in bytes
195 union
196 {
197 kXR_unt32 fileID; // dictid of file for all rectypes except "disc" & "time"
198 kXR_unt32 userID; // dictid of user for rectypes equal "disc"
199 short nRecs[2]; // isTime: nRecs[0] == isXfr recs nRecs[1] == total recs
200 };
201 };
202 
203 // The following record is always be present as the first record in the udp
204 // udp packet and should be used to establish the recording window.
205 //
207 {
209 int tBeg; // time(0) of following record
210 int tEnd; // time(0) when packet was sent
211 kXR_int64 sID; // Server id in lower 48 bits
212 };
213 
214 
215 // The following variable length structure exists in XrdXrootdMonFileOPN if
216 // "lfn" has been specified. It exists only when recFlag & hasLFN is TRUE.
217 // The user's dictid will be zero (missing) if user monitoring is not enabled.
218 //
220 {
221 kXR_unt32 user; // Monitoring dictid for the user, may be 0.
222 char lfn[1028];// Variable length, use recSize!
223 };
224 
225 // The following is reported when a file is opened. If "lfn" was specified and
226 // Hdr.recFlag & hasLFN is TRUE the XrdXrootdMonFileLFN structure is present.
227 // However, it variable in size and the next record will be found using recSize.
228 // The lfn is gauranteed to end with at least one null byte.
229 //
231 {
233 long long fsz; // 8 file size at time of open
234 XrdXrootdMonFileLFN ufn; // Present ONLY if recFlag & hasLFN is TRUE
235 };
236 
237 // The following data is collected on a per file basis
238 //
239 struct XrdXrootdMonStatPRW // 8 Bytes
240 {
241 long long rBytes; // Bytes read from file so far using pgread()
242 int rCount; // Number of operations
243 int rRetry; // Number of pgread retries (pages)
244 long long wBytes; // Bytes written to file so far using pgwrite()
245 int wCount; // Number of operations
246 int wRetry; // Number of pgwrite retries (corrections)
247 int wcsErr; // Number of pgwrite checksum errors
248 int wcsUnc; // Number of pgwrite uncorrected checksums
249 };
250 
251 struct XrdXrootdMonStatOPS // 48 Bytes
252 {
253 int read; // Number of read() calls
254 int readv; // Number of readv() calls
255 int write; // Number of write() calls
256 short rsMin; // Smallest readv() segment count
257 short rsMax; // Largest readv() segment count
258 long long rsegs; // Number of readv() segments
259 int rdMin; // Smallest read() request size
260 int rdMax; // Largest read() request size
261 int rvMin; // Smallest readv() request size
262 int rvMax; // Largest readv() request size
263 int wrMin; // Smallest write() request size
264 int wrMax; // Largest write() request size
265 };
266 
268 {
269 long long dlong;
270 double dreal;
271 };
272 
273 struct XrdXrootdMonStatSSQ // 32 Bytes (all values net ordered IEEE754)
274 {
275 XrdXrootdMonDouble read; // Sum (all read requests)**2 (size)
276 XrdXrootdMonDouble readv; // Sum (all readv requests)**2 (size as a unit)
277 XrdXrootdMonDouble rsegs; // Sum (all readv segments)**2 (count as a unit)
278 XrdXrootdMonDouble write; // Sum (all write requests)**2 (size)
279 };
280 
281 // The following transfer data is collected for each open file.
282 //
284 {
285 long long read; // Bytes read from file so far using read()
286 long long readv; // Bytes read from file so far using readv()
287 long long write; // Bytes written to file so far
288 };
289 
290 // The following is reported upon file close. This is a variable length record.
291 // The record always contains XrdXrootdMonStatXFR after XrdXrootdMonFileHdr.
292 // If (recFlag & hasOPS) TRUE XrdXrootdMonStatOPS follows XrdXrootdMonStatXFR
293 // If (recFlag & hasSSQ) TRUE XrdXrootdMonStatSQV follows XrdXrootdMonStatOPS
294 // The XrdXrootdMonStatSSQ information is present only if "ssq" was specified.
295 //
296 struct XrdXrootdMonFileCLS // 32 | 80 | 96 Bytes
297 {
298 XrdXrootdMonFileHdr Hdr; // Always present (recSize has full length)
299 XrdXrootdMonStatXFR Xfr; // Always present
300 XrdXrootdMonStatOPS Ops; // Only present when (recFlag & hasOPS) is True
301 XrdXrootdMonStatSSQ Ssq; // Only present when (recFlag & hasSSQ) is True
302 };
303 
304 // The following is reported when a user ends a session.
305 //
307 {
309 };
310 
311 // The following is reported each interval*count for each open file when "xfr"
312 // is specified. These records may be interspersed with other records.
313 //
314 struct XrdXrootdMonFileXFR // 32 Bytes
315 {
316 XrdXrootdMonFileHdr Hdr; // Always present with recType == isXFR
317 XrdXrootdMonStatXFR Xfr; // Always present
318 };
319 #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
union XrdXrootdMonRedir::@177 arg0
const kXR_char XROOTD_MON_REDLOCAL
const kXR_char XROOTD_MON_GSTCP
XrdXrootdMonHeader hdr
const kXR_char XROOTD_MON_DISC
const kXR_char XROOTD_MON_MAPUEAC
union XrdXrootdMonRedir::@178 arg1
const kXR_char XROOTD_MON_WINDOW
const kXR_char XROOTD_MON_READV
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
union XrdXrootdMonTrace::@175 arg1
XrdXrootdMonFileHdr Hdr
const kXR_char XROOTD_MON_APPID
const kXR_char XROOTD_MON_MAPINFO
const kXR_char XROOTD_MON_OPENC
const kXR_char XROOTD_MON_TRUNC
const kXR_char XROOTD_MON_REDSID
const kXR_char XROOTD_MON_GSHTP
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
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
union XrdXrootdMonTrace::@176 arg2
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
union XrdXrootdMonTrace::@174 arg0
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
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