Gaudi Framework, version v23r0 |
Home | Generated: Mon Jan 30 2012 |
Monitors the cpu time usage of each algorithm. More...
#include <AlgErrorAuditor.h>
Public Member Functions | |
AlgErrorAuditor (const std::string &name, ISvcLocator *pSvcLocator) | |
virtual | ~AlgErrorAuditor () |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
virtual void | beforeExecute (INamedInterface *alg) |
virtual void | afterExecute (INamedInterface *alg, const StatusCode &) |
Private Member Functions | |
void | incrMap (const std::string &algName, int level) |
Private Attributes | |
BooleanProperty | m_abort |
BooleanProperty | m_throw |
int | m_error |
int | m_fatal |
std::map< std::string, int > | m_algMap [2] |
Monitors the cpu time usage of each algorithm.
Definition at line 15 of file AlgErrorAuditor.h.
AlgErrorAuditor::AlgErrorAuditor | ( | const std::string & | name, |
ISvcLocator * | pSvcLocator | ||
) |
Definition at line 9 of file AlgErrorAuditor.cpp.
: Auditor(name, pSvcLocator), m_error(0), m_fatal(0) { declareProperty( "Abort", m_abort = false, "Abort job upon illegal Algorithm return code"); declareProperty( "Throw", m_throw = false, "Throw GaudiException upon illegal Algorithm return code"); }
AlgErrorAuditor::~AlgErrorAuditor | ( | ) | [virtual] |
Definition at line 18 of file AlgErrorAuditor.cpp.
{ }
void AlgErrorAuditor::afterExecute | ( | INamedInterface * | alg, |
const StatusCode & | sc | ||
) | [virtual] |
Reimplemented from Auditor.
Definition at line 42 of file AlgErrorAuditor.cpp.
{ bool fail(false); if (msgSvc()->messageCount(MSG::ERROR) != m_error && ! sc.isRecoverable() ) { std::ostringstream os; os << "Illegal Return Code: Algorithm " << alg->name() << " reported an ERROR, but returned a StatusCode \"" << sc << "\""; os << std::endl << "Error policy described in " << "https://twiki.cern.ch/twiki/bin/view/Atlas/ReportingErrors"; MsgStream log(msgSvc(), name()); log << MSG::ERROR << os.str() << endmsg; incrMap(alg->name(), 0); fail = true; if (m_throw && ! m_abort) { throw GaudiException(os.str(),"AlgErrorAuditor",0); } } if (msgSvc()->messageCount(MSG::FATAL) != m_fatal && sc != StatusCode::FAILURE ) { std::ostringstream os; os << "Illegal Return Code: Algorithm " << alg->name() << " reported a FATAL, but returned a StatusCode \"" << sc << "\""; os << std::endl << "Error policy described in " << "https://twiki.cern.ch/twiki/bin/view/Atlas/ReportingErrors"; MsgStream log(msgSvc(), name()); log << MSG::ERROR << os.str() << endmsg; incrMap(alg->name(), 1); fail = true; if (m_throw && ! m_abort) { throw GaudiException(os.str(),"AlgErrorAuditor",0); } } if (fail && m_abort) { abort(); } }
void AlgErrorAuditor::beforeExecute | ( | INamedInterface * | alg ) | [virtual] |
Reimplemented from Auditor.
Definition at line 23 of file AlgErrorAuditor.cpp.
{ m_error = msgSvc()->messageCount(MSG::ERROR); m_fatal = msgSvc()->messageCount(MSG::FATAL); }
StatusCode AlgErrorAuditor::finalize | ( | ) | [virtual] |
Reimplemented from Auditor.
Definition at line 88 of file AlgErrorAuditor.cpp.
{ std::map<std::string,int>::const_iterator itr; if (m_algMap[0].size() != 0) { MsgStream log(msgSvc(), name()); log << MSG::INFO << "Found " << m_algMap[0].size() << " instances where an Algorithm::execute() produced an ERROR " << "but returned a SUCCESS:" << std::endl; for (itr = m_algMap[0].begin(); itr != m_algMap[0].end(); ++itr) { log << itr->first << ": " << itr->second << std::endl; } log << endmsg; } if (m_algMap[1].size() != 0) { MsgStream log(msgSvc(), name()); log << MSG::INFO << "Found " << m_algMap[1].size() << " instances where an Algorithm::execute() produced a FATAL " << "but returned a SUCCESS:" << std::endl; for (itr = m_algMap[1].begin(); itr != m_algMap[1].end(); ++itr) { log << itr->first << ": " << itr->second << std::endl; } log << endmsg; } return StatusCode::SUCCESS; }
void AlgErrorAuditor::incrMap | ( | const std::string & | algName, |
int | level | ||
) | [private] |
Definition at line 124 of file AlgErrorAuditor.cpp.
StatusCode AlgErrorAuditor::initialize | ( | ) | [virtual] |
BooleanProperty AlgErrorAuditor::m_abort [private] |
Definition at line 27 of file AlgErrorAuditor.h.
std::map<std::string, int> AlgErrorAuditor::m_algMap[2] [private] |
Definition at line 34 of file AlgErrorAuditor.h.
int AlgErrorAuditor::m_error [private] |
Definition at line 31 of file AlgErrorAuditor.h.
int AlgErrorAuditor::m_fatal [private] |
Definition at line 32 of file AlgErrorAuditor.h.
BooleanProperty AlgErrorAuditor::m_throw [private] |
Definition at line 27 of file AlgErrorAuditor.h.