Skip to content

Commit

Permalink
[XrdCl] Monitor writev requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal authored and osschar committed Oct 10, 2019
1 parent b8722b5 commit d7b2f26
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 37 deletions.
27 changes: 13 additions & 14 deletions src/XrdCl/XrdClFileStateHandler.cc
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 );
}
}
Expand Down
30 changes: 14 additions & 16 deletions src/XrdCl/XrdClMonitor.hh
Expand Up @@ -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
};

//------------------------------------------------------------------------
Expand All @@ -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
};

Expand Down
15 changes: 8 additions & 7 deletions tests/XrdClTests/MonitorTestLib.cc
Expand Up @@ -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 );
Expand All @@ -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(),
Expand Down

0 comments on commit d7b2f26

Please sign in to comment.