From d7b2f26c9fee91e3745c93976748ee73b7ed4b8b Mon Sep 17 00:00:00 2001 From: Michal Simon Date: Wed, 2 Oct 2019 15:29:13 +0200 Subject: [PATCH] [XrdCl] Monitor writev requests. --- src/XrdCl/XrdClFileStateHandler.cc | 27 +++++++++++++-------------- src/XrdCl/XrdClMonitor.hh | 30 ++++++++++++++---------------- tests/XrdClTests/MonitorTestLib.cc | 15 ++++++++------- 3 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/XrdCl/XrdClFileStateHandler.cc b/src/XrdCl/XrdClFileStateHandler.cc index 8db708bb63a..9f45d14f3f5 100644 --- a/src/XrdCl/XrdClFileStateHandler.cc +++ b/src/XrdCl/XrdClFileStateHandler.cc @@ -1453,12 +1453,10 @@ namespace XrdCl ClientRequest *req = (ClientRequest*)message->GetBuffer(); switch( req->header.requestid ) { - case kXR_read: i.opCode = Monitor::ErrorInfo::ErrRead; break; - case kXR_readv: i.opCode = Monitor::ErrorInfo::ErrReadV; break; - case kXR_write: i.opCode = Monitor::ErrorInfo::ErrWrite; break; - // TODO - // once we do major release we can replace this with 'ErrWriteV' - case kXR_writev: i.opCode = Monitor::ErrorInfo::ErrWrite; break; + case kXR_read: i.opCode = Monitor::ErrorInfo::ErrRead; break; + case kXR_readv: i.opCode = Monitor::ErrorInfo::ErrReadV; break; + case kXR_write: i.opCode = Monitor::ErrorInfo::ErrWrite; break; + case kXR_writev: i.opCode = Monitor::ErrorInfo::ErrWriteV; break; default: i.opCode = Monitor::ErrorInfo::ErrUnc; } @@ -2069,14 +2067,15 @@ namespace XrdCl i.file = pFileUrl; i.oTOD = pOpenTime; gettimeofday( &i.cTOD, 0 ); - i.rBytes = pRBytes; - i.vBytes = pVRBytes; - i.wBytes = pWBytes + pVWBytes; //TODO once we can break ABI compatibility - i.vSegs = pVSegs; // we will add a special field for WriteV - i.rCount = pRCount; - i.vCount = pVRCount; - i.wCount = pWCount; - i.status = status; + i.rBytes = pRBytes; + i.vrBytes = pVRBytes; + i.wBytes = pWBytes; + i.vwBytes = pVWBytes; + i.vSegs = pVSegs; + i.rCount = pRCount; + i.vCount = pVRCount; + i.wCount = pWCount; + i.status = status; mon->Event( Monitor::EvClose, &i ); } } diff --git a/src/XrdCl/XrdClMonitor.hh b/src/XrdCl/XrdClMonitor.hh index 77635dd2846..2fc7537776a 100644 --- a/src/XrdCl/XrdClMonitor.hh +++ b/src/XrdCl/XrdClMonitor.hh @@ -112,24 +112,24 @@ namespace XrdCl struct CloseInfo { CloseInfo(): - file(0), rBytes(0), vBytes(0), wBytes(0), vSegs(0), rCount(0), + file(0), rBytes(0), vrBytes(0), wBytes(0), vwBytes(0), vSegs(0), rCount(0), vCount(0), wCount(0), status(0) { oTOD.tv_sec = 0; oTOD.tv_usec = 0; cTOD.tv_sec = 0; cTOD.tv_usec = 0; } - const URL *file; //!< The file in question - timeval oTOD; //!< gettimeofday() when file was opened - timeval cTOD; //!< gettimeofday() when file was closed - uint64_t rBytes; //!< Total number of bytes read via read - uint64_t vBytes; //!< Total number of bytes read via readv - uint64_t wBytes; //!< Total number of bytes written -// uint64_t vwBytes; //!< Total number of bytes written vie writev - uint64_t vSegs; //!< Total count of readv segments - uint32_t rCount; //!< Total count of reads - uint32_t vCount; //!< Total count of readv - uint32_t wCount; //!< Total count of writes - const XRootDStatus *status; //!< Close status + const URL *file; //!< The file in question + timeval oTOD; //!< gettimeofday() when file was opened + timeval cTOD; //!< gettimeofday() when file was closed + uint64_t rBytes; //!< Total number of bytes read via read + uint64_t vrBytes; //!< Total number of bytes read via readv + uint64_t wBytes; //!< Total number of bytes written + uint64_t vwBytes; //!< Total number of bytes written vie writev + uint64_t vSegs; //!< Total count of readv segments + uint32_t rCount; //!< Total count of reads + uint32_t vCount; //!< Total count of readv + uint32_t wCount; //!< Total count of writes + const XRootDStatus *status; //!< Close status }; //------------------------------------------------------------------------ @@ -143,9 +143,7 @@ namespace XrdCl ErrRead, //!< Read ErrReadV, //!< Readv ErrWrite, //!< Write -// TODO -// ErrWriteV, //!< WriteV (we can uncomment only when we do a major -// release as this is an ABI change) + ErrWriteV, //!< WriteV ErrUnc //!< Unclassified operation }; diff --git a/tests/XrdClTests/MonitorTestLib.cc b/tests/XrdClTests/MonitorTestLib.cc index cddab1638a8..d5451084213 100644 --- a/tests/XrdClTests/MonitorTestLib.cc +++ b/tests/XrdClTests/MonitorTestLib.cc @@ -111,8 +111,8 @@ class MonitorTest: public XrdCl::Monitor i->file->GetURL().c_str(), timeOpen.c_str(), timeClosed.c_str(), i->status->ToStr().c_str() ); log->Debug( 2, "Closed file %s, bytes: read: %ld, readv: %ld, write:" - " %ld", i->file->GetURL().c_str(), i->rBytes, i->vBytes, - i->wBytes ); + " %ld, writev: %ld", i->file->GetURL().c_str(), i->rBytes, i->vrBytes, + i->wBytes, i->vwBytes ); log->Debug( 2, "Closed file %s, count: read: %d, readv: %d/%d, " "write: %d", i->file->GetURL().c_str(), i->rCount, i->vCount, i->vSegs, i->wCount ); @@ -129,11 +129,12 @@ class MonitorTest: public XrdCl::Monitor std::string op; switch( i->opCode ) { - case ErrorInfo::ErrOpen: op = "Open"; break; - case ErrorInfo::ErrRead: op = "Read"; break; - case ErrorInfo::ErrReadV: op = "ReadV"; break; - case ErrorInfo::ErrWrite: op = "Write"; break; - case ErrorInfo::ErrUnc: op = "Unclassified"; break; + case ErrorInfo::ErrOpen: op = "Open"; break; + case ErrorInfo::ErrRead: op = "Read"; break; + case ErrorInfo::ErrReadV: op = "ReadV"; break; + case ErrorInfo::ErrWrite: op = "Write"; break; + case ErrorInfo::ErrWriteV: op = "WriteV"; break; + case ErrorInfo::ErrUnc: op = "Unclassified"; break; }; log->Debug( 2, "Operation on file %s encountered an error: %s " "while %s", i->file->GetURL().c_str(),