]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
extra benchmarks are added
authorsgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 7 Mar 2010 00:47:05 +0000 (00:47 +0000)
committersgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 7 Mar 2010 00:47:05 +0000 (00:47 +0000)
19 files changed:
HLT/BASE/util/AliHLTComponentBenchmark.cxx [new file with mode: 0644]
HLT/BASE/util/AliHLTComponentBenchmark.h [new file with mode: 0644]
HLT/ITS/AliHLTITSClusterFinderComponent.cxx
HLT/ITS/AliHLTITSClusterFinderComponent.h
HLT/ITS/tracking/AliHLTITSTrackerComponent.cxx
HLT/ITS/tracking/AliHLTITSTrackerComponent.h
HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
HLT/TPCLib/AliHLTTPCClusterFinderComponent.h
HLT/TPCLib/tracking-ca/AliHLTTPCCAGlobalMergerComponent.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCAGlobalMergerComponent.h
HLT/TPCLib/tracking-ca/AliHLTTPCCAInputDataCompressorComponent.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCAInputDataCompressorComponent.h
HLT/TPCLib/tracking-ca/AliHLTTPCCATrackerComponent.cxx
HLT/TPCLib/tracking-ca/AliHLTTPCCATrackerComponent.h
HLT/global/AliHLTGlobalEsdConverterComponent.cxx
HLT/global/AliHLTGlobalEsdConverterComponent.h
HLT/global/AliHLTGlobalVertexerComponent.cxx
HLT/global/AliHLTGlobalVertexerComponent.h
HLT/libAliHLTUtil.pkg

diff --git a/HLT/BASE/util/AliHLTComponentBenchmark.cxx b/HLT/BASE/util/AliHLTComponentBenchmark.cxx
new file mode 100644 (file)
index 0000000..fbdc8ae
--- /dev/null
@@ -0,0 +1,120 @@
+// **************************************************************************
+// This file is property of and copyright by the ALICE HLT Project          *
+// ALICE Experiment at CERN, All rights reserved.                           *
+//                                                                          *
+// Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> 
+//                  for The ALICE HLT Project.                              *
+//                                                                          *
+// Permission to use, copy, modify and distribute this software and its     *
+// documentation strictly for non-commercial purposes is hereby granted     *
+// without fee, provided that the above copyright notice appears in all     *
+// copies and that both the copyright notice and this permission notice     *
+// appear in the supporting documentation. The authors make no claims       *
+// about the suitability of this software for any purpose. It is            *
+// provided "as is" without express or implied warranty.                    *
+//                                                                          *
+//***************************************************************************
+
+
+#include "AliHLTComponentBenchmark.h"
+
+AliHLTComponentBenchmark::AliHLTComponentBenchmark( const char *Name )
+  :fComponentName(Name),fNTimers(0),fNEvents(0), fTotalInput(0),fTotalOutput(0), fStatistics()
+{
+  // !
+  Reset();
+}
+
+void AliHLTComponentBenchmark::Reset()
+{
+  // !
+  fNEvents = 0;
+  fTotalInput = 0;
+  fTotalOutput = 0;
+  for( int i=0; i<10; i++ ){
+    fTimers[i].Reset();
+    fTotalRealTime[i] = 0;
+    fTotalCPUTime[i] = 0;
+  }
+  fStatistics = "";
+}
+
+void AliHLTComponentBenchmark::SetName( const char *Name )
+{
+  // !
+  fComponentName = Name;
+}
+
+void AliHLTComponentBenchmark::SetTimer( Int_t i, const char *Name )
+{
+  // !
+  if( i>=10 ) return;
+  if( i>=fNTimers ){
+    for( ; fNTimers<=i; fNTimers++ ){      
+      fTimers[fNTimers].Reset();
+      fTotalRealTime[fNTimers] = 0;
+      fTotalCPUTime[fNTimers] = 0;
+      fNames[fNTimers] = Form("timer %d",fNTimers);
+    }
+    fNames[i] = Name;   
+  }
+}
+
+void AliHLTComponentBenchmark::StartNewEvent()
+{
+  // !
+  fNEvents++;
+  for( int i=0; i<10; i++ ){
+    fTimers[i].Reset();
+  } 
+}
+
+void AliHLTComponentBenchmark::Start( Int_t i )
+{
+  // !
+  if( i>=10 ) return;
+  fTimers[i].Start();
+}
+
+void AliHLTComponentBenchmark::Stop( Int_t i )
+{
+  // !
+  if( i>=10 ) return;
+  fTimers[i].Stop();
+  fTotalRealTime[i]+= fTimers[i].RealTime();
+  fTotalCPUTime[i] += fTimers[i].CpuTime();
+}
+
+
+void AliHLTComponentBenchmark::AddInput( Double_t x )
+{
+  // !
+  fTotalInput+=x;
+}
+
+void AliHLTComponentBenchmark::AddOutput( Double_t x )
+{
+  // !
+  fTotalOutput+=x;
+}
+
+const char *AliHLTComponentBenchmark::GetStatistics()
+{
+  // !
+  if( fNEvents<=0 ) return fStatistics.Data();
+  float ratio = 1;
+  if( fTotalInput >0 ) ratio = fTotalOutput / fTotalInput;
+
+  fStatistics = Form("%s, %d events: in %.1f Kb, out %.1f Kb, ratio %.1f", 
+                    fComponentName.Data(), fNEvents, fTotalInput/fNEvents/1024, fTotalOutput/fNEvents/1024, ratio);
+  
+  if( fNTimers<=0 ) return fStatistics.Data();
+  fStatistics+=Form("; Time %.1fms/%.1fHz (real/cpu = ",fTotalRealTime[0]/fNEvents*1.e3,fNEvents/fTotalRealTime[0]);
+  
+  for( int i=0; i<fNTimers; i++ ){
+    if( i>0 ) fStatistics+=", ";
+    fStatistics+= Form("%s %.1f/%.1fms",fNames[i].Data(),fTotalRealTime[i]/fNEvents*1.e3, fTotalCPUTime[i]/fNEvents*1.e3  );    
+  }
+  fStatistics+=")";
+  return fStatistics.Data();
+}
diff --git a/HLT/BASE/util/AliHLTComponentBenchmark.h b/HLT/BASE/util/AliHLTComponentBenchmark.h
new file mode 100644 (file)
index 0000000..d01fd9d
--- /dev/null
@@ -0,0 +1,52 @@
+//-*- Mode: C++ -*-
+// ************************************************************************
+// This file is property of and copyright by the ALICE HLT Project        *
+// ALICE Experiment at CERN, All rights reserved.                         *
+// See cxx source for full Copyright notice                               *
+//                                                                        *
+//*************************************************************************
+
+
+#ifndef ALIHLTCOMPONENTBENCHMARK_H
+#define ALIHLTCOMPONENTBENCHMARK_H
+
+#include "TStopwatch.h"
+#include "TString.h"
+
+/**
+ * @class AliHLTComponentBenchmark
+ *
+ * AliHLTComponentBenchmark can be used to benchmark HLT compnoents
+ */
+class AliHLTComponentBenchmark
+{
+  public:
+
+  AliHLTComponentBenchmark( const char *Name="" );
+  ~AliHLTComponentBenchmark(){}
+
+  void Reset();
+  void SetName( const char *Name );
+  void SetTimer( Int_t i, const char *Name );
+  void StartNewEvent();
+  void Start( Int_t i );
+  void Stop( Int_t i );
+  void AddInput( Double_t x );
+  void AddOutput( Double_t x );
+  const char *GetStatistics();
+
+  private:
+
+  TString fComponentName;// name of the component
+  Int_t fNTimers; // n of timers
+  TStopwatch fTimers[10]; // the timers
+  TString fNames[10]; // timer names
+  ULong_t fNEvents; // N events processed
+  Double_t fTotalRealTime[10]; // total real time
+  Double_t fTotalCPUTime[10]; // total CPU time
+  Double_t fTotalInput; // total input size
+  Double_t fTotalOutput; // total output size
+  TString fStatistics;// string with statistics
+};
+
+#endif 
index 5165e03d8530aedc0c3444c6bfc29a2df8d44a4c..de42e16f8eb37b303e9ac719c42eb84fb9e7f41e 100644 (file)
@@ -68,7 +68,8 @@ AliHLTITSClusterFinderComponent::AliHLTITSClusterFinderComponent(int mode)
   fSSD(NULL),
   tD(NULL),
   tR(NULL),
