- extended CompStatCollector to fill branches with input/output ration etc.
- rec-hlt-tpc.C: added optional CompStatCollector
- added helper macro to post-format compstat raw data block
- added macro for HLT chain benchmark using DataGenerator
fpCTimeArray(NULL),
fpInputBlockCountArray(NULL),
fpTotalInputSizeArray(NULL),
+ fpNormalizedInputSizeArray(NULL),
fpOutputBlockCountArray(NULL),
fpTotalOutputSizeArray(NULL)
+ , fpInputOutputRatioArray(NULL)
+ , fpNormalizedInputOutputRatioArray(NULL)
, fpComponentCycleTimeArray(NULL)
, fpEventTypeArray(NULL)
, fpEventCountArray(NULL)
HLTError("expecting number as parameter for option %s", argument.Data());
iResult=-EINVAL;
}
+
+ // -arraysize
+ } else if (argument.CompareTo("-arraysize")==0) {
+ if ((bMissingParam=(++i>=argc))) break;
+ TString param=argv[i];
+ if (param.IsDigit()) {
+ fArraySize=param.Atoi();
+ } else {
+ HLTError("expecting number as parameter for option %s", argument.Data());
+ iResult=-EINVAL;
+ }
+
} else {
HLTError("unknown argument %s", argument.Data());
iResult=-EINVAL;
fpCTimeArray=new UInt_t[fArraySize];
fpInputBlockCountArray=new UInt_t[fArraySize];
fpTotalInputSizeArray=new UInt_t[fArraySize];
+ fpNormalizedInputSizeArray=new UInt_t[fArraySize];
fpOutputBlockCountArray=new UInt_t[fArraySize];
fpTotalOutputSizeArray=new UInt_t[fArraySize];
+ fpInputOutputRatioArray=new UInt_t[fArraySize];
+ fpNormalizedInputOutputRatioArray=new UInt_t[fArraySize];
fpComponentCycleTimeArray=new UInt_t[fArraySize];
fpEventTypeArray=new UInt_t[fArraySize];
fpEventCountArray=new UInt_t[fArraySize];
fpStatTree->Branch("CTime", fpCTimeArray, "CTime[nofSets]/i");
fpStatTree->Branch("InputBlockCount", fpInputBlockCountArray, "InputBlockCount[nofSets]/i");
fpStatTree->Branch("TotalInputSize", fpTotalInputSizeArray, "TotalInputSize[nofSets]/i");
+ fpStatTree->Branch("NormalizedInputSize", fpNormalizedInputSizeArray, "NormalizedInputSize[nofSets]/i");
fpStatTree->Branch("OutputBlockCount", fpOutputBlockCountArray, "OutputBlockCount[nofSets]/i");
fpStatTree->Branch("TotalOutputSize", fpTotalOutputSizeArray, "TotalOutputSize[nofSets]/i");
+ fpStatTree->Branch("InputOutputRatio", fpInputOutputRatioArray, "InputOutputRatio[nofSets]/i");
+ fpStatTree->Branch("NormalizedInputOutputRatio", fpNormalizedInputOutputRatioArray, "NormalizedInputOutputRatio[nofSets]/i");
fpStatTree->Branch("ComponentCycleTime",fpComponentCycleTimeArray, "ComponentCycleTime[nofSets]/i");
fpStatTree->Branch("EventType",fpEventTypeArray, "EventType[nofSets]/i");
fpStatTree->Branch("EventCount",fpEventCountArray, "EventCount[nofSets]/i");
memset(fpCTimeArray, 0, sizeof(UInt_t)*fArraySize);
memset(fpInputBlockCountArray, 0, sizeof(UInt_t)*fArraySize);
memset(fpTotalInputSizeArray, 0, sizeof(UInt_t)*fArraySize);
+ memset(fpNormalizedInputSizeArray, 0, sizeof(UInt_t)*fArraySize);
memset(fpOutputBlockCountArray, 0, sizeof(UInt_t)*fArraySize);
memset(fpTotalOutputSizeArray, 0, sizeof(UInt_t)*fArraySize);
+ memset(fpInputOutputRatioArray, 0, sizeof(UInt_t)*fArraySize);
+ memset(fpNormalizedInputOutputRatioArray, 0, sizeof(UInt_t)*fArraySize);
memset(fpComponentCycleTimeArray, 0, sizeof(UInt_t)*fArraySize);
memset(fpEventTypeArray, 0, sizeof(UInt_t)*fArraySize);
memset(fpEventCountArray, 0, sizeof(UInt_t)*fArraySize);
fpCTimeArray[i]=pStat[*element].fCTime;
fpInputBlockCountArray[i]=pStat[*element].fInputBlockCount;
fpTotalInputSizeArray[i]=pStat[*element].fTotalInputSize;
+ fpNormalizedInputSizeArray[i]=pStat[*element].fTotalInputSize;
+ if (pStat[*element].fInputBlockCount>0)
+ fpNormalizedInputSizeArray[i]/=pStat[*element].fInputBlockCount;
fpOutputBlockCountArray[i]=pStat[*element].fOutputBlockCount;
fpTotalOutputSizeArray[i]=pStat[*element].fTotalOutputSize;
+ if (pStat[*element].fTotalOutputSize>0)
+ fpInputOutputRatioArray[i]=pStat[*element].fTotalInputSize/pStat[*element].fTotalOutputSize;
+ if (pStat[*element].fInputBlockCount>0)
+ fpNormalizedInputOutputRatioArray[i]=fpInputOutputRatioArray[i]*pStat[*element].fOutputBlockCount/pStat[*element].fInputBlockCount;
fpComponentCycleTimeArray[i]=pStat[*element].fComponentCycleTime;
fpEventTypeArray[i]=eventType;
fpEventCountArray[i]=GetEventCount();
if (fpCTimeArray) delete fpCTimeArray; fpCTimeArray=NULL;
if (fpInputBlockCountArray) delete fpInputBlockCountArray; fpInputBlockCountArray=NULL;
if (fpTotalInputSizeArray) delete fpTotalInputSizeArray; fpTotalInputSizeArray=NULL;
+ if (fpNormalizedInputSizeArray) delete fpNormalizedInputSizeArray; fpNormalizedInputSizeArray=NULL;
if (fpOutputBlockCountArray) delete fpOutputBlockCountArray; fpOutputBlockCountArray=NULL;
if (fpTotalOutputSizeArray) delete fpTotalOutputSizeArray; fpTotalOutputSizeArray=NULL;
+ if (fpInputOutputRatioArray) delete fpInputOutputRatioArray; fpInputOutputRatioArray=NULL;
+ if (fpNormalizedInputOutputRatioArray) delete fpNormalizedInputOutputRatioArray; fpNormalizedInputOutputRatioArray=NULL;
if (fpComponentCycleTimeArray) delete fpComponentCycleTimeArray; fpComponentCycleTimeArray=NULL;
if (fpEventTypeArray) delete fpEventTypeArray; fpEventTypeArray=NULL;
if (fpEventCountArray) delete fpEventCountArray; fpEventCountArray=NULL;
/** branch filling variable */
UInt_t* fpTotalInputSizeArray; //!transient
/** branch filling variable */
+ UInt_t* fpNormalizedInputSizeArray; //!transient
+ /** branch filling variable */
UInt_t* fpOutputBlockCountArray; //!transient
/** branch filling variable */
UInt_t* fpTotalOutputSizeArray; //!transient
/** branch filling variable */
+ UInt_t* fpInputOutputRatioArray; //!transient
+ /** branch filling variable */
+ UInt_t* fpNormalizedInputOutputRatioArray; //!transient
+ /** branch filling variable */
UInt_t* fpComponentCycleTimeArray; //!transient
/** branch filling variable */
UInt_t* fpEventTypeArray; //!transient
fpDice=new TRandom;
if (fpDice) {
TDatime dt;
- // just take the pointer value as seed combined with time
- unsigned int seed=0;//(int)(this);
+ // take a component specific property together with the time to
+ // create a seed
+ const char* chainId=GetChainId();
+ unsigned int seed=CalculateChecksum((const AliHLTUInt8_t*)chainId, strlen(chainId));
fpDice->SetSeed(seed^dt.Get());
} else {
iResult=-ENOMEM;
for (int i=0; i<pTokens->GetEntries(); i++) {
argument=((TObjString*)pTokens->At(i))->GetString();
if (argument.IsNull()) continue;
-
+
+ if (argument.Contains("-statistics=")) {
+ argument.ReplaceAll("-statistics=", "");
+ if (argument.Contains("root")) {
+ if (option.Length()>0) option+=",";
+ option+="statroot";
+ }
+ if (argument.Contains("raw")) {
+ if (option.Length()>0) option+=",";
+ option+="statraw";
+ }
+ continue;
+ }
if (argument.CompareTo("decoder",TString::kIgnoreCase)==0) {
bUseClusterFinderDecoder = kTRUE;
continue;
}
}
}
+ if (!histout && !dumpout && !esdout && !chout && !cdout) {
+ cout << "you need to specify an output option, on or more out of: ESD, TrackHistogram, TrackDump, ClusterHisto, ClusterDump" << endl;
+ return;
+ }
+ if ((option.Contains("statroot") || option.Contains("statraw")) && !esdout) {
+ cout << "!!!!!!!! Warning: HLT statistics are only collected for output type ESD !!!!!!!!" << endl;
+ }
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// the root file writer configuration
AliHLTConfiguration sink("sink1", "EsdCollector" , "esd-converter", "-directory hlt-tpc-esd");
+
+ // optional component statistics
+ AliHLTConfiguration statroot("statroot", "StatisticsCollector" , "esd-converter", "-file HLT.statistics.root -publish 0");
+ AliHLTConfiguration statraw("statraw", "FileWriter" , "esd-converter", "-datatype COMPSTAT PRIV -datafile HLT.statistics.raw -concatenate-blocks -concatenate-events");
}
}
//Chain with Track Histogram
--- /dev/null
+// $Id$
+/**
+ * Benchmark macro for transportation of fake data blocks through an HLT
+ * hierarchy.
+ *
+ * Usage:
+ * <pre>
+ * aliroot -b -q bench-hlt-hierarchy.C | tee bench-hlt-hierarchy.log
+ * </pre>
+ * Options:
+ * <pre>
+ * aliroot -b -q bench-hlt-hierarchy.C'(2, "root raw")'
+ * </pre>
+ * First argument allows to specifiy the number of events, the second one
+ * is a string defining the output, "root" for a statistics in a root file
+ * and "raw" for just the raw data block. Can be combined. Default is "root".
+ *
+ * @ingroup alihlt_benchmark
+ * @author Matthias.Richter@ift.uib.no
+ */
+void bench_hlt_hierarchy(int events=100, const char* option="root")
+{
+ TString options=option;
+ AliHLTSystem gHLT(0x7c);
+ gHLT.LoadComponentLibraries("libAliHLTUtil.so");
+
+ ///////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // define the analysis chain to be run
+ //
+ const int iNofLevel0=6;
+ const int iNofLevel1=18;
+ const int iNofLevel2=2;
+ TString level3Input;
+ TString arg, component;
+ for (int level2=0; level2<iNofLevel2; level2++) {
+ TString level2Input;
+ for (int level1=0; level1<iNofLevel1; level1++) {
+ TString level1Input;
+ for (int level0=0; level0<iNofLevel0; level0++) {
+ // level0 publisher component
+ arg.Form("-datatype DUMMYDAT FAKE -size 10000 -range 1000 -modulo 10 -decrement 1000");
+ component.Form("L0_%d_%02d_%d", level2, level1, level0);
+ AliHLTConfiguration l0conf(component.Data(), "DataGenerator", NULL , arg.Data());
+
+ if (level1Input.Length()>0) level1Input+=" ";
+ level1Input+=component;
+ }
+
+ // level 1 components
+ arg.Form("-datatype DUMMYDAT FAKE -multiplier 0.2");
+ component.Form("L1_%d_%02d", level2, level1);
+ AliHLTConfiguration l1conf(component.Data(), "DataGenerator", level1Input.Data(), arg.Data());
+ if (level2Input.Length()>0) level2Input+=" ";
+ level2Input+=component;
+ }
+
+ // level 2 components
+ arg.Form("-datatype DUMMYDAT FAKE -multiplier 1.0");
+ component.Form("L2_%d", level2);
+ AliHLTConfiguration l2conf(component.Data(),"DataGenerator",level2Input.Data(), arg.Data());
+ if (level3Input.Length()>0) level3Input+=" ";
+ level3Input+=component;
+ }
+
+ arg.Form("-datatype DUMMYDAT FAKE -multiplier 1.0");
+ AliHLTConfiguration l3conf("L3","DataGenerator",level3Input.Data(),arg.Data());
+ AliHLTConfiguration statroot("statroot", "StatisticsCollector" , "L3", "-file HLT.statistics.root -publish 0");
+ AliHLTConfiguration statraw("statraw", "FileWriter" , "L3", "-datafile HLT.statistics.raw -concatenate-events -concatenate-blocks -datatype COMPSTAT PRIV");
+
+ if (options.Contains("root"))
+ gHLT.BuildTaskList("statroot");
+ if (options.Contains("raw"))
+ gHLT.BuildTaskList("statraw");
+ gHLT.Run(events);
+}
--- /dev/null
+// $Id$
+/**
+ * Helper macro to format a block of AliHLTComponentStatistics entries.
+ * The block is usually created by attaching a file writer to a chain,
+ * writing only COMPSTAT:PRIV data blocks.
+ *
+ * The macro translates the block into HLTruns a stand-alone chain
+ * Usage:
+ * <pre>
+ * aliroot -b -q format-statistics.C | tee format-statistics.log
+ * </pre>
+ *
+ *
+ * @ingroup alihlt_benchmark
+ * @author Matthias.Richter@ift.uib.no
+ */
+void format_statistics(const char* infile, const char* outfile="HLT.statistics.root")
+{
+ AliHLTSystem gHLT;
+ gHLT.LoadComponentLibraries("libAliHLTUtil.so");
+ AliHLTConfiguration publisher("publisher", "FilePublisher", NULL, "-datatype 'COMPSTAT' 'PRIV' -datafile HLT.statistics.raw");
+
+ AliHLTConfiguration sink1("sink1", "StatisticsCollector", "publisher", "-file out.root -publish 0 -arraysize 200000");
+
+ gHLT.BuildTaskList("sink1");
+ gHLT.Run();
+}
+
+void format_statistics()
+{
+ cerr << "===============================================================" << endl;
+ cerr << "usage:" << endl;
+ cerr << " aliroot -b -q -l format-statistics.C'(\"infile\", \"outfile\")'" << endl << endl;
+ cerr << "please provide input, e.g. \"HLT.statistics.raw\"" << endl;
+ cerr << "default output file is \"HLT.statistics.root\"" << endl;
+ cerr << "===============================================================" << endl;
+}