]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
adding some optional debugging functionality for the EventDoneData
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 7 Dec 2009 08:48:54 +0000 (08:48 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 7 Dec 2009 08:48:54 +0000 (08:48 +0000)
HLT/BASE/AliHLTProcessor.cxx
HLT/BASE/AliHLTProcessor.h

index 619e0df8d9bd038aa11b9a0f748add27d1b1ca4e..c5952ed876ff34584cd43b65301476ab37cc9c48 100644 (file)
@@ -28,11 +28,15 @@ using namespace std;
 
 #include "AliHLTProcessor.h"
 #include <string.h>
+#include "TDatime.h"
+#include "TString.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTProcessor)
 
 AliHLTProcessor::AliHLTProcessor()
+  : AliHLTComponent()
+  , fpDebugCounters(NULL)
 { 
   // see header file for class documentation
   // or
@@ -44,6 +48,8 @@ AliHLTProcessor::AliHLTProcessor()
 AliHLTProcessor::~AliHLTProcessor()
 { 
   // see header file for class documentation
+  if (fpDebugCounters) delete fpDebugCounters;
+  fpDebugCounters=NULL;
 }
 
 int AliHLTProcessor::DoProcessing( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
@@ -71,6 +77,55 @@ int AliHLTProcessor::DoProcessing( const AliHLTComponentEventData& evtData, cons
     edd->fDataSize = eddTmp->fDataSize;
     edd->fData = reinterpret_cast<AliHLTUInt8_t*>(edd)+edd->fStructSize;
     memcpy( edd->fData, eddTmp->fData, eddTmp->fDataSize );
+
+    // 2009-12-07 want to make this switchable, but this first needs some
+    // extension in the online framework to change the log level settings
+    // in the component while running
+    if (false/*CheckFilter(kHLTLogDebug)*/) {
+      if (!fpDebugCounters) {
+       fpDebugCounters=new AliHLTProcessorCounters;
+      }
+      if (fpDebugCounters) {
+       int wordCnt=edd->fDataSize/4;
+       AliHLTUInt32_t* buffer=reinterpret_cast<AliHLTUInt32_t*>(edd->fData);
+       int word=0;
+       while (word<wordCnt) {
+         switch (buffer[word]) {
+         case 3: 
+           fpDebugCounters->fReadoutFilter++; 
+           word+=1+buffer[word+1]*4;
+           break;
+         case 4:
+           fpDebugCounters->fMonitoringFilter++; 
+           word+=1+buffer[word+1]*4;
+           break;
+         case 5:
+           fpDebugCounters->fMonitoringEvent++; 
+           break;
+         default:
+           fpDebugCounters->fMismatch++;
+           break;
+         }
+         word++;
+       }
+
+       static UInt_t lastTime=0;
+       TDatime time;
+       if (time.Get()-lastTime>1) {
+         lastTime=time.Get();
+         HLTImportant("EventDoneData size %d: readout %d, monitoring filter %d, monitoring event %d, format error %d", 
+                      edd->fDataSize, fpDebugCounters->fReadoutFilter, fpDebugCounters->fMonitoringFilter, fpDebugCounters->fMonitoringEvent, fpDebugCounters->fMismatch);
+         for (int i=0; i< wordCnt; ) {
+           TString message;
+           for (int j=0; j<4 && i<wordCnt; j++) {
+             TString number; number.Form("0x%08x ", buffer[i++]);
+             message+=number;
+           }
+           HLTImportant("   %s", message.Data());
+         }
+       }
+      }
+    }
   }
   return iResult;
 }
index ec38516fb2910193353cb274a27970e780828608..3b6b23c9e7c3254c081668f642abe1f08ddb9ebc 100644 (file)
@@ -97,6 +97,23 @@ class AliHLTProcessor : public AliHLTComponent {
    */
   virtual int DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData);
 
-  ClassDef(AliHLTProcessor, 1)
+  // collection of debug counters
+  struct AliHLTProcessorCounters {
+    AliHLTProcessorCounters() : fReadoutFilter(0), fMonitoringFilter(0), fMonitoringEvent(0), fMismatch(0) {}
+    int fReadoutFilter;    // counter for the EDD readout filter
+    int fMonitoringFilter; // counter for the EDD monitoring filter
+    int fMonitoringEvent;  // counter for the EDD monitoring event
+    int fMismatch;         // counter for EDD format mismatch
+  };
+
+private:
+  /// copy contructor prohibited
+  AliHLTProcessor(const AliHLTProcessor&);
+  /// assignment operator prohibited
+  AliHLTProcessor& operator=(const AliHLTProcessor&);
+
+  AliHLTProcessorCounters* fpDebugCounters; // optional debugging counters
+
+  ClassDef(AliHLTProcessor, 2)
 };
 #endif