More precise timing for the throughput calculation
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Jul 2012 06:55:59 +0000 (06:55 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Jul 2012 06:55:59 +0000 (06:55 +0000)
ANALYSIS/AliAnalysisDataContainer.cxx
ANALYSIS/AliAnalysisDataContainer.h

index fee2617..0724f0d 100644 (file)
@@ -51,7 +51,6 @@
 #include <TTree.h>
 #include <TH1.h>
 #include <TROOT.h>
-#include <TStopwatch.h>
 
 #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;
 }   
index 0a6df3c..ce901f8 100644 (file)
 #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
 };