//***************************************************************************** // File: Level3Accountant.cc // ---------------------------------------------------------------------------- // Type: Class implementation source // Package: Level3Mods // Class: Level3Accountant // Language: Standard C++ // Project: CDF Run II Offline Software Upgrade // OrigAuth: Kevin McFarland // Company: Fermilab //============================================================================= // RCS Current Revision Record //----------------------------------------------------------------------------- // $Source: /cdf/code/cdfcvs/run2/Level3Mods/src/Level3Accountant.cc,v $ // $Revision: 1.15 $ // $Date: 2003/02/17 13:55:42 $ // $Author: ksmcf $ // $State: Exp $ // $Locker: $ //***************************************************************************** //***************************************************************************** // Declarations and Definitions //***************************************************************************** #ifndef LEVEL3ACCOUNTANT_HH #include "Level3Mods/Level3Accountant.hh" #endif #include "Level3Objects/Level3History.hh" #include "Edm/ConstHandle.hh" #include "Edm/GenericConstHandle.hh" #include "Edm/StorableObject.hh" #include "Framework/APPFramework.hh" #include "Framework/AppStream.hh" #include "Framework/APPPath.hh" #include "Framework/APPModule.hh" #include "Framework/APPList.hh" #include "Framework/APPExecNode.hh" #include "Framework/APPExecutable.hh" #include "Framework/APPSequenceNode.hh" #include "Framework/AppAction.hh" #include "Framework/AppActionTime.hh" #include using std::istream; using std::ostream; using std::cout; using std::endl; #ifndef DEFECT_NO_STDLIB_NAMESPACES using std::string; #endif //***************************************************************************** // Class Implementation //***************************************************************************** //============================================================================= // Constructor //============================================================================= Level3Accountant::Level3Accountant(bool formTL3, bool formLevel3Results, bool monitorCpuTime, bool debug): _formTL3(formTL3), _formLevel3Results(formLevel3Results), _monitorCpuTime(monitorCpuTime), _debug(debug) { nPathTrys = 0; nPathPasses = 0; pathCputime = 0; nModuleTrys = 0; nModulePasses = 0; moduleCputime = 0; nPathVsPathTrys = 0; nPathVsPathPasses = 0; _nEvents = 0; // Total number of events _nPaths = 0; // Total number of paths _nModules = 0; // Total number of modules _nStreams = 0; // Total Number of streams if ( _formLevel3Results ) { if (debug) std::cout << "creating Level3ModuleMap and Level3ModuleResults" << std::endl; _streamTriggerMap = new Level3ModuleMap( ); _streamTriggerResults = new Level3ModuleResults( ); _streamTriggerSummary = new Level3ModuleSummary( ); } if ( _formTL3 ) { if (debug) std::cout << "creating APPStored" << std::endl; _streamTriggerTrail = new APPStored( ); } } //============================================================================= // Destructor //============================================================================= Level3Accountant::~Level3Accountant() { if ( _formLevel3Results ) { if ( _streamTriggerMap != NULL ) { delete _streamTriggerMap; _streamTriggerMap = NULL; } if ( _streamTriggerResults != NULL ) { delete _streamTriggerResults; _streamTriggerResults = NULL; } if ( _streamTriggerSummary != NULL ) { delete _streamTriggerSummary; _streamTriggerSummary = NULL; } } if ( _formTL3 ) { if ( _streamTriggerTrail != NULL ) { _streamTriggerTrail->writePassedFile( ); _streamTriggerTrail->summary( ); delete _streamTriggerTrail; _streamTriggerTrail = NULL; } } if ( nPathTrys != 0) delete[] nPathTrys; if ( nPathPasses != 0) delete[] nPathPasses; if ( pathCputime != 0) delete[] pathCputime; if ( nModuleTrys != 0) delete[] nModuleTrys; if ( nModulePasses != 0) delete[] nModulePasses; if ( moduleCputime != 0) delete[] moduleCputime; if ( nPathVsPathTrys !=0) delete[] nPathVsPathTrys; if ( nPathVsPathPasses !=0) delete[] nPathVsPathPasses; // If streamList, std::vector exists, remove all its element if ( !streamList.empty() ) streamList.clear(); // If pathList, std::vector exists, remove all its element if ( !pathList.empty() ) pathList.clear(); // If moduleList exists, remove all its element if ( !moduleList.empty() ) moduleList.clear(); // If moduleResult, std::vector exists, remove all its elements. if ( !moduleResults.empty() ) moduleResults.clear(); // If moduleSummaries exists, remove its elements if ( !moduleSummaries.empty() ) moduleSummaries.clear(); // If pathSummaries exists, remove its element if ( !pathSummaries.empty() ) pathSummaries.clear(); // If pathvsPath, std::vector exists, remove its elements. if ( !pathVsPath.empty() ) pathVsPath.clear(); } //============================================================================= // Print method //============================================================================= void Level3Accountant::audit() { if ( _formTL3 ) { _streamTriggerTrail->writePassedFile( ); _streamTriggerTrail->summary( ); } if ( _formLevel3Results ) { // insert print method here } } //============================================================================= // Modifiers: // // createLedger -- to be called at begin run // countBeans -- called every event // closeLedger -- to be called in end run // //============================================================================= std::vector Level3Accountant::createLedger( AppFramework* theFramework, APPList* theStreams, AbsEvent* anEvent, APPLevel3GenericOutputModule* theLevel3OutputModule) { std::vector theResult; if ( _formLevel3Results ) { if (_debug) { std::cout << "Level3Accountant::createLedger : " << "fill Level3Results mapping" << std::endl; } // fill Mapping among Modules, Paths, Streams/ fillMapping( theFramework, theStreams, theLevel3OutputModule ); if (_debug) { _streamTriggerMap->makeLevel3ModuleMap( streamList, pathList, moduleList, streamPathMap, pathModuleMap ); _streamTriggerMap->fillStatistics( _nStreams, _nPaths, _nModules ); _streamTriggerMap->print(std::cout); } //======================================================== // writing Level3ModuleMap to events. Handle l3SO(new Level3ModuleMap() ); // fill the mapping information. l3SO->makeLevel3ModuleMap( streamList, pathList, moduleList, streamPathMap, pathModuleMap ); // fill numbers of streams, paths, and modules l3SO->fillStatistics( _nStreams, _nPaths, _nModules ); l3SO->set_description("TL3Map"); ConstHandle l3SOH = anEvent->append(l3SO); // end of writing Level3ModuleMap to events //========================================================== if (_debug) { std::cout << "ModuleMap->clas_name = " << l3SOH->class_name()<object_id = " << l3SOH->object_id()<rcp_id = " << l3SOH->rcp_id()<writeTL3B( theFramework, theStreams, anEvent ); theResult.push_back(TL3Boid); } return (theResult); } std::vector Level3Accountant::countBeans( AppFramework* theFramework, APPList* theStreams, AbsEvent* anEvent, APPLevel3GenericOutputModule* theLevel3OutputModule) { std::vector theResult; if ( _formLevel3Results ) { if (_debug) { std::cout << "Level3Accountant::countBeans : filling Level3Results" << std::endl; } // fill Level3ModuleResults --> std::vector moduleResults. fillResult( theFramework ); //fillStorableObject( theFramework ); if ( _debug && nEvents() < 5 ) { _streamTriggerResults->makeLevel3ModuleResults( moduleResults ); _streamTriggerResults->print(std::cout); } //======================================================== // writing Level3ModuleResults to events. Handle l3RSO(new Level3ModuleResults() ); l3RSO->makeLevel3ModuleResults( moduleResults ); if ( l3RSO->class_version() > 1 ) { if ( theLevel3OutputModule != NULL ) { l3RSO->setExeNumber(theLevel3OutputModule->getExeNumber()); l3RSO->setHost(theLevel3OutputModule->getHost()); l3RSO->setExeVersion(theLevel3OutputModule->getExeTag()); l3RSO->setPhysicsTable(theLevel3OutputModule->getTclTag()); l3RSO->setCalibJobSet(theLevel3OutputModule->getCalibTag()); } } else // required until 4.10.0, special Level3History object. if ( theLevel3OutputModule != NULL ) { Handle l3H(new Level3History() ); l3H->setExeNumber(theLevel3OutputModule->getExeNumber()); l3H->setHost(theLevel3OutputModule->getHost()); l3H->setExeVersion(theLevel3OutputModule->getExeTag()); l3H->setPhysicsTable(theLevel3OutputModule->getTclTag()); l3H->setCalibJobSet(theLevel3OutputModule->getCalibTag()); ConstHandle l3HH = anEvent->append( l3H ); if (_debug) { std::cout << "History->clas_name = " << l3HH->class_name()<object_id = " << l3HH->object_id()<rcp_id = " << l3HH->rcp_id()<set_description("TL3Result"); ConstHandle l3RSOH = anEvent->append( l3RSO ); // end of writing Level3ModuleResults to events //========================================================== if (_debug) { std::cout << "ModuleResult->clas_name = " << l3RSOH->class_name()<object_id = " << l3RSOH->object_id()<rcp_id = " << l3RSOH->rcp_id()< 20 && _debug ) { std::cout << "filling Level3ModuleSummary " << std::endl; if ( !moduleSummaries.empty() ) moduleSummaries.clear(); if ( !pathSummaries.empty() ) pathSummaries.clear(); if ( !pathVsPath.empty() ) pathVsPath.clear(); fillRunSummary(); _streamTriggerSummary->makeLevel3ModuleSummary( moduleSummaries, pathSummaries, pathVsPath ); _streamTriggerSummary->print(std::cout); Handle l3RSOS(new Level3ModuleSummary()); l3RSOS->makeLevel3ModuleSummary( moduleSummaries, pathSummaries, pathVsPath ); l3RSOS->set_description("TL3Summary"); ConstHandle l3RSOHS = anEvent->append( l3RSOS ); std::cout<<"ModuleSummary->clas_name = "<class_name()<object_id = "<object_id()<rcp_id = "<rcp_id()< tl3d; if ( _formTL3 && _streamTriggerTrail != NULL ) { if (_debug) std::cout << "Level3Accountant::countBeans : filling APPStored" << std::endl; tl3d = _streamTriggerTrail->writeTL3D( theFramework, theStreams ); if ( _monitorCpuTime ) { Id TL3Toid = _streamTriggerTrail->writeTL3T( theFramework, anEvent ); theResult.push_back(TL3Toid); } } return(theResult); } std::vector Level3Accountant::closeLedger( AbsEvent* anEvent ) { std::vector theResult; if ( _formLevel3Results ) { // fill Run summaries.. fillRunSummary( ); if (_debug) { _streamTriggerSummary->makeLevel3ModuleSummary( moduleSummaries, pathSummaries, pathVsPath ); _streamTriggerSummary->print(std::cout); } //======================================================== // writing Level3ModuleSummary to events. Handle l3RSOS(new Level3ModuleSummary()); l3RSOS->makeLevel3ModuleSummary( moduleSummaries, pathSummaries, pathVsPath ); l3RSOS->set_description("TL3Summary"); ConstHandle l3RSOHS = anEvent->append( l3RSOS ); // end of writing Level3ModuleSummary to events //========================================================== if (_debug) { std::cout<<"ModuleSummary->clas_name = "<< l3RSOHS->class_name() <object_id = "<< l3RSOHS->object_id() <rcp_id = "<< l3RSOHS->rcp_id() <* streams, APPLevel3GenericOutputModule* theLevel3OutputModule ) { // fill L3Module fillModules ( framework ); // fill L3Path and associations between modules and paths. fillPaths ( framework, theLevel3OutputModule ); // fill L3Stream and associations between paths and stream. fillStreams ( streams ); } // // Fill module information and store them in a std::vector array. // void Level3Accountant::fillModules( AppFramework *framework ) { AppModule **theModule; L3Module *module; // make an iteration of all modules in the framework. APPList *modules = framework->modules(); APPListIterator theModuleIter ( *modules ); // Loop over all the modules in the framework while ( theModule = theModuleIter( ) ) { if ( (*theModule)->isEnabled( ) ) { // ignore disabled modules module = new L3Module(); // declare a new L3Module. module->setName( (*theModule)->name() ); module->setIndex( _nModules++ ); // append the module to the module List. moduleList.push_back( *module ); delete module; // release allocated memory } } } // // Fill path information and store them in to std::vector arrays. // void Level3Accountant::fillPaths( AppFramework *framework, APPLevel3GenericOutputModule* theLevel3OutputModule ) { APPPath **thePath; APPExecNode** theNode; APPSequenceNode** theSeqNode; L3Path *path; L3ModulesInAPath *modulesInAPath; L3ModuleToPath *moduleToPath; // this puts dummy valuse for Path ID, Trigger name and data sets... // I use this for test. Whenever those infos are ready, this will be // set with correct information. 3/14/2001 YSC //bool debugThis = true; //make an iteration of all paths in the framework. APPList *paths = framework->paths(); APPListIterator thePathIter ( *paths ); std::vector::iterator theModule; //Loop over all the paths in the framework while ( thePath = thePathIter( ) ) { if ( (*thePath)->isEnabled( ) ) { //Ignore disabled paths path = new L3Path(); //Declare a new L3Path to insert. path->setName( (*thePath)->name() ); path->setIndex( _nPaths++ ); if ( theLevel3OutputModule != NULL ) { AbsParmList::ConstIterator tl1Name = theLevel3OutputModule->_L1TriggerNames.begin(); AbsParmList::ConstIterator tl2Name = theLevel3OutputModule->_L2TriggerNames.begin(); AbsParmList::ConstIterator tl3Name = theLevel3OutputModule->_L3PathNames.begin(); AbsParmList::ConstIterator tl1Bit = theLevel3OutputModule->_L1TriggerBits.begin(); AbsParmList::ConstIterator tl2Bit = theLevel3OutputModule->_L2TriggerBits.begin(); AbsParmList::ConstIterator tl3Bit = theLevel3OutputModule->_L3PathBits.begin(); AbsParmList::ConstIterator tl1Id = theLevel3OutputModule->_L1TriggerIds.begin(); AbsParmList::ConstIterator tl2Id = theLevel3OutputModule->_L2TriggerIds.begin(); AbsParmList::ConstIterator tl3Id = theLevel3OutputModule->_L3PathIds.begin(); AbsParmList::ConstIterator dataSetName = theLevel3OutputModule->_L3PathDatasetNames.begin(); AbsParmList::ConstIterator dataSetId = theLevel3OutputModule->_L3PathDatasetIds.begin(); int size = theLevel3OutputModule->_L3PathNames.size(); for (int index=0; indexname() == L3Name ) { path->setUniqueId( L3Id ); // name id bit path->setL1Trigger( L3Name,L3Id,L3Bit ); path->setL2Trigger( L3Name,L3Id,L3Bit ); path->setL3Trigger( L3Name,L3Id,L3Bit ); //path->setDataSets( dataSetName, dataSetId ); } } // end of setting Trigger Information. } // information gleaned from outputmodule // append the path to the Path List. pathList.push_back( *path ); //Declare a new L3ModulesInAPath to insert. modulesInAPath = new L3ModulesInAPath(); // loop over all modules in the path. APPListIterator theNodeIter(*((*thePath)->nodes())); // we need this for Filter Type of module. APPListIterator theSeqIter ( *((*thePath)->seqNodes()) ); // loop over all modules in the path. while ( theNode = theNodeIter( ) ) { theSeqNode = theSeqIter(); // Sequencd Node. // declare a new L3ModuleToPath to inset moduleToPath = new L3ModuleToPath(); theModule=moduleList.begin(); while (theModule != moduleList.end() ) { if ( theModule->moduleName() == (*theNode)->target()->name() ) {// module index = moduleIndex in the L3ModuleToPath moduleToPath->setIndex( theModule->moduleIndex() ); } theModule++; } // Filter Type for each module. // 1/2/3 = notAFilter/activeFilter/vetoFilter if ( (*theSeqNode)->mask() == 100 ) moduleToPath->setType( moduleToPath->activeFilter ); else if ( (*theSeqNode)->mask() == 200 ) moduleToPath->setType( moduleToPath->notAFilter ); else if ( (*theSeqNode)->mask() == 300 ) moduleToPath->setType( moduleToPath->vetoFilter ); else std::cout << "Error on assigning Filter Type " << std::endl; // path Index in the L3ModulesInAPath modulesInAPath->setIndex( path->pathIndex() ); // append moduletopath to the ModulesInAPath list. //modulesInAPath->setAssociations(moduleToPath); modulesInAPath->moduleAssociations.push_back( *moduleToPath ); delete moduleToPath; // release allocated memory } // append the modulesInAPath to the L3PathsToModules. pathModuleMap.associations.push_back(*modulesInAPath); delete modulesInAPath; // release allocated memory delete path; // release allocated memory } } } // // Stores the stream information and paths<->streams associations. // void Level3Accountant::fillStreams( APPList* streams ) { AppStream **theStream; APPPath **thePath; L3Stream *stream; L3PathsInAStream *pathsInAStream; std::vector::iterator theL3Path; L3Index *pathIndex; // make a stream iteration. APPListIterator theStreamIter( *streams ); // Loop over all streams in the framework while ( theStream = theStreamIter() ) { stream = new L3Stream(); // declare a new Stream class. stream->setName( (*theStream)->name() ); stream->setIndex( _nStreams++ ); // append the stream to the Stream List. streamList.push_back( *stream ); pathsInAStream = new L3PathsInAStream(); // declare a new pathsInAStream // make an iteration of paths in the Stream APPListIterator thePathIter ( *((*theStream)->paths()) ); // loop over all the paths in the stream while ( thePath = thePathIter() ) { // Index L3PathsInAStream using stream Index pathsInAStream->setIndex( stream->streamIndex() ); theL3Path=pathList.begin(); // loop over all paths in the pathList. while ( theL3Path != pathList.end() ) { if ( theL3Path->pathName() == (*thePath)->name() ) { // append the pathIndex to the path list in the Stream. pathIndex = new L3Index; // declare for path index. *pathIndex = theL3Path->pathIndex(); //pathsInAStream->setPathIndices( pathIndex ); pathsInAStream->pathIndices.push_back(*pathIndex); delete pathIndex; // release allocated memory } theL3Path++; } } // append the L3PathsInAStream to the L3StreamsToPaths. //streamPathMap.setAssociations( pathsInAStream ); streamPathMap.associations.push_back(*pathsInAStream); delete pathsInAStream; // release allocated memory delete stream; // release allocated memory } } // Fill the L3Result and L3Summary for module and path. // Module index = the number from framework // // executed, passed, and cpuTime of each module. // void Level3Accountant::fillResult( AppFramework *framework ) { APPPath **thePath, **thePath2; APPSequenceNode **theSeqNode, **theSeqNode2; AppModule **theModule; APPExecNode** theNode; resetModuleResults(); // clear moduleResults. L3Result *result; L3Index nPaths = -1; // initialize path count = -1 _nEvents++; // to store executed module in the L3Result only once for each event. bool* first = new bool[ _nModules ]; for ( int imod=0; imod<_nModules; imod++ ) first[imod] = true; // initialize to true. APPList *paths = framework->paths(); APPList *modules = framework->modules(); APPListIterator thePathIter ( *paths ); // loop over all paths in the framework. while ( thePath = thePathIter() ) { // Initially set the Path pass flag = true bool passedThisPath = true; if ( (*thePath)->isEnabled( ) ) { //Ignore disabled paths nPaths++; // Path count. ++nPathTrys[nPaths]; // number of times this path tried. APPListIterator theSeqNodeIter ( *((*thePath)->seqNodes()) ); APPListIterator theNodeIter ( *((*thePath)->nodes()) ); // loop over all modules in the path. while ( theSeqNode = theSeqNodeIter() ) { theNode = theNodeIter(); APPListIterator theModuleIter ( *modules ); L3Index nModules = -1; while ( theModule = theModuleIter() ) { if ( (*theModule)->isEnabled() ) { nModules++; // Module Count. if ( (*theModule)->name() == (*theNode)->target()->name() ) { // executed and passed infos. // use Query flag rather than executed flag. 8/31/01 YSC //if ( (*theSeqNode)->isExecThisEvent() ) // executed only if ( (*theSeqNode)->isQueryThisEvent() ) { result = new L3Result(); // declare a new L3Result result->setPathIndex( nPaths ); // path Index result->setModuleIndex( nModules ); // module Index //result->setExecInfo( (*theSeqNode)->isExecThisEvent() ); result->setExecInfo( (*theSeqNode)->isQueryThisEvent() ); result->setPassInfo( (*theSeqNode)->passedThisEvent() ); result->setCpuTime ( writeTimingInfo(framework,(*theModule)->name()) ); if ( result->moduleCpuTime() < 0.0 ) // Error !!! std::cout << "ERROR :: Wrong cpuTime for " << (*theModule)->name() << std::endl; // Accumulate cpuTime to the total cpuTime if ( (*theSeqNode)->isExecThisEvent() ) { // use only executed modules. once per event. ++nModuleTrys[nModules]; // module cpu time for run summary moduleCputime[nModules] += result->moduleCpuTime(); // path CPU time for run summary pathCputime[nPaths] += result->moduleCpuTime(); } // append each module result only once in each event. //if ( first[nModules] ) { moduleResults.push_back( *result ); // first[nModules] = false; //} delete result; // release allocate memory } if ( (*theSeqNode)->passedThisEvent() ) { // module pass info : executed and passed => pass if ( (*theSeqNode)->isExecThisEvent() ) ++nModulePasses[nModules]; } // all modules in path pass => pass path. else passedThisPath = false; } } } } // The number of times the path passed. if ( passedThisPath ) ++nPathPasses[nPaths]; // The second path to make Path vs Path L3Index nSecondPaths = -1; // initialize the count = -1 APPListIterator thePathIter2 ( *paths ); // Loop over all paths in the framework. while ( thePath2 = thePathIter2() ) { bool passedThisPath2 = true; // initialize Path flag = true if ( (*thePath2)->isEnabled( ) ) { //Ignore disabled paths ++nSecondPaths; // 2nd Path count APPListIterator theNodeIter2 ( *((*thePath2)->seqNodes()) ); //loop over all modules in the path. while ( theSeqNode2 = theNodeIter2() ) { if ( !((*theSeqNode2)->passedThisEvent()) ) passedThisPath2 = false; // all modules pass = path pass } ++nPathVsPathTrys[nPaths][nSecondPaths]; // number of times PathVsPath passed. if ( passedThisPath && passedThisPath2 ) ++nPathVsPathPasses[nPaths][nSecondPaths]; } } } } delete [] first; } // // This method is called once per event. It stores the cpuTime for // each module // float Level3Accountant::writeTimingInfo( AppFramework *framework, std::string modName ) { APPListIterator iter ( *(framework->actions()) ); AppAction **action; float cpuTime = 0.0; // Loop over all the event's actions while ( action = iter() ) { // If the name is framework default "Timer Action", we know we have times if ( (*action)->name() == "Timer Action") { // Dynamically cast action to AppActionTime AppActionTime *timer = dynamic_cast(*action); // Declare a map iterator to loop over all the mods TimerMap::const_iterator imod; // Get the reference to the event timer const TimerMap& eventMap = timer->eventTimers( ); // Find that name in the list of timers imod = eventMap.begin(); while ( imod != eventMap.end() ) { if ( imod != eventMap.end() && (*imod).first == modName ) { ZMdualTimer tim = (*imod).second; cpuTime = tim.cpuTime(); break; } else { imod++; cpuTime = -1.; } } } } return cpuTime; } //----------------------- // Member Functions. //------------------------ // // Fill the L3Result and L3Summary for module and path. // Module index = the number from framework // // executed, passed, and cpuTime of each module. // void Level3Accountant::fillStorableObject( AppFramework *framework ) { APPPath **thePath; APPSequenceNode **theSeqNode; AppModule **theModule; APPExecNode** theNode; resetModuleResults(); // clear moduleResults. L3Result *result; L3Index nPaths = -1; // initialize path count = -1 // to store executed module in the L3Result only once for each event. APPList *paths = framework->paths(); APPList *modules = framework->modules(); APPListIterator thePathIter ( *paths ); // loop over all paths in the framework. while ( thePath = thePathIter() ) { if ( (*thePath)->isEnabled( ) ) { //Ignore disabled paths nPaths++; // Path count. APPListIterator theSeqNodeIter ( *((*thePath)->seqNodes()) ); APPListIterator theNodeIter ( *((*thePath)->nodes()) ); // loop over all modules in the path. while ( theSeqNode = theSeqNodeIter() ) { theNode = theNodeIter(); L3Index nModules = -1; APPListIterator theModuleIter ( *modules ); while ( theModule = theModuleIter() ) { if ( (*theModule)->isEnabled() ) { nModules++; // Module Count. if ( (*theModule)->name() == (*theNode)->target()->name() ) { // executed and passed infos. if ( (*theSeqNode)->isExecThisEvent() ) { // executed module only result = new L3Result(); // declare a new L3Result result->setPathIndex( nPaths ); // path Index result->setModuleIndex( nModules ); // module Index result->setExecInfo( (*theSeqNode)->isExecThisEvent() ); result->setPassInfo( (*theSeqNode)->passedThisEvent() ); if ( _monitorCpuTime ) { result->setCpuTime (writeTimingInfo(framework,(*theModule)->name())); if ( result->moduleCpuTime() < 0.0 ) // Error !!! std::cout << "ERROR :: Wrong cpuTime on " << (*theModule)->name() << std::endl; } // append each module result only once in each event. moduleResults.push_back( *result ); delete result; // release allocate memory } } } } } } } } // // Fill end run Results. // void Level3Accountant::fillRunSummary( ) { //----------------------- // Module Summary //----------------------- L3Summary *summary; // loop over all modules. for ( int im=0; imsetIndex( im ); summary->setnTrys( nModuleTrys[im] ); summary->setnPasses( nModulePasses[im] ); summary->setTotalCpu( moduleCputime[im] ); //append the module results in the list of moduleResults. moduleSummaries.push_back( *summary ); delete summary; // release L3Summary allocated memory } //----------------------------------- // Path and Path vs Path Summaries //----------------------------------- L3Summary *pathSummary; L3Summary2D *summary2D; // Loop over results of all Paths. for (int ip=0; ipsetIndex( ip ); // path index pathSummary->setnTrys( nPathTrys[ip] ); // number of trials pathSummary->setnPasses( nPathPasses[ip] ); // passes pathSummary->setTotalCpu( pathCputime[ip] ); // cpuTime //append path results to the pathResults list. pathSummaries.push_back( *pathSummary ); // loop over all 2nd paths for (int ip2=0; ip2setFirstIndex( ip ); // 1st path index summary2D->setSecondIndex(ip2 ); // 2nd path index summary2D->setnJointTrys( nPathVsPathTrys[ip][ip2] ); summary2D->setnJointPasses( nPathVsPathPasses[ip][ip2] ); //append the path results to the PathVsPath List. pathVsPath.push_back( *summary2D ); delete summary2D; // release allocated memory } delete pathSummary; // release allocated memory } } // // for global initialization for run summary. // void Level3Accountant::initialize( AppFramework *framework ) { // //============================================================== // initilize data in the L3Summary //============================================================== // if ( nPathTrys == 0) nPathTrys = new long[ _nPaths ]; if ( nPathPasses == 0) nPathPasses = new long[ _nPaths ]; if ( pathCputime == 0) pathCputime = new float[ _nPaths ]; if ( nModuleTrys == 0) nModuleTrys = new long[ _nModules ]; if ( nModulePasses == 0) nModulePasses= new long[ _nModules ]; if ( moduleCputime == 0) moduleCputime= new float[ _nModules ]; if ( nPathVsPathPasses == 0 && _nPaths>0 ) { nPathVsPathPasses = new long*[ _nPaths ]; for ( int i=0; i<_nPaths; i++) nPathVsPathPasses[i] = new long[ _nPaths ]; } if ( nPathVsPathTrys == 0 && _nPaths>0 ) { nPathVsPathTrys = new long*[ _nPaths ]; for ( int i=0; i<_nPaths; i++) nPathVsPathTrys[i] = new long[ _nPaths ]; } // // Initialize L3Summary for modules. // for ( int im=0; im<_nModules; im++ ) { nModuleTrys[im] = 0; nModulePasses[im] = 0; moduleCputime[im] = 0.0; } // // Initialize L3Summary for Paths and nPasses for PathVsPath. // for ( int ip=0; ip<_nPaths; ip++ ) { nPathTrys[ip] = 0; nPathPasses[ip] = 0; pathCputime[ip] = 0.0; for ( int ip2=0; ip2<_nPaths; ip2++) { nPathVsPathTrys[ip][ip2] = 0; nPathVsPathPasses[ip][ip2] = 0; } } } // Clear moduleResult std::vector elements. void Level3Accountant::resetModuleResults() { // If moduleResult, std::vector exists, remove all its elements. if ( !moduleResults.empty() ) moduleResults.clear(); }