XRootD
XrdClMonitor.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2012 by the Board of Trustees of the Leland Stanford, Jr.,
3 // University
4 // Copyright (c) 2012 by European Organization for Nuclear Research (CERN)
5 // Author: Andrew Hanushevsky <abh@stanford.edu>
6 // Author: Lukasz Janyst <ljanyst@cern.ch>
7 //------------------------------------------------------------------------------
8 // XRootD is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Lesser General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // XRootD is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public License
19 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
20 //------------------------------------------------------------------------------
21 
22 //------------------------------------------------------------------------------
39 //------------------------------------------------------------------------------
40 
41 #ifndef __XRD_CL_MONITOR_HH__
42 #define __XRD_CL_MONITOR_HH__
43 
44 #include "XrdCl/XrdClFileSystem.hh"
45 
46 #include <sys/time.h>
47 
48 namespace XrdCl
49 {
50  class URL;
51 
52  //----------------------------------------------------------------------------
54  //----------------------------------------------------------------------------
55  class Monitor
56  {
57  public:
58  //------------------------------------------------------------------------
60  //------------------------------------------------------------------------
61  Monitor() {}
62 
63  //------------------------------------------------------------------------
65  //------------------------------------------------------------------------
66  virtual ~Monitor() {}
67 
68  //------------------------------------------------------------------------
70  //------------------------------------------------------------------------
71  struct ConnectInfo
72  {
74  {
75  sTOD.tv_sec = 0; sTOD.tv_usec = 0;
76  eTOD.tv_sec = 0; eTOD.tv_usec = 0;
77  }
78  std::string server;
79  std::string auth;
80  timeval sTOD;
81  timeval eTOD;
82  uint16_t streams;
83  };
84 
85  //------------------------------------------------------------------------
87  //------------------------------------------------------------------------
89  {
91  {}
92  std::string server;
93  uint64_t rBytes;
94  uint64_t sBytes;
95  time_t cTime;
97  };
98 
99  //------------------------------------------------------------------------
101  //------------------------------------------------------------------------
102  struct OpenInfo
103  {
104  OpenInfo(): file(0), fSize(0), oFlags(0), oFlags2(0) {}
105  const URL *file;
106  std::string dataServer;
107  uint64_t fSize;
108  uint16_t oFlags;
109  uint16_t oFlags2;
110  };
111 
112  //------------------------------------------------------------------------
114  //------------------------------------------------------------------------
115  struct CloseInfo
116  {
118  file(0), rBytes(0), vrBytes(0), wBytes(0), vwBytes(0), vSegs(0), rCount(0),
119  vCount(0), wCount(0), status(0)
120  {
121  oTOD.tv_sec = 0; oTOD.tv_usec = 0;
122  cTOD.tv_sec = 0; cTOD.tv_usec = 0;
123  }
124  const URL *file;
125  timeval oTOD;
126  timeval cTOD;
127  uint64_t rBytes;
128  uint64_t vrBytes;
129  uint64_t wBytes;
130  uint64_t vwBytes;
131  uint64_t vSegs;
132  uint32_t rCount;
133  uint32_t vCount;
134  uint32_t wCount;
136  };
137 
138  //------------------------------------------------------------------------
140  //------------------------------------------------------------------------
141  struct ErrorInfo
142  {
144  {
145  ErrOpen = 0,
150  ErrUnc
151  };
152 
153  ErrorInfo(): file(0), status(0), opCode( ErrUnc ) {}
154  const URL *file;
157  };
158 
159  //------------------------------------------------------------------------
161  //------------------------------------------------------------------------
163  {
165  const URL *origin;
166  const URL *target;
167  };
168 
169  //------------------------------------------------------------------------
173  //------------------------------------------------------------------------
174  struct CopyBInfo
175  {
177  };
178 
179  //------------------------------------------------------------------------
181  //------------------------------------------------------------------------
182  struct CopyEInfo
183  {
185  {
186  bTOD.tv_sec = 0; bTOD.tv_usec = 0;
187  eTOD.tv_sec = 0; eTOD.tv_usec = 0;
188  }
190  int sources;
191  timeval bTOD;
192  timeval eTOD;
194  };
195 
196  //------------------------------------------------------------------------
198  //------------------------------------------------------------------------
200  {
201  CheckSumInfo(): oTime(0), tTime(0), isOK(false) {}
203  std::string cksum;
204  uint64_t oTime;
205  uint64_t tTime;
206  bool isOK;
207  };
208 
209  //------------------------------------------------------------------------
212  //------------------------------------------------------------------------
214  {
222  EvDisconnect
223 
224  };
225 
226  //------------------------------------------------------------------------
233  //------------------------------------------------------------------------
234  virtual void Event( EventCode evCode, void *evData ) = 0;
235  };
236 }
237 
238 #endif // __XRD_CL_MONITOR_HH
An abstract class to describe the client-side monitoring plugin interface.
Definition: XrdClMonitor.hh:56
virtual ~Monitor()
Destructor.
Definition: XrdClMonitor.hh:66
Monitor()
Constructor.
Definition: XrdClMonitor.hh:61
TransferInfo transfer
The transfer in question.
@ EvCopyBeg
CopyBInfo: Copy operation started.
@ EvDisconnect
DisconnectInfo: Logout from a server.
@ EvClose
CloseInfo: File closed.
@ EvCopyEnd
CopyEInfo: Copy operation ended.
@ EvCheckSum
CheckSumInfo: File checksummed.
@ EvErrIO
ErrorInfo: An I/O error occurred.
@ EvOpen
OpenInfo: File opened.
@ EvConnect
ConnectInfo: Login into a server.
virtual void Event(EventCode evCode, void *evData)=0
URL representation.
Definition: XrdClURL.hh:31
Describe a checksum event.
TransferInfo transfer
The transfer in question.
uint64_t tTime
Microseconds to obtain cksum from target.
bool isOK
True if checksum matched, false otherwise.
std::string cksum
Checksum as "type:value".
uint64_t oTime
Microseconds to obtain cksum from origin.
Describe a file close event.
uint64_t vwBytes
Total number of bytes written vie writev.
const XRootDStatus * status
Close status.
uint32_t wCount
Total count of writes.
uint64_t vSegs
Total count of readv segments.
uint64_t vrBytes
Total number of bytes read via readv.
timeval cTOD
gettimeofday() when file was closed
uint32_t vCount
Total count of readv.
const URL * file
The file in question.
uint64_t rBytes
Total number of bytes read via read.
timeval oTOD
gettimeofday() when file was opened
uint64_t wBytes
Total number of bytes written.
uint32_t rCount
Total count of reads.
Describe a server login event.
Definition: XrdClMonitor.hh:72
std::string server
"user@host:port"
Definition: XrdClMonitor.hh:78
uint16_t streams
Number of streams.
Definition: XrdClMonitor.hh:82
timeval sTOD
gettimeofday() when login started
Definition: XrdClMonitor.hh:80
timeval eTOD
gettimeofday() when login ended
Definition: XrdClMonitor.hh:81
std::string auth
authentication protocol used or empty if none
Definition: XrdClMonitor.hh:79
Describe an end of copy event.
TransferInfo transfer
The transfer in question.
int sources
Number of sources used for the copy.
timeval bTOD
Copy start time.
const XRootDStatus * status
Status of the copy.
timeval eTOD
Copy end time.
Describe a server logout event.
Definition: XrdClMonitor.hh:89
uint64_t rBytes
Number of bytes received.
Definition: XrdClMonitor.hh:93
Status status
Disconnection status.
Definition: XrdClMonitor.hh:96
std::string server
"user@host:port"
Definition: XrdClMonitor.hh:92
time_t cTime
Seconds connected to the server.
Definition: XrdClMonitor.hh:95
uint64_t sBytes
Number of bytes sent.
Definition: XrdClMonitor.hh:94
Describe an encountered file-based error.
@ ErrUnc
Unclassified operation.
const XRootDStatus * status
Status code.
const URL * file
The file in question.
Operation opCode
The associated operation.
Describe a file open event to the monitor.
uint64_t fSize
File size in bytes.
const URL * file
File in question.
uint16_t oFlags2
OpenFlags upper 16 bits.
std::string dataServer
Actual fata server.
uint16_t oFlags
OpenFlags.
Describe the transfer.
const URL * target
URL of the target.
const URL * origin
URL of the origin.
Procedure execution status.
Definition: XrdClStatus.hh:115