From: agheata Date: Fri, 13 Jul 2012 06:55:59 +0000 (+0000) Subject: More precise timing for the throughput calculation X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=9c19e756e42d517d23ca50a43a53c6b0ccdc59f4 More precise timing for the throughput calculation --- diff --git a/ANALYSIS/AliAnalysisDataContainer.cxx b/ANALYSIS/AliAnalysisDataContainer.cxx index fee2617..0724f0d 100644 --- a/ANALYSIS/AliAnalysisDataContainer.cxx +++ b/ANALYSIS/AliAnalysisDataContainer.cxx @@ -51,7 +51,6 @@ #include #include #include -#include #include "AliAnalysisManager.h" #include "AliAnalysisDataContainer.h" @@ -505,7 +504,7 @@ AliAnalysisFileDescriptor::AliAnalysisFileDescriptor() :TObject(), fLfn(), fGUID(), fUrl(), fPfn(), fSE(), fIsArchive(kFALSE), fImage(0), fNreplicas(0), fStartBytes(0), fReadBytes(0), fSize(0), fOpenedAt(0), - fOpenTime(0.), fProcessingTime(0.), fThroughput(0.) + fOpenTime(0.), fProcessingTime(0.), fThroughput(0.), fTimer() { // I/O constructor } @@ -515,7 +514,7 @@ AliAnalysisFileDescriptor::AliAnalysisFileDescriptor(const TFile *file) :TObject(), fLfn(), fGUID(), fUrl(), fPfn(), fSE(), fIsArchive(kFALSE), fImage(0), fNreplicas(0), fStartBytes(0), fReadBytes(0), fSize(0), fOpenedAt(0), - fOpenTime(0.), fProcessingTime(0.), fThroughput(0.) + fOpenTime(0.), fProcessingTime(0.), fThroughput(0.), fTimer() { // Normal constructor if (file->InheritsFrom("TAlienFile")) { @@ -548,7 +547,7 @@ AliAnalysisFileDescriptor::AliAnalysisFileDescriptor(const AliAnalysisFileDescri fIsArchive(other.fIsArchive), fImage(other.fImage), fNreplicas(other.fNreplicas), fStartBytes(other.fStartBytes), fReadBytes(other.fReadBytes), fSize(other.fSize), fOpenedAt(other.fOpenedAt), fOpenTime(other.fOpenTime), - fProcessingTime(other.fProcessingTime), fThroughput(other.fThroughput) + fProcessingTime(other.fProcessingTime), fThroughput(other.fThroughput), fTimer() { // CC } @@ -587,10 +586,12 @@ AliAnalysisFileDescriptor::~AliAnalysisFileDescriptor() void AliAnalysisFileDescriptor::Done() { // Must be called at the end of processing, providing file->GetBytesRead() as argument. + fTimer.Stop(); const Double_t megabyte = 1048576.; - Long64_t stampnow = time(0); +// Long64_t stampnow = time(0); fReadBytes = TFile::GetFileBytesRead()-fStartBytes; - fProcessingTime = stampnow-fOpenedAt; +// fProcessingTime = stampnow-fOpenedAt; + fProcessingTime = fTimer.RealTime(); Double_t readsize = fReadBytes/megabyte; fThroughput = readsize/fProcessingTime; } diff --git a/ANALYSIS/AliAnalysisDataContainer.h b/ANALYSIS/AliAnalysisDataContainer.h index 0a6df3c..ce901f8 100644 --- a/ANALYSIS/AliAnalysisDataContainer.h +++ b/ANALYSIS/AliAnalysisDataContainer.h @@ -23,6 +23,10 @@ #include "TString.h" #endif +#ifndef ROOT_TStopwatch +#include "TStopwatch.h" +#endif + class TClass; class TFile; class TObjArray; @@ -144,8 +148,6 @@ protected: // AliAnalysisFileDescriptor - A simple wrapper for data related to accessing // an analysis input file. //============================================================================== -class TStopwatch; - class AliAnalysisFileDescriptor : public TObject { public: @@ -194,6 +196,7 @@ protected: Double_t fOpenTime; // Time elapsed to open file Double_t fProcessingTime; // Processing Double_t fThroughput; // Throughput + TStopwatch fTimer; //! Processing time ClassDef(AliAnalysisFileDescriptor,1) // Class describing a a file processed in the analysis };