-  fclusters()
+  fclusters(),
+  fBenchmark(GetComponentID())
 { 
   // see header file for class documentation
   // or
@@ -157,6 +158,10 @@ AliHLTComponent* AliHLTITSClusterFinderComponent::Spawn() {
        
 Int_t AliHLTITSClusterFinderComponent::DoInit( int argc, const char** argv ) {
   // see header file for class documentation
+  fBenchmark.Reset();
+  fBenchmark.SetTimer(0,"total");
+  fBenchmark.SetTimer(1,"reco");
+
   /*
   fStatTime = 0;
   fStatTimeAll = 0;
@@ -340,8 +345,6 @@ Int_t AliHLTITSClusterFinderComponent::DoDeinit() {
   return 0;
 }
 
-// #include "TStopwatch.h"
-
 int AliHLTITSClusterFinderComponent::DoEvent
 (
  const AliHLTComponentEventData& evtData,
@@ -363,11 +366,17 @@ int AliHLTITSClusterFinderComponent::DoEvent
       HLTDebug("no blocks in event" );
       return 0;
     }
-  
-  // TStopwatch timer;
+
+  fBenchmark.StartNewEvent();
+  fBenchmark.Start(0);
+  for( const AliHLTComponentBlockData *i= GetFirstInputBlock(fInputDataType); i!=NULL; i=GetNextInputBlock() ){
+    fBenchmark.AddInput(i->fSize);
+  }
+
   Int_t ret = 0;
-  //std::vector<AliITSRecPoint> vclusters;
+
   if(fModeSwitch==kClusterFinderDigits) {
+
     for ( const TObject *iter = GetFirstInputObject(fInputDataType); iter != NULL; iter = GetNextInputObject() ) {  
       tD = dynamic_cast<TTree*>(const_cast<TObject*>( iter ) );
       if(!tD){
@@ -379,8 +388,9 @@ int AliHLTITSClusterFinderComponent::DoEvent
       fDettype->MakeBranch(tR,"R");
       fDettype->SetTreeAddressR(tR);
       Option_t *opt="All";
+      fBenchmark.Start(1);
       fDettype->DigitsToRecPoints(tD,tR,0,opt,kTRUE);
-      
+      fBenchmark.Stop(1);
       TClonesArray * fRecPoints;
       tR->SetBranchAddress("ITSRecPoints",&fRecPoints);
       for(Int_t treeEntry=0;treeEntry<tR->GetEntries();treeEntry++){
@@ -403,9 +413,9 @@ int AliHLTITSClusterFinderComponent::DoEvent
        break;          
       }
       if( nClusters>0 ){
-
+       fBenchmark.Start(1);
        RecPointToSpacePoint(outputPtr,size);
-       
+       fBenchmark.Stop(1);
        AliHLTComponentBlockData bd;
        FillBlockData( bd );
        bd.fOffset = size;
@@ -414,7 +424,7 @@ int AliHLTITSClusterFinderComponent::DoEvent
        bd.fDataType = GetOutputDataType();
        outputBlocks.push_back( bd );
        size += bufferSize;
-       
+       fBenchmark.AddOutput(bd.fSize);
        fclusters.clear();      
       }
     }
@@ -451,8 +461,9 @@ int AliHLTITSClusterFinderComponent::DoEvent
       if(!fRawReader->AddBuffer((UChar_t*) iter->fPtr, iter->fSize, id)){
        HLTWarning("Could not add buffer");
       }
-      // TStopwatch timer1;
-      
+
+      fBenchmark.Start(1);
+
       if(fModeSwitch==kClusterFinderSPD && !fUseOfflineFinder){ fSPD->RawdataToClusters( fRawReader, fclusters ); }
       else if(fModeSwitch==kClusterFinderSSD && !fUseOfflineFinder){ fSSD->RawdataToClusters( fclusters ); }
       else{
@@ -471,10 +482,7 @@ int AliHLTITSClusterFinderComponent::DoEvent
          fClusters[i] = NULL;
        }     
       }
-      
-      // timer1.Stop();
-      // fStatTime+=timer1.RealTime();
-      // fStatTimeC+=timer1.CpuTime();
+      fBenchmark.Stop(1);
       
       fRawReader->ClearBuffers();    
          
@@ -498,23 +506,15 @@ int AliHLTITSClusterFinderComponent::DoEvent
        bd.fDataType = GetOutputDataType();
        outputBlocks.push_back( bd );
        size += bufferSize;
-       
+       fBenchmark.AddOutput(bd.fSize);
        fclusters.clear();      
       }
       
     } // input blocks
   }
-  /*
-  timer.Stop();
-  
-  fStatTimeAll+=timer.RealTime();
-  fStatTimeAllC+=timer.CpuTime();
-  fStatNEv++;
-  if( fStatNEv%1000==0 && fStatTimeAll>0.0 && fStatTime>0.0 && fStatTimeAllC>0.0 && fStatTimeC>0.0)
-    cout<<fStatTimeAll/fStatNEv*1.e3<<" "<<fStatTime/fStatNEv*1.e3<<" "
-       <<fStatTimeAllC/fStatNEv*1.e3<<" "<<fStatTimeC/fStatNEv*1.e3<<" ms"<<endl;
-  */
 
+  fBenchmark.Stop(0);
+  HLTInfo(fBenchmark.GetStatistics());
   return ret;
 }
 
index cd13c595b69726276c93e965f843e2cbeff81a5e..4696963891ae7fe3b446880276646cf2fb2e0e55 100644 (file)
@@ -21,6 +21,7 @@
 #include "TClonesArray.h"
 #include "AliHLTDataTypes.h"
 #include "TTree.h"
+#include "AliHLTComponentBenchmark.h"
 
 class AliHLTITSClusterFinderSPD;
 class AliHLTITSClusterFinderSSD;
@@ -213,13 +214,8 @@ class AliHLTITSClusterFinderComponent : public AliHLTProcessor
   TTree *tR;                                                  //!transient
 
   std::vector<AliITSRecPoint> fclusters;                      //!transient
-  /*
-  int fStatNEv;
-  double fStatTime;
-  double fStatTimeAll;
-  double fStatTimeC;
-  double fStatTimeAllC;
-  */
+
+  AliHLTComponentBenchmark fBenchmark;// benchmark
 
   ClassDef(AliHLTITSClusterFinderComponent, 0)
     
index a5c7bb693a69610050c350839524fc818745f865..aa14ae1ecdbb36d96bede64a2421fbfbfa31f1ab 100644 (file)
@@ -58,9 +58,7 @@ ClassImp( AliHLTITSTrackerComponent )
 AliHLTITSTrackerComponent::AliHLTITSTrackerComponent()
     :
     fSolenoidBz( 0 ),
-    fFullTime( 0 ),
-    fRecoTime( 0 ),
-    fNEvents( 0 ),
+    fBenchmark("ITSTracker"),
     fTracker(0)
 {
   // see header file for class documentation
@@ -74,9 +72,7 @@ AliHLTITSTrackerComponent::AliHLTITSTrackerComponent( const AliHLTITSTrackerComp
     :
     AliHLTProcessor(),
     fSolenoidBz( 0 ),
-    fFullTime( 0 ),
-    fRecoTime( 0 ),
-    fNEvents( 0 ),
+    fBenchmark("ITSTracker"),
     fTracker(0)
 {
   // see header file for class documentation
@@ -151,9 +147,7 @@ void AliHLTITSTrackerComponent::SetDefaultConfiguration()
   // Some parameters can be later overwritten from the OCDB
 
   fSolenoidBz = -5.00668;
-  fFullTime = 0;
-  fRecoTime = 0;
-  fNEvents = 0;
+  
 }
 
 int AliHLTITSTrackerComponent::ReadConfigurationString(  const char* arguments )
@@ -302,7 +296,9 @@ int AliHLTITSTrackerComponent::DoInit( int argc, const char** argv )
   fSolenoidBz=GetBz();
 
   fTracker = new AliITStrackerHLT(0);
-
+  fBenchmark.Reset();
+  fBenchmark.SetTimer(0,"total");
+  fBenchmark.SetTimer(1,"reco");
   return ret;
 }
 
@@ -347,8 +343,8 @@ int AliHLTITSTrackerComponent::DoEvent
     return 0;
   }
 
-
-  TStopwatch timer;
+  fBenchmark.StartNewEvent();
+  fBenchmark.Start(0);
 
   // Event reconstruction in ITS
 
@@ -385,6 +381,7 @@ int AliHLTITSTrackerComponent::DoEvent
     // Read TPC tracks
     
     if( iter->fDataType == ( kAliHLTDataTypeTrack|kAliHLTDataOriginTPC ) ){      
+      fBenchmark.AddInput(iter->fSize);
       AliHLTTracksData* dataPtr = ( AliHLTTracksData* ) iter->fPtr;
       int nTracks = dataPtr->fCount;
       AliHLTExternalTrackParam* currOutTrack = dataPtr->fTracklets;
@@ -404,6 +401,8 @@ int AliHLTITSTrackerComponent::DoEvent
         (iter->fDataType == (kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD) ) ||
         (iter->fDataType == (kAliHLTDataTypeClusters|kAliHLTDataOriginITSSDD) ) 
         ){
+      
+      fBenchmark.AddInput(iter->fSize);
 
       AliHLTITSClusterData *inPtr=reinterpret_cast<AliHLTITSClusterData*>( iter->fPtr );
       int nClusters = inPtr->fSpacePointCnt;
@@ -422,11 +421,10 @@ int AliHLTITSTrackerComponent::DoEvent
   
   // Reconstruct the event
 
-  TStopwatch timerReco;
-  
-  fTracker->Reconstruct( &(tracksTPC[0]), tracksTPC.size() );
-  
-  timerReco.Stop();
+    fBenchmark.Start(1);
+    fTracker->Reconstruct( &(tracksTPC[0]), tracksTPC.size() );
+    fBenchmark.Stop(1);
+
   
   // Fill output tracks
   int nITSUpdated = 0;
@@ -502,21 +500,18 @@ int AliHLTITSTrackerComponent::DoEvent
       } else {
        resultData.fDataType = kAliHLTDataTypeTrack|kAliHLTDataOriginITSOut;
       }
+      fBenchmark.AddOutput(resultData.fSize);
       outputBlocks.push_back( resultData );
       size += resultData.fSize;       
     }  
   }
   
