}
return iResult;
}
+
+void AliHLTConsumerDescriptor::Print(const char* /*option*/) const
+{
+ // print info about this descriptor
+ cout << "AliHLTConsumerDescriptor " << this
+ << " component ID " << (fpConsumer?fpConsumer->GetComponentID():"NULL")
+ //<< " chain ID " << (fpConsumer?fpConsumer->GetChainId():"NULL")
+ << endl;
+ for (unsigned i=0; i<fSegments.size(); i++) {
+ cout << " ";
+ fSegments[i].Print("");
+ }
+}
-// @(#) $Id$
+//-*- Mode: C++ -*-
+// $Id$
#ifndef ALIHLTCONSUMERDESCRIPTOR_H
#define ALIHLTCONSUMERDESCRIPTOR_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
+//* 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 *
-/** @file AliHLTConsumerDescriptor.h
- @author Matthias Richter
- @date
- @brief Helper class to describe a consumer component.
- @note The class is used in Offline (AliRoot) context
-*/
+/// @file AliHLTConsumerDescriptor.h
+/// @author Matthias Richter
+/// @date
+/// @brief Helper class to describe a consumer component.
+/// @note The class is used in Offline (AliRoot) context
#include "AliHLTDataBuffer.h"
*/
int ReleaseActiveDataSegment(AliHLTDataBuffer::AliHLTDataSegment segment);
+ virtual void Print(const char* option) const;
+
private:
/** copy constructor prohibited */
AliHLTConsumerDescriptor(const AliHLTConsumerDescriptor&);
ClassDef(AliHLTConsumerDescriptor, 0)
};
-#endif // ALIHLTDATABUFFER_H
+#endif // ALIHLTCONSUMERDESCRIPTOR_H
iResult=tgtList.size();
return iResult;
+ // NOTE: the remaining code is disabled
+ // to be deleted at cleanup
if (pConsumer) {
AliHLTComponentDataTypeList dtlist;
((AliHLTComponent*)pConsumer)->GetInputDataTypes(dtlist);
return iResult;
}
-int AliHLTDataBuffer::GetNofSegments()
+int AliHLTDataBuffer::GetNofSegments() const
{
// see header file for function documentation
int iResult=fSegments.size() + fForwardedSegments.size();
return iResult;
}
-int AliHLTDataBuffer::GetNofConsumers()
+int AliHLTDataBuffer::GetNofConsumers() const
{
// see header file for function documentation
int iResult=fConsumers.size() + GetNofActiveConsumers() + fReleasedConsumers.size();
return iResult;
}
-int AliHLTDataBuffer::GetNofPendingConsumers()
+int AliHLTDataBuffer::GetNofPendingConsumers() const
{
// see header file for function documentation
int iResult=fConsumers.size();
return iResult;
}
-int AliHLTDataBuffer::GetNofActiveConsumers()
+int AliHLTDataBuffer::GetNofActiveConsumers() const
{
// see header file for function documentation
int iResult=fActiveConsumers.size();
return -EINVAL;
}
-void AliHLTDataBuffer::AliHLTRawBuffer::Print(const char* option)
+void AliHLTDataBuffer::AliHLTRawBuffer::Print(const char* option) const
{
/// print buffer information
if (strcmp(option, "min")!=0) {
}
return NULL;
}
+
+void AliHLTDataBuffer::AliHLTDataSegment::Print(const char* /*option*/) const
+{
+ // print info for data segment
+ cout << "AliHLTDataSegment " << this
+ << " " << AliHLTComponent::DataType2Text(fDataType)
+ << " " << hex << fSpecification << dec
+ << " Ptr " << (void*)fPtr
+ << " offset " << fSegmentOffset
+ << " size " << fSegmentSize
+ << endl;
+}
+
+void AliHLTDataBuffer::AliHLTForwardedDataSegment::Print(const char* option) const
+{
+ // print info for data segment
+ cout << "AliHLTForwardeDataSegment " << this << endl;
+ cout << " my : "; AliHLTDataSegment::Print(option);
+ cout << " parent: "; fParentSegment.Print(option);
+ cout << " task : ";
+ if (fParentTask) fParentTask->Print("");
+ else cout << "nil" << endl;
+}
+
+void AliHLTDataBuffer::Print(const char* option) const
+{
+ // print info for data buffer
+ unsigned i=0;
+ cout << "AliHLTDataBuffer " << this << endl;
+ cout << " raw buffer " << fpBuffer << endl;
+ if (fpBuffer) {
+ cout << " ";
+ fpBuffer->Print(option);
+ }
+
+ cout << " total segments: " << GetNofSegments() << endl;
+ cout << " data segments: " << fSegments.size() << endl;
+ for (i=0; i<fSegments.size(); i++) {
+ cout << " ";
+ fSegments[i].Print(option);
+ }
+
+ cout << " forwarded segments: " << fForwardedSegments.size() << endl;
+ for (i=0; i<fForwardedSegments.size(); i++) {
+ cout << " ";
+ fForwardedSegments[i].Print(option);
+ }
+
+ cout << " consumers: " << GetNofConsumers() << endl;
+ for (i=0; i<fConsumers.size(); i++) {
+ cout << " ";
+ fConsumers[i]->Print(option);
+ }
+
+ cout << " active consumers: " << GetNofActiveConsumers() << endl;
+ for (i=0; i<fActiveConsumers.size(); i++) {
+ cout << " ";
+ fActiveConsumers[i]->Print(option);
+ }
+
+ cout << " released consumers: " << fReleasedConsumers.size() << endl;
+ for (i=0; i<fReleasedConsumers.size(); i++) {
+ cout << " ";
+ fReleasedConsumers[i]->Print(option);
+ }
+
+}
* Get the number of segments including the forwarded data blocks.
* @return number of segments
*/
- int GetNofSegments();
+ int GetNofSegments() const;
/**
* Get the total number of consumers.
* This gives the number of consumers regardless of their state.
* @return number of consumers
*/
- int GetNofConsumers();
+ int GetNofConsumers() const;
/**
* Get the number of consumers which still need to be processed during
* the current event.
* @return number of consumers
*/
- int GetNofPendingConsumers();
+ int GetNofPendingConsumers() const;
/**
* Get the number of consumers currently under processing.
* @return number of active consumers
*/
- int GetNofActiveConsumers();
+ int GetNofActiveConsumers() const;
/**
* Check if a consumer is already in the list
*/
int Reset();
+ /**
+ * Print info about the buffer
+ */
+ virtual void Print(const char* option) const;
+
/**
* Set local logging level
* logging filter for individual object
{
}
+ AliHLTDataSegment(const AliHLTDataSegment& src)
+ :
+ fDataType(src.fDataType),
+ fPtr(src.fPtr),
+ fSegmentOffset(src.fSegmentOffset),
+ fSegmentSize(src.fSegmentSize),
+ fSpecification(src.fSpecification)
+ {
+ // AliHLTDataSegment just stores external pointers and properties
+ }
+
+ AliHLTDataSegment& operator=(const AliHLTDataSegment& src)
+ {
+ // AliHLTDataSegment just stores external pointers and properties
+ fDataType=src.fDataType;
+ fPtr=src.fPtr;
+ fSegmentOffset=src.fSegmentOffset;
+ fSegmentSize=src.fSegmentSize;
+ fSpecification=src.fSpecification;
+ return *this;
+ }
+
+ virtual ~AliHLTDataSegment() {}
+
AliHLTUInt8_t* GetPtr() const {return (AliHLTUInt8_t*)*this;}
AliHLTUInt32_t GetSize() const {return fSegmentSize;}
}
operator AliHLTUInt8_t*() const {return fPtr+fSegmentOffset;}
+ virtual void Print(const char* option) const;
+
private:
/** the data type of this segment */
AliHLTComponentDataType fDataType; // see above
};
+ /**
+ * @class AliHLTForwardedDataSegment
+ * @brief Descriptor of a forwarded data segment.
+ * Contains in addition information about the parent of this forwarded
+ * block and the original data type and specification
+ */
+ class AliHLTForwardedDataSegment : public AliHLTDataSegment {
+ friend class AliHLTDataBuffer; // TODO: implement some getters/setters
+ public:
+ AliHLTForwardedDataSegment()
+ : AliHLTDataSegment()
+ , fParentSegment()
+ , fParentTask(NULL)
+ {
+ }
+
+ AliHLTForwardedDataSegment(AliHLTDataSegment& mySegment, AliHLTDataSegment& parentSegment, AliHLTTask* parentTask)
+ : AliHLTDataSegment(mySegment)
+ , fParentSegment(parentSegment)
+ , fParentTask(parentTask)
+ {
+ }
+
+ AliHLTForwardedDataSegment(const AliHLTForwardedDataSegment& src)
+ : AliHLTDataSegment(src),
+ fParentSegment(src.fParentSegment),
+ fParentTask(src.fParentTask)
+ {
+ // AliHLTForwardedDataSegment just stores external pointers and properties
+ }
+
+ AliHLTForwardedDataSegment& operator=(const AliHLTForwardedDataSegment& src)
+ {
+ // AliHLTForwardedDataSegment just stores external pointers and properties
+ AliHLTDataSegment::operator=(src);
+ fParentSegment=src.fParentSegment;
+ fParentTask=src.fParentTask;
+ return *this;
+ }
+
+ virtual ~AliHLTForwardedDataSegment() {}
+
+ virtual void Print(const char* option) const;
+
+ private:
+ /// description of the original segment
+ AliHLTDataSegment fParentSegment; // see above
+ /// the parent task
+ AliHLTTask* fParentTask; //!transient
+ };
+
class AliHLTRawBuffer;
typedef vector<AliHLTRawBuffer*> AliHLTRawBufferPList;
/**
* Print page information
*/
- void Print(const char* option);
+ virtual void Print(const char* option);
private:
/** copy constructor prohibited */
/**
* Print buffer information
*/
- void Print(const char* option);
+ virtual void Print(const char* option) const;
int operator==(void* ptr) const;
int operator==(AliHLTUInt8_t* ptr) const {return fPtr==ptr;}
// $Id$
-// splitted from AliHLTConfiguration.cxx,v 1.25 2007/10/12 13:24:47
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project *
- * ALICE Experiment at CERN, All rights reserved. *
- * *
- * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
- * 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. *
- **************************************************************************/
-
-/** @file AliHLTTask.cxx
- @author Matthias Richter
- @date
- @brief Implementation of HLT tasks.
-*/
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* 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. *
+//**************************************************************************
+
+/// @file AliHLTTask.cxx
+/// @author Matthias Richter
+/// @date
+/// @brief Implementation of HLT tasks.
+///
// see header file for class documentation
// or
#include "AliHLTComponent.h"
#include "AliHLTComponentHandler.h"
#include "TList.h"
+#include "AliHLTErrorGuard.h"
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTask)
eventTypeBlock.fSpecification=eventType;
fBlockDataArray.push_back(eventTypeBlock);
+ if (CheckFilter(kHLTLogDebug)) Print("proc");
+
+ AliHLTUInt32_t iblock=0;
+ // check input and output buffers for consistency
+ // to be enabled after fixing bug with DataBuffer and forwarded SOR/EOR
+ //for (iblock=0; iblock<fBlockDataArray.size(); iblock++) {
+ // if ((AliHLTUInt8_t*)fBlockDataArray[iblock].fPtr >= pTgtBuffer+size) continue;
+ // if (pTgtBuffer >= (AliHLTUInt8_t*)fBlockDataArray[iblock].fPtr+fBlockDataArray[iblock].fSize) continue;
+ // HLTFatal("input and output buffer overlap for block descriptor %d (ptr %p size %d): output buffer %p %d",
+ // iblock, fBlockDataArray[iblock].fPtr, fBlockDataArray[iblock].fSize,
+ // pTgtBuffer, size);
+ //}
+
// process
evtData.fBlockCnt=fBlockDataArray.size();
iResult=pComponent->ProcessEvent(evtData, &fBlockDataArray[0], trigData, pTgtBuffer, size, outputBlockCnt, outputBlocks, edd);
}
// check for duplicates in the output
+ // this check applies for forwarded data blocks where
+ // the ptr is not inside the target buffer
AliHLTUInt32_t checkblock=0;
for (; checkblock<oblock; checkblock++) {
if (outputBlocks[oblock].fPtr!=NULL && outputBlocks[oblock].fPtr!=pTgtBuffer &&
if (outputBlocks[checkblock].fSize!=outputBlocks[oblock].fSize ||
outputBlocks[checkblock].fDataType!=outputBlocks[oblock].fDataType) {
HLTWarning("output blocks %d (%s 0x%08x) and %d (%s 0x%08x) have identical data references ptr=%p "
- "but differ in data type and/or size: %d vs. %d",
+ "but differ in data type and/or size: %d vs. %d, ignoring block %d",
oblock,
AliHLTComponent::DataType2Text(outputBlocks[oblock].fDataType).c_str(),
outputBlocks[oblock].fSpecification,
outputBlocks[checkblock].fSpecification,
outputBlocks[oblock].fPtr,
outputBlocks[oblock].fSize,
- outputBlocks[checkblock].fSize);
+ outputBlocks[checkblock].fSize,
+ checkblock);
}
// ignore from the second copy
break;
// to the publisher task. The publisher task of a forwarded data block is
// removed from the list in order to keep the buffer open. It will be releases
// when the subscribing task releases it
- AliHLTUInt32_t iblock=0;
+ iblock=0;
for (; iblock<fBlockDataArray.size(); iblock++) {
if (outputBlocks[oblock].fDataType==kAliHLTDataTypeEvent) {
- // the event type data block is ignored if it was forwarded
+ // the event type data block is an artificial data block
+ // ignore if it was forwarded
break;
}
if (fBlockDataArray[iblock].fPtr==outputBlocks[oblock].fPtr) {
assert(subscribedTaskList[iblock]!=NULL);
- if (subscribedTaskList[iblock]==NULL) continue;
+ if (subscribedTaskList[iblock]==NULL) {
+ ALIHLTERRORGUARD(1, "missing parent task for forwarded data block %s 0x%08x, original data block %s 0x%08x, subsequent errors are suppressed",
+ AliHLTComponent::DataType2Text(outputBlocks[oblock].fDataType).c_str(),
+ outputBlocks[oblock].fSpecification,
+ AliHLTComponent::DataType2Text(outputBlocks[iblock].fDataType).c_str(),
+ outputBlocks[iblock].fSpecification);
+ continue;
+ }
HLTDebug("forward segment %d (source task %s %p) to data buffer %p", iblock, pSrcTask->GetName(), pSrcTask, fpDataBuffer);
fpDataBuffer->Forward(subscribedTaskList[iblock], &fBlockDataArray[iblock]);
subscribedTaskList[iblock]=NULL; // not to be released in the loop further down
subscribedTaskList[iEOR]=NULL; // not to be released in the loop further down
}
if (iECS>=0 && subscribedTaskList[iECS]!=NULL) {
- HLTDebug("forward EOR event (%s) segment %d (source task %s %p) to data buffer %p", AliHLTComponent::DataType2Text(fBlockDataArray[iECS].fDataType).c_str(), iECS, pSrcTask->GetName(), pSrcTask, fpDataBuffer);
+ HLTDebug("forward ECS event (%s) segment %d (source task %s %p) to data buffer %p", AliHLTComponent::DataType2Text(fBlockDataArray[iECS].fDataType).c_str(), iECS, pSrcTask->GetName(), pSrcTask, fpDataBuffer);
fpDataBuffer->Forward(subscribedTaskList[iECS], &fBlockDataArray[iECS]);
subscribedTaskList[iECS]=NULL; // not to be released in the loop further down
}
} while (iResult==-ENOSPC && iNofTrial++<1);
}
+ fBlockDataArray.clear();
+ if (CheckFilter(kHLTLogDebug)) Print("proc");
+
// now release all buffers which we have subscribed to
iSourceDataBlock=0;
AliHLTTaskPList::iterator element;
}
}
+void AliHLTTask::Print(const char* options) const
+{
+ // Overloaded from TObject
+ if (strcmp(options, "proc")==0) {
+ // print processing info
+ HLTMessage("**********************************************");
+ HLTMessage("******* AliHLTTask Processing info ***********");
+ HLTMessage(" component: %p %s", fpComponent, (fpComponent?fpComponent->GetComponentID():""));
+ HLTMessage(" data buffer: %p", fpDataBuffer);
+ if (fpDataBuffer) fpDataBuffer->Print("");
+ HLTMessage(" input block descriptors: %d", fBlockDataArray.size());
+ for (unsigned i=0; i<fBlockDataArray.size(); i++) {
+ HLTMessage(" %d: %s 0x%08x %p %d", i,
+ AliHLTComponent::DataType2Text(fBlockDataArray[i].fDataType).c_str(),
+ fBlockDataArray[i].fSpecification,
+ fBlockDataArray[i].fPtr,
+ fBlockDataArray[i].fSize
+ );
+ }
+ HLTMessage("**** end of AliHLTTask Processing info *******");
+ HLTMessage("**********************************************");
+ return;
+ }
+
+ cout << "AliHLTTask " << GetName() << " " << this
+ << " component " << fpComponent << " "
+ << (fpComponent?fpComponent->GetComponentID():"")
+ << endl;
+}
+
+
int AliHLTTask::CustomInit(AliHLTComponentHandler* /*pCH*/)
{
// default implementation nothing to do
*/
void PrintStatus();
+ /**
+ * Overloaded from TObject
+ */
+ void Print(const char* options) const;
+
/**
* Search task dependency list recursively to find a dependency.
* @param id id of the task to search for