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) {}
105  const URL *file;
106  std::string dataServer;
107  uint64_t fSize;
108  uint16_t oFlags;
109  };
110 
111  //------------------------------------------------------------------------
113  //------------------------------------------------------------------------
114  struct CloseInfo
115  {
117  file(0), rBytes(0), vrBytes(0), wBytes(0), vwBytes(0), vSegs(0), rCount(0),
118  vCount(0), wCount(0), status(0)
119  {
120  oTOD.tv_sec = 0; oTOD.tv_usec = 0;
121  cTOD.tv_sec = 0; cTOD.tv_usec = 0;
122  }
123  const URL *file;
124  timeval oTOD;
125  timeval cTOD;
126  uint64_t rBytes;
127  uint64_t vrBytes;
128  uint64_t wBytes;
129  uint64_t vwBytes;
130  uint64_t vSegs;
131  uint32_t rCount;
132  uint32_t vCount;
133  uint32_t wCount;
135  };
136 
137  //------------------------------------------------------------------------
139  //------------------------------------------------------------------------
140  struct ErrorInfo
141  {
143  {
144  ErrOpen = 0,
149  ErrUnc
150  };
151 
152  ErrorInfo(): file(0), status(0), opCode( ErrUnc ) {}
153  const URL *file;
156  };
157 
158  //------------------------------------------------------------------------
160  //------------------------------------------------------------------------
162  {
164  const URL *origin;
165  const URL *target;
166  };
167 
168  //------------------------------------------------------------------------
172  //------------------------------------------------------------------------
173  struct CopyBInfo
174  {
176  };
177 
178  //------------------------------------------------------------------------
180  //------------------------------------------------------------------------
181  struct CopyEInfo
182  {
184  {
185  bTOD.tv_sec = 0; bTOD.tv_usec = 0;
186  eTOD.tv_sec = 0; eTOD.tv_usec = 0;
187  }
189  int sources;
190  timeval bTOD;
191  timeval eTOD;
193  };
194 
195  //------------------------------------------------------------------------
197  //------------------------------------------------------------------------
199  {
200  CheckSumInfo(): oTime(0), tTime(0), isOK(false) {}
202  std::string cksum;
203  uint64_t oTime;
204  uint64_t tTime;
205  bool isOK;
206  };
207 
208  //------------------------------------------------------------------------
211  //------------------------------------------------------------------------
213  {
221  EvDisconnect
222 
223  };
224 
225  //------------------------------------------------------------------------
232  //------------------------------------------------------------------------
233  virtual void Event( EventCode evCode, void *evData ) = 0;
234  };
235 }
236 
237 #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.
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