}
}
+AliHLTComponentHandler::TLibraryMode AliHLTComponentHandler::SetLibraryMode(TLibraryMode mode)
+{
+ // see header file for class documentation
+ TLibraryMode old=fLibraryMode;
+ fLibraryMode=mode;
+ return old;
+}
+
int AliHLTComponentHandler::LoadLibrary( const char* libraryPath, int bActivateAgents)
{
// see header file for class documentation
if (hLib.fHandle!=NULL) {
// create TString object to store library path and use pointer as handle
hLib.fName=new TString(libraryPath);
- HLTInfo("library %s loaded (%s)", libraryPath, loadtype);
+ hLib.fMode=fLibraryMode;
+ HLTInfo("library %s loaded (%s%s)", libraryPath, hLib.fMode==kStatic?"persistent, ":"", loadtype);
fLibraryList.insert(fLibraryList.begin(), hLib);
typedef void (*CompileInfo)( char*& date, char*& time);
CompileInfo fctInfo=(CompileInfo)FindSymbol(libraryPath, "CompileInfo");
int iResult=0;
fgAliLoggingFunc=NULL;
TString* pName=reinterpret_cast<TString*>(handle.fName);
+ if (handle.fMode!=kStatic) {
#ifdef HAVE_DLFCN_H
try {
dlclose(handle.fHandle);
delete pCount;
}
#endif //HAVE_DLFCN_H
- handle.fName=NULL;
- handle.fHandle=NULL;
if (pName) {
HLTDebug("unload library %s", pName->Data());
- delete pName;
} else {
HLTWarning("missing name for unloaded library");
}
+ }
+ handle.fName=NULL;
+ handle.fHandle=NULL;
+ if (pName) {
+ delete pName;
+ }
pName=NULL;
return iResult;
}
/** destructor */
virtual ~AliHLTComponentHandler();
+ /**
+ * Library mode.
+ * - kDynamic: library can be unloaded (unload forced at termination of the
+ * handler
+ * - kStatic: library persistent, once loaded it stays
+ */
+ enum TLibraryMode {kDynamic, kStatic};
+
/**
* Set the environment for the HLT framework.
* The environment mainly consists of function pointers for the integration
*/
void SetEnvironment(AliHLTComponentEnvironment* pEnv);
+ /**
+ * Set library mode.
+ * The mode effects all loaded libraries until another mode is set.
+ * @param mode persistent library or not
+ * @param previous mode
+ */
+ TLibraryMode SetLibraryMode(TLibraryMode mode);
+
/**
* Load a component shared library.
* The component library needs to be loaded from the ComponentHanler in order
* @param bActivateAgents activate agents after loading (@ref ActivateAgents)
* @return 0 if succeeded, neg. error code if failed
*/
- int LoadLibrary( const char* libraryPath, int bActivateAgents=1 );
+ int LoadLibrary( const char* libraryPath, int bActivateAgents=1);
/**
* Find a symbol in a dynamically loaded library.
void* fHandle; //! transient
/** name of the library, casted to TString* before use */
void* fName; //! transient
+ /** library mode: kStatic means never unloaded */
+ TLibraryMode fMode; //! transient
};
/**
AliHLTComponentEnvironment fEnvironment; // see above
/** list of owned components, deleted at termination of the handler */
vector<AliHLTComponent*> fOwnedComponents; // see above
+ /** library mode effects all loaded libraries until a new mode is set */
+ TLibraryMode fLibraryMode; // see above
ClassDef(AliHLTComponentHandler, 0);
{
// see header file for function documentation
int iResult=0;
- AliHLTRawBufferPList::iterator buffer=fgFreeBuffers.begin();
- while (buffer!=fgFreeBuffers.end()) {
+// int iTotalSize=0;
+// int iCount=fgFreeBuffers.size()+fgActiveBuffers.size();
+ AliHLTRawBufferPList::iterator buffer;;
+ while ((buffer=fgFreeBuffers.begin())!=fgFreeBuffers.end()) {
+// iTotalSize+=(*buffer)->GetTotalSize();
delete *buffer;
fgFreeBuffers.erase(buffer);
- buffer=fgFreeBuffers.begin();
}
- buffer=fgActiveBuffers.begin();
- while (buffer!=fgActiveBuffers.end()) {
+ while ((buffer=fgActiveBuffers.begin())!=fgActiveBuffers.end()) {
+// iTotalSize+=(*buffer)->GetTotalSize();
fgLogging.Logging(kHLTLogWarning, "AliHLTDataBuffer::ReleaseRawBuffer", "data buffer handling", "request to delete active raw buffer container (raw buffer %p, size %d)", (*buffer)->GetPointer(), (*buffer)->GetTotalSize());
delete *buffer;
fgActiveBuffers.erase(buffer);
- buffer=fgActiveBuffers.begin();
}
+// fgLogging.Logging(kHLTLogInfo, "AliHLTDataBuffer::ReleaseRawBuffer", "data buffer handling", "Total memory allocation: %d byte in %d buffers", iTotalSize, iCount);
return iResult;
}
AliHLTUInt8_t* AliHLTDataBuffer::AliHLTRawBuffer::UseBuffer(AliHLTUInt32_t size)
{
// see header file for function documentation
- if (size>0 && CheckSize(size)) {
+ if (size>0 && fTotalSize>=size) {
fSize=size;
return fPtr;
}
*/
int Reset();
+ /**
+ * Set local logging level
+ * logging filter for individual object
+ */
+ void SetLocalLoggingLevel(AliHLTComponentLogSeverity level)
+ {fgLogging.SetLocalLoggingLevel(level); AliHLTLogging::SetLocalLoggingLevel(level);}
+
/**
* @class AliHLTDataSegment
* @brief Descriptor of a data segment within the buffer.
* Set local logging level
* logging filter for individual object
*/
- void SetLocalLoggingLevel(AliHLTComponentLogSeverity level);
+ virtual void SetLocalLoggingLevel(AliHLTComponentLogSeverity level);
/**
* Get local logging level
#include <TObjArray.h>
#include <TObjString.h>
#include <TStopwatch.h>
+//#include <TSystem.h>
#include <TROOT.h>
#include <TInterpreter.h>
HLTWarning("multiple instances of AliHLTSystem, you should not use more than one at a time");
SetGlobalLoggingLevel(kHLTLogDefault);
+ SetFrameworkLog(kHLTLogDefault);
if (fpComponentHandler) {
AliHLTComponentEnvironment env;
memset(&env, 0, sizeof(AliHLTComponentEnvironment));
pTask=new AliHLTTask(pConf);
if (pTask==NULL) {
iResult=-ENOMEM;
+ } else {
+ pTask->SetLocalLoggingLevel(GetLocalLoggingLevel());
}
}
static int iterationLevel=0;
if (obj) {
AliHLTTask* pTask=(AliHLTTask*)obj;
iResult=pTask->Init(NULL, fpComponentHandler);
+// ProcInfo_t ProcInfo;
+// gSystem->GetProcInfo(&ProcInfo);
+// HLTInfo("task %s initialized (%d), current memory usage %d %d", pTask->GetName(), iResult, ProcInfo.fMemResident, ProcInfo.fMemVirtual);
} else {
}
lnk = lnk->Next();
if (obj) {
AliHLTTask* pTask=(AliHLTTask*)obj;
iResult=pTask->StartRun();
+// ProcInfo_t ProcInfo;
+// gSystem->GetProcInfo(&ProcInfo);
+// HLTInfo("task %s started (%d), current memory usage %d %d", pTask->GetName(), iResult, ProcInfo.fMemResident, ProcInfo.fMemVirtual);
} else {
}
lnk = lnk->Next();
if (obj) {
AliHLTTask* pTask=(AliHLTTask*)obj;
iResult=pTask->ProcessTask(eventNo);
- HLTDebug("task %s finnished (%d)", pTask->GetName(), iResult);
+// ProcInfo_t ProcInfo;
+// gSystem->GetProcInfo(&ProcInfo);
+// HLTInfo("task %s processed (%d), current memory usage %d %d", pTask->GetName(), iResult, ProcInfo.fMemResident, ProcInfo.fMemVirtual);
} else {
}
lnk = lnk->Next();
if (obj) {
AliHLTTask* pTask=(AliHLTTask*)obj;
iResult=pTask->EndRun();
+// ProcInfo_t ProcInfo;
+// gSystem->GetProcInfo(&ProcInfo);
+// HLTInfo("task %s stopped (%d), current memory usage %d %d", pTask->GetName(), iResult, ProcInfo.fMemResident, ProcInfo.fMemVirtual);
} else {
}
lnk = lnk->Next();
if (obj) {
AliHLTTask* pTask=(AliHLTTask*)obj;
iResult=pTask->Deinit();
+// ProcInfo_t ProcInfo;
+// gSystem->GetProcInfo(&ProcInfo);
+// HLTInfo("task %s cleaned (%d), current memory usage %d %d", pTask->GetName(), iResult, ProcInfo.fMemResident, ProcInfo.fMemVirtual);
} else {
}
lnk = lnk->Next();
// see header file for class documentation
int iResult=0;
if (options) {
+ AliHLTComponentHandler::TLibraryMode libMode=AliHLTComponentHandler::kDynamic;
TString libs("");
TString alloptions(options);
TObjArray* pTokens=alloptions.Tokenize(" ");
} else {
HLTWarning("wrong parameter for option \'loglevel=\', (hex) number expected");
}
+ } else if (token.Contains("frameworklog=")) {
+ TString param=token.ReplaceAll("frameworklog=", "");
+ if (param.IsDigit()) {
+ SetFrameworkLog((AliHLTComponentLogSeverity)param.Atoi());
+ } else if (param.BeginsWith("0x") &&
+ param.Replace(0,2,"",0).IsHex()) {
+ int severity=0;
+ sscanf(param.Data(),"%x", &severity);
+ SetFrameworkLog((AliHLTComponentLogSeverity)severity);
+ } else {
+ HLTWarning("wrong parameter for option \'loglevel=\', (hex) number expected");
+ }
} else if (token.Contains("alilog=off")) {
SwitchAliLog(0);
} else if (token.Contains("config=")) {
} else if (token.Contains("chains=")) {
TString param=token.ReplaceAll("chains=", "");
fChains=param.ReplaceAll(",", " ");
+ } else if (token.Contains("libmode=")) {
+ TString param=token.ReplaceAll("libmode=", "");
+ param.ReplaceAll(",", " ");
+ if (fpComponentHandler) {
+ if (param.CompareTo("static")==0) {
+ fpComponentHandler->SetLibraryMode(AliHLTComponentHandler::kStatic);
+ } else if (param.CompareTo("dynamic")==0) {
+ fpComponentHandler->SetLibraryMode(AliHLTComponentHandler::kDynamic);
+ } else {
+ HLTWarning("wrong argument for option \'libmode=\', use \'static\' or \'dynamic\'");
+ }
+ }
} else if (token.BeginsWith("lib") && token.EndsWith(".so")) {
libs+=token;
libs+=" ";
if (fpComponentHandler==NULL) return NULL;
return fpComponentHandler->FindSymbol(library, symbol);
}
+
+void AliHLTSystem::SetFrameworkLog(AliHLTComponentLogSeverity level)
+{
+ SetLocalLoggingLevel(level);
+ if (fpComponentHandler) fpComponentHandler->SetLocalLoggingLevel(level);
+ if (fpConfigurationHandler) fpConfigurationHandler->SetLocalLoggingLevel(level);
+}
* <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
* \li loglevel=<i>level</i> <br>
* logging level for this processing
+ * \li frameworklog=<i>level</i> <br>
+ * logging level for framework classes
* \li alilog=off
* disable redirection of log messages to AliLog class
* \li config=<i>macro</i>
* \li chains=<i>configuration</i>
* comma separated list of configurations to be run during local
* reconstruction
+ * \li libmode=<i>static,dynamic(default)</i>
+ * libraries are persistent if loaded in mode <i>static</i>, i.e. they
+ * can't be unloaded
*/
int ScanOptions(const char* options);
*/
int ClearStatusFlags(int flags);
+ /**
+ * Set logging level for framework classes.
+ * This sets the local logging level of this instance and all subsequent
+ * framework classes to \em level.
+ * @param level local logging level for the framework classes
+ */
+ void SetFrameworkLog(AliHLTComponentLogSeverity level);
/* TList fConfList; */
/* int fbListChanged; */
if (iResult>=0) {
fpDataBuffer=new AliHLTDataBuffer;
if (fpDataBuffer!=NULL) {
+ fpDataBuffer->SetLocalLoggingLevel(GetLocalLoggingLevel());
HLTDebug("created data buffer %p for task %s (%p)", fpDataBuffer, GetName(), this);
TObjLink* lnk=fListTargets.FirstLink();
while (lnk && iResult>=0) {