-  timer.Stop();
-  fFullTime += timer.RealTime();
-  fRecoTime += timerReco.RealTime();
-  fNEvents++;
+   fBenchmark.Stop(0);
 
   // Set log level to "Warning" for on-line system monitoring
-  int hz = ( int ) ( fFullTime > 1.e-10 ? fNEvents / fFullTime : 100000 );
-  int hz1 = ( int ) ( fRecoTime > 1.e-10 ? fNEvents / fRecoTime : 100000 );
-  HLTInfo( "ITS Tracker: output %d tracks;  input %d clusters, %d tracks; time: full %d / reco %d Hz",
-             nITSUpdated, nClustersTotal, tracksTPC.size(), hz, hz1 );
+  HLTInfo( "ITS Tracker: output %d tracks;  input %d clusters, %d tracks",
+          nITSUpdated, nClustersTotal, tracksTPC.size() );
 
+  HLTInfo(fBenchmark.GetStatistics());
   return iResult;
 }
index 3c003dfb1c877dae6aeb024471deed8bb33664ef..9f8c2865a2f920ce2d231e4e31268960861efac0 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "AliHLTProcessor.h"
 #include "AliHLTDataTypes.h"
+#include "AliHLTComponentBenchmark.h"
 class AliITStrackerHLT;
 
 
@@ -136,9 +137,7 @@ class AliHLTITSTrackerComponent : public AliHLTProcessor
 
     /** magnetic field */
     double fSolenoidBz;                                            // see above
-    double fFullTime; //* total time for DoEvent() [s]
-    double fRecoTime; //* total reconstruction time [s]
-    Long_t    fNEvents;  //* number of reconstructed events
+    AliHLTComponentBenchmark fBenchmark;// benchmark
     AliITStrackerHLT *fTracker; // the tracker itself
 
     /** set configuration parameters **/
index de8e277ec884db8b8710182f270df0441d081fb6..da01c997dbcf208d7e55bd27729c9ed402202e82 100644 (file)
@@ -81,7 +81,8 @@ AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
   fFirstTimeBin(-1),
   fLastTimeBin(-1),
   fDoMC(kFALSE),
-  fReleaseMemory( kFALSE )
+  fReleaseMemory( kFALSE ),
+  fBenchmark("TPCClusterFinder")
 {
   // see header file for class documentation
   // or
@@ -322,6 +323,9 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
   if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){
     fClusterFinder->SetLastTimeBin(fLastTimeBin);
   }
+  fBenchmark.Reset();
+  fBenchmark.SetTimer(0,"total");
+  fBenchmark.SetTimer(1,"reco");
 
   return iResult;
 }
@@ -361,6 +365,9 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
     return 0;
   }
 
+  fBenchmark.StartNewEvent();
+  fBenchmark.Start(0);
+
   //  == init iter (pointer to datablock)
   const AliHLTComponentBlockData* iter = NULL;
   unsigned long ndx;
@@ -420,6 +427,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
 
       }
 
+      fBenchmark.AddInput(iter->fSize);
+
       slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
       patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
 
@@ -435,6 +444,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       fClusterFinder->InitSlice( slice, patch, maxPoints );
       fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
        
+      fBenchmark.Start(1);
+
       if(fUnsorted){
        if(fGetActivePads){
          fClusterFinder->SetDoPadSelection(kTRUE);
@@ -452,6 +463,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        fClusterFinder->Read(iter->fPtr, iter->fSize );
        fClusterFinder->ProcessDigits();
       }
+      fBenchmark.Stop(1);
+
       fReader->Reset();
 
       realPoints = fClusterFinder->GetNumberOfClusters();
@@ -470,7 +483,9 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       bd.fSpecification = iter->fSpecification;
       bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
       outputBlocks.push_back( bd );
-       
+
+      fBenchmark.AddOutput(bd.fSize);
+
       tSize += mysize;
       outBPtr += mysize;
       outPtr = (AliHLTTPCClusterData*)outBPtr;
@@ -498,6 +513,7 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        bdHW.fDataType = kAliHLTDataTypeHwAddr16;
        outputBlocks.push_back( bdHW );
        
+       fBenchmark.AddOutput(bdHW.fSize);
        tSize+=nHWAdd*sizeof(AliHLTUInt16_t);
       }
 
@@ -546,7 +562,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        bdMCInfo.fSpecification = iter->fSpecification;
        bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
        outputBlocks.push_back( bdMCInfo );
-       
+       fBenchmark.AddOutput(bdMCInfo.fSize);
+
        tSize+=nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
 
       }
@@ -555,6 +572,8 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
   if (iResult>=0)
     size = tSize;
 
+  fBenchmark.Stop(0);  
+  HLTInfo(fBenchmark.GetStatistics());
   return iResult;
 }
 
