diff --git a/devices/aliceHLTwrapper/Component.cxx b/devices/aliceHLTwrapper/Component.cxx index be1172be55c4a..eb9b2999eed66 100644 --- a/devices/aliceHLTwrapper/Component.cxx +++ b/devices/aliceHLTwrapper/Component.cxx @@ -54,6 +54,7 @@ int Component::init(int argc, char** argv) {"run", required_argument, 0, 'r'}, {"msgsize", required_argument, 0, 's'}, {"output-mode", required_argument, 0, 'm'}, + {"instance-id", required_argument, 0, 'i'}, {0, 0, 0, 0} }; @@ -69,13 +70,14 @@ int Component::init(int argc, char** argv) const char* componentLibrary = ""; const char* componentId = ""; const char* componentParameter = ""; + const char* instanceId=""; // the configuration and calibration is fixed for every run and identified // by the run no int runNumber = 0; optind = 1; // indicate new start of scanning, especially when getop has been used in a higher layer already - while ((c = getopt_long(argc, argv, "l:c:p:r:s:m:", programOptions, &iOption)) != -1) { + while ((c = getopt_long(argc, argv, "l:c:p:r:s:m:i:", programOptions, &iOption)) != -1) { switch (c) { case 'l': componentLibrary = optarg; @@ -99,6 +101,10 @@ int Component::init(int argc, char** argv) std::stringstream(optarg) >> outputMode; mFormatHandler.setOutputMode(outputMode); } break; + case 'i': { + instanceId=optarg; + break; + } case '?': // TODO: more error handling break; @@ -143,7 +149,9 @@ int Component::init(int argc, char** argv) } // create component - if ((iResult=mpSystem->createComponent(componentId, NULL, parameters.size(), ¶meters[0], &mProcessor, ""))<0) { + string description; + description+=" chainid="; description+=instanceId; + if ((iResult=mpSystem->createComponent(componentId, NULL, parameters.size(), ¶meters[0], &mProcessor, description.c_str()))<0) { // the ALICE HLT external interface uses the following error definition // 0 success // >0 error number diff --git a/devices/aliceHLTwrapper/Component.h b/devices/aliceHLTwrapper/Component.h index 726c30389a675..d28b39541eb7a 100644 --- a/devices/aliceHLTwrapper/Component.h +++ b/devices/aliceHLTwrapper/Component.h @@ -73,6 +73,8 @@ class Component { /// list. int process(vector& dataArray); + int getEventCount() const {return mEventCount;} + protected: private: diff --git a/devices/aliceHLTwrapper/WrapperDevice.cxx b/devices/aliceHLTwrapper/WrapperDevice.cxx index ebe8e902174f8..1a00f291e1f72 100644 --- a/devices/aliceHLTwrapper/WrapperDevice.cxx +++ b/devices/aliceHLTwrapper/WrapperDevice.cxx @@ -70,7 +70,16 @@ void WrapperDevice::Init() std::unique_ptr component(new ALICE::HLT::Component); if (!component.get()) return /*-ENOMEM*/; - if ((iResult=component->init(mArgv.size(), &mArgv[0]))<0) { + string idkey="--instance-id"; + string id=""; + id=GetProperty(FairMQDevice::Id, id); + vector argv; + argv.push_back(mArgv[0]); + argv.push_back(&idkey[0]); + argv.push_back(&id[0]); + if (mArgv.size()>1) + argv.insert(argv.end(), mArgv.begin()+1, mArgv.end()); + if ((iResult=component->init(argv.size(), &argv[0]))<0) { LOG(ERROR) << "component init failed with error code " << iResult; throw std::runtime_error("component init failed"); return /*iResult*/; @@ -174,7 +183,8 @@ void WrapperDevice::Run() } mLastSampleTime=duration.count(); if (duration.count()-mLastCalcTime>fLogIntervalInMs) { - LOG(INFO) << "------ processed " << mNSamples << " sample(s) "; + LOG(INFO) << "------ processed " << mNSamples << " sample(s) - total " + << mComponent->getEventCount() << " sample(s)"; if (mNSamples > 0) { LOG(INFO) << "------ min " << mMinTimeBetweenSample << "ms, max " << mMaxTimeBetweenSample << "ms avrg " << (duration.count() - mLastCalcTime) / mNSamples << "ms ";