From 19d3ef8559d5a36f23da9a16d5026d0e41ede93d Mon Sep 17 00:00:00 2001 From: Fons Rademakers <Fons.Rademakers@cern.ch> Date: Thu, 5 Nov 2009 01:37:22 +0000 Subject: [PATCH] change to new FileReadEvent start time convention. git-svn-id: http://root.cern.ch/svn/root/trunk@30977 27541ba8-7e3a-0410-8455-c3a389f83636 --- net/net/src/TNetFile.cxx | 14 ++++++-------- net/netx/src/TXNetFile.cxx | 23 +++++++++++++++++++++-- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/net/net/src/TNetFile.cxx b/net/net/src/TNetFile.cxx index fc385ff8347..bc063f260b0 100644 --- a/net/net/src/TNetFile.cxx +++ b/net/net/src/TNetFile.cxx @@ -327,7 +327,7 @@ Bool_t TNetFile::ReadBuffer(char *buf, Int_t len) gApplication->GetSignalHandler()->Delay(); Double_t start = 0; - if (gPerfStats != 0) start = TTimeStamp(); + if (gPerfStats) start = TTimeStamp(); if (fSocket->Send(Form("%lld %d", fOffset, len), kROOTD_GET) < 0) { Error("ReadBuffer", "error sending kROOTD_GET command"); @@ -368,9 +368,8 @@ Bool_t TNetFile::ReadBuffer(char *buf, Int_t len) end: - if (gPerfStats != 0) { - gPerfStats->FileReadEvent(this, len, double(TTimeStamp())-start); - } + if (gPerfStats) + gPerfStats->FileReadEvent(this, len, start); if (gApplication && gApplication->GetSignalHandler()) gApplication->GetSignalHandler()->HandleDelayedSignal(); @@ -401,7 +400,7 @@ Bool_t TNetFile::ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf) gApplication->GetSignalHandler()->Delay(); Double_t start = 0; - if (gPerfStats != 0) start = TTimeStamp(); + if (gPerfStats) start = TTimeStamp(); // Make the string with a list of offsets and lenghts Long64_t total_len = 0; @@ -467,9 +466,8 @@ Bool_t TNetFile::ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf) end: - if (gPerfStats != 0) { - gPerfStats->FileReadEvent(this, total_len, double(TTimeStamp())-start); - } + if (gPerfStats) + gPerfStats->FileReadEvent(this, total_len, start); if (gApplication && gApplication->GetSignalHandler()) gApplication->GetSignalHandler()->HandleDelayedSignal(); diff --git a/net/netx/src/TXNetFile.cxx b/net/netx/src/TXNetFile.cxx index fb8207c20a5..bd6af5a9f79 100644 --- a/net/netx/src/TXNetFile.cxx +++ b/net/netx/src/TXNetFile.cxx @@ -52,6 +52,8 @@ #include "TVirtualMonitoring.h" #include "TFileStager.h" #include "TFileCacheRead.h" +#include "TTimeStamp.h" +#include "TVirtualPerfStats.h" #include <XrdClient/XrdClient.hh> #include <XrdClient/XrdClientConst.hh> @@ -624,6 +626,9 @@ Bool_t TXNetFile::ReadBuffer(char *buffer, Int_t bufferLength) } } + Double_t start = 0; + if (gPerfStats) start = TTimeStamp(); + // Read from the remote xrootd Int_t nr = fClient->Read(buffer, fOffset, bufferLength); @@ -649,6 +654,9 @@ Bool_t TXNetFile::ReadBuffer(char *buffer, Int_t bufferLength) #endif } + if (gPerfStats) + gPerfStats->FileReadEvent(this, bufferLength, start); + if (gMonitoringWriter) gMonitoringWriter->SendFileReadProgress(this); @@ -680,6 +688,9 @@ Bool_t TXNetFile::ReadBufferAsync(Long64_t offs, Int_t bufferLength) return kTRUE; } + Double_t start = 0; + if (gPerfStats) start = TTimeStamp(); + Bool_t result = kFALSE; if (bufferLength==0) @@ -706,6 +717,9 @@ Bool_t TXNetFile::ReadBufferAsync(Long64_t offs, Int_t bufferLength) fgReadCalls++; #endif + if (gPerfStats) + gPerfStats->FileReadEvent(this, bufferLength, start); + if (gDebug > 1) Info("ReadBufferAsync", "%d bytes of data read request from offset" " %lld", bufferLength, offs); @@ -740,12 +754,14 @@ Bool_t TXNetFile::ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf) Error("ReadBuffers","The remote file is not open"); return kTRUE; } - + + Double_t start = 0; + if (gPerfStats) start = TTimeStamp(); + if (fArchiveOffset) for (Int_t i = 0; i < nbuf; i++) pos[i] += fArchiveOffset; - // A null buffer means that we want to use the async stuff // hence we have to sync the cache size in XrdClient with the supposed // size in TFile. @@ -779,6 +795,9 @@ Bool_t TXNetFile::ReadBuffers(char *buf, Long64_t *pos, Int_t *len, Int_t nbuf) fgReadCalls++; #endif + if (gPerfStats) + gPerfStats->FileReadEvent(this, nr, start); + if (gMonitoringWriter) gMonitoringWriter->SendFileReadProgress(this); -- GitLab