index 014fe1bdcc668e49ac493573a229274d779b2e8a..3b3d64a5d141b5a5078388269421c060ef48a6f7 100644 (file)
@@ -14,6 +14,7 @@
 */
 
 #include "AliHLTProcessor.h"
+#include "AliHLTComponentBenchmark.h"
 
 class AliHLTTPCClusterFinder;
 class AliHLTTPCDigitReader;
@@ -224,6 +225,8 @@ class AliHLTTPCClusterFinderComponent : public AliHLTProcessor
 
        Bool_t fDoMC; // flag to provide MC labels
        Bool_t fReleaseMemory; // flag to release the memory after each event
+       AliHLTComponentBenchmark fBenchmark; // benchmark
+
        /// the default configuration entry for this component
        static const char* fgkOCDBEntryPacked; //!transient
        static const char* fgkOCDBEntryUnpacked; //!transient
index c71686c3a157e4c678c3a7925b49264a05c05df2..381a36e7e67307dc0ea2df3dc9f6fa3fc56093f8 100644 (file)
@@ -59,7 +59,7 @@ ClassImp( AliHLTTPCCAGlobalMergerComponent )
 
 
 AliHLTTPCCAGlobalMergerComponent::AliHLTTPCCAGlobalMergerComponent()
-  : fGlobalMerger( 0 ), fSolenoidBz( 0 ), fClusterErrorCorrectionY(0), fClusterErrorCorrectionZ(0)
+: fGlobalMerger( 0 ), fSolenoidBz( 0 ), fClusterErrorCorrectionY(0), fClusterErrorCorrectionZ(0), fBenchmark("GlobalMerger")
 {
   // see header file for class documentation
 }
@@ -114,6 +114,9 @@ void AliHLTTPCCAGlobalMergerComponent::SetDefaultConfiguration()
   fSolenoidBz = -5.00668;
   fClusterErrorCorrectionY = 0;
   fClusterErrorCorrectionZ = 1.1;
+  fBenchmark.Reset();
+  fBenchmark.SetTimer(0,"total");
+  fBenchmark.SetTimer(1,"reco");    
 }
 
 int AliHLTTPCCAGlobalMergerComponent::ReadConfigurationString(  const char* arguments )
@@ -334,6 +337,8 @@ int AliHLTTPCCAGlobalMergerComponent::DoEvent( const AliHLTComponentEventData &e
   if ( !IsDataEvent() ) {
     return 0;
   }
+  fBenchmark.StartNewEvent();
+  fBenchmark.Start(0);
 
   fGlobalMerger->Clear();
 
@@ -343,6 +348,8 @@ int AliHLTTPCCAGlobalMergerComponent::DoEvent( const AliHLTComponentEventData &e
       continue;
     }
 
+    fBenchmark.AddInput(block->fSize);
+
     int slice = AliHLTTPCDefinitions::GetMinSliceNr( *block );
     if ( slice < 0 || slice >= AliHLTTPCTransform::GetNSlice() ) {
       HLTError( "invalid slice number %d extracted from specification 0x%08lx,  skipping block of type %s",
@@ -368,7 +375,9 @@ int AliHLTTPCCAGlobalMergerComponent::DoEvent( const AliHLTComponentEventData &e
        fwrite(sliceOut, 1, sliceOut->EstimateSize(sliceOut->NTracks(), sliceOut->NTrackClusters()), fp);
        fclose(fp);*/
   }
+  fBenchmark.Start(1);
   fGlobalMerger->Reconstruct();
+  fBenchmark.Stop(1);
 
   const AliHLTTPCCAMergerOutput *mergerOutput = fGlobalMerger->Output();
 
@@ -442,6 +451,8 @@ int AliHLTTPCCAGlobalMergerComponent::DoEvent( const AliHLTComponentEventData &e
     resultData.fDataType = kAliHLTDataTypeTrack|kAliHLTDataOriginTPC;
     resultData.fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( 0, 35, 0, 5 );
     outputBlocks.push_back( resultData );
+    fBenchmark.AddOutput(resultData.fSize);
+
     size = resultData.fSize;
   }
 
@@ -542,6 +553,8 @@ int AliHLTTPCCAGlobalMergerComponent::DoEvent( const AliHLTComponentEventData &e
 
   HLTInfo( "CAGlobalMerger:: output %d tracks", mergerOutput->NTracks() );
   */
+  fBenchmark.Stop(0);
+  HLTInfo( fBenchmark.GetStatistics() );
   return iResult;
 }
 
index e591ca15e3e2c3ee1d29d3a42bcc08935e877726..7e0f2ad4ac39481534f4c77284eaa86c406cde6b 100644 (file)
@@ -16,6 +16,7 @@
 */
 
 #include "AliHLTProcessor.h"
+#include "AliHLTComponentBenchmark.h"
 
 class AliHLTTPCCAMerger;
 class AliHLTTPCVertex;
@@ -115,6 +116,7 @@ class AliHLTTPCCAGlobalMergerComponent : public AliHLTProcessor
     double fSolenoidBz;  // magnetic field
     double fClusterErrorCorrectionY; // correction for the cluster error during pre-fit
     double fClusterErrorCorrectionZ; // correction for the cluster error during pre-fit
+    AliHLTComponentBenchmark fBenchmark;// benchmark
 
     ClassDef( AliHLTTPCCAGlobalMergerComponent, 0 )
 };
index 8b7f9e810b82308edf2b4df2860413670f797d86..0a23283f34b9293dcbdd34489e75ee93dc3fb984 100644 (file)
@@ -34,7 +34,6 @@ using namespace std;
 #include "AliHLTTPCSpacePointData.h"
 #include "AliHLTTPCDefinitions.h"
 #include "AliHLTTPCCADef.h"
-#include "TStopwatch.h"
 
 
 const AliHLTComponentDataType AliHLTTPCCADefinitions::fgkCompressedInputDataType = AliHLTComponentDataTypeInitializer( "CAINPACK", kAliHLTDataOriginTPC );
@@ -45,10 +44,7 @@ ClassImp( AliHLTTPCCAInputDataCompressorComponent )
 AliHLTTPCCAInputDataCompressorComponent::AliHLTTPCCAInputDataCompressorComponent()
   :
   AliHLTProcessor(),
-  fTotalTime( 0 ),
-  fTotalInputSize( 0 ),
-  fTotalOutputSize( 0 ),
-  fNEvents( 0 )
+  fBenchmark("CAInputCompressor")
 {
   // see header file for class documentation
   // or
@@ -60,10 +56,7 @@ AliHLTTPCCAInputDataCompressorComponent::AliHLTTPCCAInputDataCompressorComponent
 AliHLTTPCCAInputDataCompressorComponent::AliHLTTPCCAInputDataCompressorComponent( const AliHLTTPCCAInputDataCompressorComponent& )
   :
   AliHLTProcessor(),
-  fTotalTime( 0 ),
-  fTotalInputSize( 0 ),
-  fTotalOutputSize( 0 ),
-  fNEvents( 0 )
+  fBenchmark("CAInputCompressor")
 {
   // see header file for class documentation
   HLTFatal( "copy constructor untested" );
@@ -124,10 +117,9 @@ AliHLTComponent* AliHLTTPCCAInputDataCompressorComponent::Spawn()
 int AliHLTTPCCAInputDataCompressorComponent::DoInit( int /*argc*/, const char** /*argv*/ )
 {
   // Configure the CA tracker component
-  fTotalTime = 0;
-  fTotalInputSize = 0;
-  fTotalOutputSize = 0; 
-  fNEvents = 0;
+  fBenchmark.Reset();
+  fBenchmark.SetTimer(0,"total");
+  fBenchmark.SetTimer(1,"reco");
   return 0;
 }
 
@@ -166,7 +158,8 @@ int AliHLTTPCCAInputDataCompressorComponent::DoEvent
     return 0;
   }
 
-  TStopwatch timer;
+  fBenchmark.StartNewEvent();
+  fBenchmark.Start(0);
 
   // Preprocess the data for CA Slice Tracker
 
@@ -177,7 +170,6 @@ int AliHLTTPCCAInputDataCompressorComponent::DoEvent
 
   Int_t ret = 0;
 
-  Int_t inTotalSize = 0;    
   Int_t outTotalSize = 0;
   Int_t minSlice = 100;
   Int_t maxSlice = -1;
@@ -186,17 +178,21 @@ int AliHLTTPCCAInputDataCompressorComponent::DoEvent
     const AliHLTComponentBlockData* iter = blocks + ndx;
     if ( iter->fDataType != AliHLTTPCDefinitions::fgkClustersDataType ) continue;    
 
+    fBenchmark.AddInput(iter->fSize);
+
     if( minSlice>AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ) minSlice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ) ;
     if( maxSlice<AliHLTTPCDefinitions::GetMaxSliceNr( *iter ) ) maxSlice = AliHLTTPCDefinitions::GetMaxSliceNr( *iter ) ;
       
-    inTotalSize += iter->fSize;
 
     AliHLTUInt32_t dSize = 0;
-   
+
+    fBenchmark.Start(1);
+  
     ret = Compress( ( AliHLTTPCClusterData* )( iter->fPtr ), maxBufferSize - outTotalSize,
                    outputPtr+outTotalSize,
                    dSize );
-    
+    fBenchmark.Stop(1);
+
     if ( ret!=0 ){
       HLTWarning( "Output buffer size exceed (buffer size %d, current size %d)", maxBufferSize );     
       break;
@@ -210,26 +206,21 @@ int AliHLTTPCCAInputDataCompressorComponent::DoEvent
     bd.fDataType = GetOutputDataType();
     outputBlocks.push_back( bd );
     outTotalSize+=dSize;      
+    fBenchmark.AddOutput(bd.fSize);
   }
 
   size = outTotalSize;
   
-  timer.Stop();
+  fBenchmark.Stop(0);
   
-  fTotalTime += timer.RealTime();
-  fTotalInputSize+= inTotalSize;
-  fTotalOutputSize+= outTotalSize;
-  fNEvents++;
-
   if( maxSlice<0 ) minSlice = -1;
-  Int_t hz = ( int ) ( fTotalTime > 1.e-10 ? fNEvents / fTotalTime : 100000 );
-  Float_t ratio = 0;
-  if( fTotalOutputSize>0 ) ratio = (Float_t ) (fTotalInputSize/fTotalOutputSize);
 
-  // Set log level to "Warning" for on-line system monitoring
-  
-  HLTInfo( "CAInputDataCompressor, slices %d-%d: speed %d Hz, ratio %f, %d events", minSlice, maxSlice, hz, ratio, fNEvents );
+  // Set log level to "Warning" for on-line system monitorin  
 
+  if( minSlice!=maxSlice ) fBenchmark.SetName(Form("CAInputDataCompressor, slices %d-%d", minSlice, maxSlice));
+  else fBenchmark.SetName(Form("CAInputDataCompressor, slice %d", minSlice));
+  HLTInfo( fBenchmark.GetStatistics());
   return ret;
 }
 
index 495ed712454157b7ea121afdc2a0b7fe3a01d421..fb2b11752b874f453d83f691fe266c570c093e33 100644 (file)
@@ -10,6 +10,8 @@
 #define ALIHLTTPCCAINPUTDATACOMPRESSORCOMPONENT_H
 
 #include "AliHLTProcessor.h"
+#include "AliHLTComponentBenchmark.h"
+
 class AliHLTTPCClusterData;
 
 /**
@@ -82,10 +84,7 @@ class AliHLTTPCCAInputDataCompressorComponent : public AliHLTProcessor
 
   private:
 
-    double fTotalTime; //* total time for DoEvent() [s]
-    double fTotalInputSize; //* total input size in [bytes]
-    double fTotalOutputSize; //* total output size in [bytes]
-    Long_t fNEvents;  //* number of reconstructed events
+  AliHLTComponentBenchmark fBenchmark; // benchmarks
 
     ClassDef( AliHLTTPCCAInputDataCompressorComponent, 0 );
 };
index 2495519c9f867504cd99e69ce8eda7a6293619dc..63e7737d9cdba1c9a336f54120be0428170854d8 100644 (file)
@@ -44,7 +44,6 @@ using namespace std;
 #include "AliHLTTPCTrackletDataFormat.h"
 #include "AliHLTTPCDefinitions.h"
 #include "AliExternalTrackParam.h"
-#include "TStopwatch.h"
 #include "TMath.h"
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
@@ -67,9 +66,7 @@ AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent()
     fNeighboursSearchArea( 0 ), 
     fClusterErrorCorrectionY(0), 
     fClusterErrorCorrectionZ(0),
-    fFullTime( 0 ),
-    fRecoTime( 0 ),
-    fNEvents( 0 ),    
+    fBenchmark("CATracker"), 
     fAllowGPU( 0)
 {
   // see header file for class documentation
@@ -89,9 +86,7 @@ AliHLTTPCCATrackerComponent::AliHLTTPCCATrackerComponent( const AliHLTTPCCATrack
     fNeighboursSearchArea(0),
     fClusterErrorCorrectionY(0), 
     fClusterErrorCorrectionZ(0),
-    fFullTime( 0 ),
-    fRecoTime( 0 ),
-    fNEvents( 0 ),
+    fBenchmark("CATracker"),
     fAllowGPU( 0)
 {
   // see header file for class documentation
@@ -160,9 +155,9 @@ void AliHLTTPCCATrackerComponent::SetDefaultConfiguration()
   fNeighboursSearchArea = 0;
   fClusterErrorCorrectionY = 0;
   fClusterErrorCorrectionZ = 0;
-  fFullTime = 0;
-  fRecoTime = 0;
-  fNEvents = 0;
+  fBenchmark.Reset();
+  fBenchmark.SetTimer(0,"total");
+  fBenchmark.SetTimer(1,"reco");
 }
 
 int AliHLTTPCCATrackerComponent::ReadConfigurationString(  const char* arguments )
@@ -384,7 +379,8 @@ int AliHLTTPCCATrackerComponent::DoEvent
     return 0;
   }
 
-  TStopwatch timer;
+  fBenchmark.StartNewEvent();
+  fBenchmark.Start(0);
 
   // Event reconstruction in one TPC slice with CA Tracker
 
@@ -555,8 +551,10 @@ int AliHLTTPCCATrackerComponent::DoEvent
                if ( iter->fDataType == AliHLTTPCDefinitions::fgkClustersDataType ){
                  AliHLTTPCClusterData* inPtrSP = ( AliHLTTPCClusterData* )( iter->fPtr );
                  nClustersTotal += inPtrSP->fSpacePointCnt;
+                 fBenchmark.AddInput(iter->fSize);
                } else 
                if ( iter->fDataType == AliHLTTPCCADefinitions::fgkCompressedInputDataType){
+                 fBenchmark.AddInput(iter->fSize);
                  const AliHLTUInt8_t * inPtr =  (const AliHLTUInt8_t *)iter->fPtr;
                  while( inPtr< ((const AliHLTUInt8_t *) iter->fPtr) + iter->fSize ){
                    AliHLTTPCCACompressedClusterRow *row = (AliHLTTPCCACompressedClusterRow*)inPtr;
@@ -670,10 +668,11 @@ int AliHLTTPCCATrackerComponent::DoEvent
   memset(sliceOutput, 0, slicecount * sizeof(AliHLTTPCCASliceOutput*));
 
   // reconstruct the event
-  TStopwatch timerReco;
+
+  fBenchmark.Start(1);
   fTracker->SetOutputControl(&outputControl);
   fTracker->ProcessSlices(minslice, slicecount, clusterData, sliceOutput);
-  timerReco.Stop();
+  fBenchmark.Stop(1);
   
   int ret = 0;
   unsigned int mySize = 0;
@@ -727,28 +726,27 @@ int AliHLTTPCCATrackerComponent::DoEvent
            bd.fDataType = GetOutputDataType();
            outputBlocks.push_back( bd );
            size += mySize;
+           fBenchmark.AddOutput(bd.fSize);
          }
       }
   }
 
+
   //No longer needed
 
   delete[] clusterData;
   delete[] sliceOutput;
 
-  timer.Stop();
-
-  fFullTime += timer.RealTime();
-  fRecoTime += timerReco.RealTime();
-  fNEvents++;
+  fBenchmark.Stop(0);
 
   // Set log level to "Warning" for on-line system monitoring
-  int hz = ( int ) ( fFullTime > 1.e-10 ? fNEvents / fFullTime : 100000 );
-  int hz1 = ( int ) ( fRecoTime > 1.e-10 ? fNEvents / fRecoTime : 100000 );
+
   //Min and Max Patch are taken for first slice processed...
-  HLTInfo( "CATracker slices %d-%d: output %d tracks;  input %d clusters, patches %d..%d, rows %d..%d; time: full %d / reco %d Hz",
-           minslice, maxslice, ntracks, nClustersTotalSum, sliceminPatch[0], slicemaxPatch[0], slicerow[0], slicerow[1], hz, hz1 );
 
+  if( minslice==maxslice ) fBenchmark.SetName(Form("CATracker slice %d",minslice));
+  else fBenchmark.SetName(Form("CATracker slices %d-%d",minslice,maxslice));
+
+  HLTInfo(fBenchmark.GetStatistics());
   //No longer needed
 
   delete[] slicerow;
index 7142ce93c016df57bca6d2fa6120251650755546..06e79951ad58468ca6370a6e9cb2905bb4d32c2b 100644 (file)
@@ -11,6 +11,7 @@
 #define ALIHLTTPCCATRACKERCOMPONENT_H
 
 #include "AliHLTProcessor.h"
+#include "AliHLTComponentBenchmark.h"
 
 class AliHLTTPCCATrackerFramework;
 class AliHLTTPCCASliceOutput;
@@ -86,9 +87,7 @@ class AliHLTTPCCATrackerComponent : public AliHLTProcessor
     double fClusterErrorCorrectionY; // correction for the cluster errors
     double fClusterErrorCorrectionZ; // correction for the cluster errors
 
-    double fFullTime; //* total time for DoEvent() [s]
-    double fRecoTime; //* total reconstruction time [s]
-    Long_t    fNEvents;  //* number of reconstructed events
+    AliHLTComponentBenchmark fBenchmark; // benchmarks
     bool fAllowGPU;    //* Allow this tracker to run on GPU
 
     static bool CompareClusters( AliHLTTPCSpacePointData *a, AliHLTTPCSpacePointData *b );
index c859409e1e4bc85c1158859454509d48e6dc4e9b..db9591830c1dfe7dcfbf4c3fe9383fac15b4ad6f 100644 (file)
@@ -58,6 +58,7 @@ AliHLTGlobalEsdConverterComponent::AliHLTGlobalEsdConverterComponent()
   , fVerbosity(0)
   , fESD(NULL)
   , fSolenoidBz(-5.00668)
+  , fBenchmark("EsdConverter")
 {
   // see header file for class documentation
   // or
@@ -220,6 +221,8 @@ int AliHLTGlobalEsdConverterComponent::DoInit(int argc, const char** argv)
     SetupCTPData();
   }
 
+  fBenchmark.SetTimer(0,"total");
+
   return iResult;
 }
 
@@ -239,6 +242,9 @@ int AliHLTGlobalEsdConverterComponent::DoEvent(const AliHLTComponentEventData& /
   int iResult=0;
   if (!fESD) return -ENODEV;
 
+  if (IsDataEvent()) fBenchmark.StartNewEvent();
+  fBenchmark.Start(0);
+
   AliESDEvent* pESD = fESD;
 
   pESD->Reset(); 
@@ -278,12 +284,17 @@ int AliHLTGlobalEsdConverterComponent::DoEvent(const AliHLTComponentEventData& /
     } else {
       iResult=PushBack(pESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginOut, 0);
     }
+    fBenchmark.AddOutput(GetLastObjectSize());
   }
   if (pTree) {
     // clear user info list to prevent objects from being deleted
     pTree->GetUserInfo()->Clear();
     delete pTree;
   }
+
+  fBenchmark.Stop(0);
+  HLTInfo( fBenchmark.GetStatistics() );
+
   return iResult;
 }
 
@@ -299,12 +310,14 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
   // in the first attempt this component reads the TPC tracks and updates in the
   // second step from the ITS tracks
 
-
   // first read MC information (if present)
   std::map<int,int> mcLabels;
 
   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrackMC|kAliHLTDataOriginTPC);
        pBlock!=NULL; pBlock=GetNextInputBlock()) {
+
+    fBenchmark.AddInput(pBlock->fSize);
+
     AliHLTTrackMCData* dataPtr = reinterpret_cast<AliHLTTrackMCData*>( pBlock->fPtr );
     if (sizeof(AliHLTTrackMCData)+dataPtr->fCount*sizeof(AliHLTTrackMCLabel)==pBlock->fSize) {
       for( unsigned int il=0; il<dataPtr->fCount; il++ ){
@@ -324,6 +337,7 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
   Int_t ndEdxTPC = 0;
   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypedEdx|kAliHLTDataOriginTPC);
        pBlock!=NULL; pBlock=GetNextInputBlock()) {
+    fBenchmark.AddInput(pBlock->fSize);
     dEdxTPC = reinterpret_cast<AliHLTFloat32_t*>( pBlock->fPtr );
     ndEdxTPC = pBlock->fSize / sizeof(AliHLTFloat32_t);
     break;
@@ -332,6 +346,7 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
   // convert the TPC tracks to ESD tracks
   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC);
        pBlock!=NULL; pBlock=GetNextInputBlock()) {
+    fBenchmark.AddInput(pBlock->fSize);
     vector<AliHLTGlobalBarrelTrack> tracks;
     if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>=0) {
       for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin();
@@ -391,6 +406,9 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
 
 
   // Get ITS SPD vertex
+  for( const AliHLTComponentBlockData *i= GetFirstInputBlock(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS); i!=NULL; i=GetNextInputBlock() ){
+    fBenchmark.AddInput(i->fSize);
+  }
 
   for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDVertex|kAliHLTDataOriginITS); iter != NULL; iter = GetNextInputObject() ) {
     AliESDVertex *vtx = dynamic_cast<AliESDVertex*>(const_cast<TObject*>( iter ) );
@@ -400,6 +418,7 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
   // now update ESD tracks with the ITSOut info
   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginITSOut);
        pBlock!=NULL; pBlock=GetNextInputBlock()) {
+    fBenchmark.AddInput(pBlock->fSize);
     vector<AliHLTGlobalBarrelTrack> tracks;
     if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) {
       for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin();
@@ -417,6 +436,7 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
   // now update ESD tracks with the ITS info
   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginITS);
        pBlock!=NULL; pBlock=GetNextInputBlock()) {
+    fBenchmark.AddInput(pBlock->fSize);
     vector<AliHLTGlobalBarrelTrack> tracks;
     if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) {
       for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin();
@@ -435,7 +455,7 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
 
   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeGlobalVertexer);
        pBlock!=NULL; pBlock=GetNextInputBlock()) {
-    
+    fBenchmark.AddInput(pBlock->fSize);   
     AliHLTGlobalVertexerComponent::FillESD( pESD, reinterpret_cast<AliHLTGlobalVertexerComponent::AliHLTGlobalVertexerData* >(pBlock->fPtr) );
   }
 
@@ -443,6 +463,7 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
   // convert the HLT TRD tracks to ESD tracks                        
   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack | kAliHLTDataOriginTRD);
        pBlock!=NULL; pBlock=GetNextInputBlock()) {
+    fBenchmark.AddInput(pBlock->fSize);
     vector<AliHLTGlobalBarrelTrack> tracks;
     if ((iResult=AliHLTGlobalBarrelTrack::ConvertTrackDataArray(reinterpret_cast<const AliHLTTracksData*>(pBlock->fPtr), pBlock->fSize, tracks))>0) {
       for (vector<AliHLTGlobalBarrelTrack>::iterator element=tracks.begin();
@@ -472,6 +493,7 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
   }
   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny); pBlock!=NULL; pBlock=GetNextInputBlock()) 
     {
+      fBenchmark.AddInput(pBlock->fSize);
       AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr);
 
       HLTDebug("%d HLT clusters from spec: 0x%X", caloClusterHeaderPtr->fNClusters, pBlock->fSpecification);
@@ -488,6 +510,10 @@ int AliHLTGlobalEsdConverterComponent::ProcessBlocks(TTree* pTree, AliESDEvent*
     }
   
   // Add tracks from MUON.
+  for( const AliHLTComponentBlockData *i= GetFirstInputBlock(kAliHLTAnyDataType | kAliHLTDataOriginMUON); i!=NULL; i=GetNextInputBlock() ){
+    fBenchmark.AddInput(i->fSize);
+  }
+
   for (const TObject* obj = GetFirstInputObject(kAliHLTAnyDataType | kAliHLTDataOriginMUON);
        obj != NULL;
        obj = GetNextInputObject()
index 415cdae01bcfd7abc7ab1b69cd4c6fd4bce09a7d..45fed1a248294219516c880e18c9ad45bd8e615b 100644 (file)
@@ -13,6 +13,7 @@
 */
 
 #include "AliHLTProcessor.h"
+#include "AliHLTComponentBenchmark.h"
 #include <vector>
 
 // forward declarations
@@ -101,6 +102,7 @@ protected:
 
   /// solenoid b field
   Double_t fSolenoidBz; //! transient
+  AliHLTComponentBenchmark fBenchmark; // benchmark
 
   ClassDef(AliHLTGlobalEsdConverterComponent, 0)
 };
index 26027aa297dbbcc2ab63d9a3cb75406efa139cd1..9c28601c3c8a6233bc5fdaea722de69cfcfa45b1 100644 (file)
@@ -50,8 +50,7 @@ AliHLTGlobalVertexerComponent::AliHLTGlobalVertexerComponent()
 :
   fNTracks(0),
   fTrackInfos(0),
-  fPrimaryVtx(),  
-  fNEvents(0),
+  fPrimaryVtx(),   
   fFitTracksToVertex(1),
   fConstrainedTrackDeviation(4.),
   fV0DaughterPrimDeviation( 2.5 ),
@@ -59,15 +58,7 @@ AliHLTGlobalVertexerComponent::AliHLTGlobalVertexerComponent()
   fV0Chi(3.5),
   fV0DecayLengthInSigmas(3.),
   fV0TimeLimit(10.e-3), 
-  fStatTimeR( 0 ),
-  fStatTimeC( 0 ),
-  fStatTimeR1( 0 ),
-  fStatTimeC1( 0 ),
-  fStatTimeR2( 0 ),
-  fStatTimeC2( 0 ),
-  fStatTimeR3( 0 ),
-  fStatTimeC3( 0 ),
-  fStatNEvents(0)
+  fBenchmark("GlobalVertexer")
 {
   // see header file for class documentation
   // or
@@ -138,19 +129,13 @@ int AliHLTGlobalVertexerComponent::DoInit( int argc, const char** argv )
 {
   // init
 
-  fStatTimeR = 0;
-  fStatTimeC = 0;
-  fStatTimeR1 = 0;
-  fStatTimeC1 = 0;
-  fStatTimeR2 = 0;
-  fStatTimeC2 = 0;
-  fStatTimeR3 = 0;
-  fStatTimeC3 = 0;
-  fStatNEvents = 0;
+  fBenchmark.Reset();
+  fBenchmark.SetTimer(0,"total");
+  fBenchmark.SetTimer(1,"convert");
+  fBenchmark.SetTimer(2,"vprim");
+  fBenchmark.SetTimer(3,"v0");
   fV0TimeLimit = 10.e-3;
 
-  fNEvents =0;
-
   int iResult=0;
   TString configuration="";
   TString argument="";
@@ -180,7 +165,6 @@ int AliHLTGlobalVertexerComponent::DoDeinit()
   fV0PrimDeviation =3.5;
   fV0Chi = 3.5;
   fV0DecayLengthInSigmas = 3.;
-  fNEvents = 0;
   fV0TimeLimit = 10.e-3;
 
   return 0;
@@ -195,18 +179,25 @@ int AliHLTGlobalVertexerComponent::DoEvent( const AliHLTComponentEventData& /*ev
     return 0;
 
   int iResult = 0;
-
-  fNEvents++;
-  TStopwatch timer;
+  //cout<<"SG: GlobalVertexer:: DoEvent called"<<endl;
+  fBenchmark.StartNewEvent();
+  fBenchmark.Start(0);
+  
   vector< AliExternalTrackParam > tracks;
   vector< int > trackId;
   vector< pair<int,int> > v0s;
 
   AliESDEvent *event = 0; 
 
+  for( const AliHLTComponentBlockData *i= GetFirstInputBlock(kAliHLTDataTypeESDObject); i!=NULL; i=GetNextInputBlock() ){
+    fBenchmark.AddInput(i->fSize);
+  }
+
+
   for ( const TObject *iter = GetFirstInputObject(kAliHLTDataTypeESDObject); iter != NULL; iter = GetNextInputObject() ) {
     event = dynamic_cast<AliESDEvent*>(const_cast<TObject*>( iter ) );
     if( !event ) continue;
+    
     event->GetStdContent();
     Int_t nESDTracks=event->GetNumberOfTracks(); 
 
@@ -225,7 +216,9 @@ int AliHLTGlobalVertexerComponent::DoEvent( const AliHLTComponentEventData& /*ev
     
     for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginITS);
         pBlock!=NULL; pBlock=GetNextInputBlock()) {
-      
+
+      fBenchmark.AddInput(pBlock->fSize);
+
       AliHLTTracksData* dataPtr = reinterpret_cast<AliHLTTracksData*>( pBlock->fPtr );
       int nTracks = dataPtr->fCount;
 
@@ -243,7 +236,9 @@ int AliHLTGlobalVertexerComponent::DoEvent( const AliHLTComponentEventData& /*ev
   if( tracks.size()==0 ){
     for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC);
         pBlock!=NULL; pBlock=GetNextInputBlock()) {
-      
+
+      fBenchmark.AddInput(pBlock->fSize);
+
       AliHLTTracksData* dataPtr = reinterpret_cast<AliHLTTracksData*>( pBlock->fPtr );
       int nTracks = dataPtr->fCount;      
       AliHLTExternalTrackParam* currOutTrack = dataPtr->fTracklets;
@@ -262,10 +257,10 @@ int AliHLTGlobalVertexerComponent::DoEvent( const AliHLTComponentEventData& /*ev
           
   AliKFParticle::SetField( GetBz() );
 
+  fBenchmark.Start(1);
+
   {  //* Fill fTrackInfo array
 
-    TStopwatch timer1;
-    
     if( fTrackInfos ) delete[] fTrackInfos;
     fTrackInfos = 0;
     fNTracks=tracks.size(); 
@@ -275,22 +270,18 @@ int AliHLTGlobalVertexerComponent::DoEvent( const AliHLTComponentEventData& /*ev
       info.fOK = 1;
       info.fPrimUsedFlag = 0;
       info.fParticle = AliKFParticle( tracks[iTr], 211 );
+      for( int i=0; i<8; i++ ) if( !finite(info.fParticle.GetParameter(i)) ) info.fOK = 0;
+      for( int i=0; i<36; i++ ) if( !finite(info.fParticle.GetCovariance(i)) ) info.fOK = 0;
     }
-    timer1.Stop();
-    fStatTimeR1+=timer1.RealTime();
-    fStatTimeC1+=timer1.CpuTime();
   }
-  
-  TStopwatch timer2;
+
+  fBenchmark.Stop(1);
+  fBenchmark.Start(2);
   FindPrimaryVertex();
-  timer2.Stop();
-  fStatTimeR2+=timer2.RealTime();
-  fStatTimeC2+=timer2.CpuTime();
-  TStopwatch timer3;
+  fBenchmark.Stop(2);
+  fBenchmark.Start(3);
   FindV0s( v0s );
-  timer3.Stop();
-  fStatTimeR3+=timer3.RealTime();
-  fStatTimeC3+=timer3.CpuTime();
+  fBenchmark.Stop(3);
 
   int *buf = new int[sizeof(AliHLTGlobalVertexerData)/sizeof(int)+1 + fNTracks + 2*v0s.size()];
   AliHLTGlobalVertexerData *data = reinterpret_cast<AliHLTGlobalVertexerData*>(buf);
@@ -318,6 +309,7 @@ int AliHLTGlobalVertexerComponent::DoEvent( const AliHLTComponentEventData& /*ev
     unsigned int blockSize = sizeof(AliHLTGlobalVertexerData) + (data->fNPrimTracks + 2*data->fNV0s)*sizeof(int);
 
     iResult = PushBack( reinterpret_cast<void*>(data), blockSize, kAliHLTDataTypeGlobalVertexer|kAliHLTDataOriginOut );  
+    fBenchmark.AddOutput(blockSize);
   }  
   
   
@@ -326,6 +318,7 @@ int AliHLTGlobalVertexerComponent::DoEvent( const AliHLTComponentEventData& /*ev
     if( iResult==0 && data && data->fPrimNContributors >=3 ){
       AliESDVertex vESD( data->fPrimP, data->fPrimC, data->fPrimChi2, data->fPrimNContributors );
       iResult = PushBack( (TObject*) &vESD, kAliHLTDataTypeESDVertex|kAliHLTDataOriginOut,0 );
+      fBenchmark.AddOutput(GetLastObjectSize());
     }
   }
 
@@ -333,24 +326,13 @@ int AliHLTGlobalVertexerComponent::DoEvent( const AliHLTComponentEventData& /*ev
   if( iResult==0 && event && data ){  
     FillESD( event, data ); 
     iResult = PushBack( event, kAliHLTDataTypeESDObject|kAliHLTDataOriginOut, 0);
+    fBenchmark.AddOutput(GetLastObjectSize());
   }
 
   delete[] buf;
 
-  timer.Stop();
-  fStatTimeR+=timer.RealTime();
-  fStatTimeC+=timer.CpuTime();
-  fStatNEvents++;
-
-  /*  
-  //if( fStatNEv%100==0 )
-  cout<<"SG: "<<GetComponentID()<<": "<<fStatNEvents<<" events, real time: total= "
-      <<fStatTimeR/fStatNEvents*1.e3<<" / create= "<<fStatTimeR1/fStatNEvents*1.e3
-      <<" / vprim= "<<fStatTimeR2/fStatNEvents*1.e3<<" / v0= "<<fStatTimeR3/fStatNEvents*1.e3
-      <<", CPU: total= "<<fStatTimeC/fStatNEvents*1.e3<<" / create= "<<fStatTimeC1/fStatNEvents*1.e3
-<<" / vprim= "<<fStatTimeC2/fStatNEvents*1.e3<<" / v0= "<<fStatTimeC2/fStatNEvents*1.e3
-      <<" ms"<<endl;
-  */
+  fBenchmark.Stop(0);
+  HLTInfo(fBenchmark.GetStatistics());
   return iResult;
 }
 
@@ -490,6 +472,7 @@ void AliHLTGlobalVertexerComponent::FindPrimaryVertex()
     vIndex[nSelected] = i;
     nSelected++;  
   }
+  
   fPrimaryVtx.ConstructPrimaryVertex( vSelected, nSelected, vFlag, fConstrainedTrackDeviation );
 
   for( Int_t i = 0; i<nSelected; i++){ 
@@ -501,7 +484,6 @@ void AliHLTGlobalVertexerComponent::FindPrimaryVertex()
     info.fPrimDeviation = info.fParticle.GetDeviationFromVertex( fPrimaryVtx );   
   }
 
-  //cout<<"SG: prim vtx event"<<fStatNEvents<<": n selected="<<nSelected<<", ncont="<<fPrimaryVtx.GetNContributors()<<endl;
 
   if( fPrimaryVtx.GetNContributors()<3 ){
     for( Int_t i = 0; i<fNTracks; i++)
@@ -543,7 +525,7 @@ void AliHLTGlobalVertexerComponent::FindV0s( vector<pair<int,int> > v0s  )
 
       if( (++statN)%100 ==0 ){ 
        if( timer.RealTime()>= fV0TimeLimit ){  run = 0; break; }
-       timer.Start();
+       timer.Continue();
       }
 
       //* check if the particles fit
index 600c401e2dbb7487e833870018e970b2c64c0207..917a48b6663535b7bd17f2426d2967d4ab720fe8 100644 (file)
@@ -12,6 +12,8 @@
 #include "AliHLTProcessor.h"
 #include "AliKFParticle.h"
 #include "AliKFVertex.h"
+#include "AliHLTComponentBenchmark.h"
+
 class TH1F;
 class TH2F;
 class AliESDtrack;
@@ -111,9 +113,6 @@ private:
   int fNTracks; // n of input tracks
   AliESDTrackInfo *fTrackInfos; // information about esd tracks
   AliKFVertex fPrimaryVtx; // reconstructed KF primary vertex
-
-  Int_t fNEvents; // n of processed events
-
   Bool_t fFitTracksToVertex; // flag to store vertex constrained track parameters
   Double_t fConstrainedTrackDeviation; // deviation of a track from prim.vtx <=cut 
   Double_t fV0DaughterPrimDeviation; // v0: daughters deviation from prim vertex >= cut
@@ -123,15 +122,7 @@ private:
 
   Double_t fV0TimeLimit; // time limit in seconds for V0 finder (it has N^2 combinatorics, therefore it can [potentially] block the data flow on some very hot events ) default limit is 10 ms
 
-  Double_t fStatTimeR; // benchmark
-  Double_t fStatTimeC; // benchmark
-  Double_t fStatTimeR1; // benchmark
-  Double_t fStatTimeC1; // benchmark
-  Double_t fStatTimeR2; // benchmark
-  Double_t fStatTimeC2; // benchmark
-  Double_t fStatTimeR3; // benchmark
-  Double_t fStatTimeC3; // benchmark
-  Double_t fStatNEvents;// benchmark
+  AliHLTComponentBenchmark fBenchmark;// benchmark
 
   ClassDef(AliHLTGlobalVertexerComponent, 0);
 
index f455e302e1fcfb47a4a9f4012b0444af1f897e28..e29ef959c5c29c27a7665df8f7f667ee1fe66dc5 100644 (file)
@@ -22,7 +22,8 @@ CLASS_HDRS:=          AliHLTFilePublisher.h \
                AliHLTGlobalBarrelTrack.h \
                AliHLTAgentUtil.h \
                AliHLTESDCaloClusterMaker.h \
-               AliHLTCaloClusterReader.h  
+               AliHLTCaloClusterReader.h  \
+                AliHLTComponentBenchmark.h 
 
 #              AliHLTMCGeneratorComponent.h