| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AlgErrorAuditor Class Reference

Monitors the cpu time usage of each algorithm. More...

`#include <AlgErrorAuditor.h>`

Inheritance diagram for AlgErrorAuditor:
[legend]
Collaboration diagram for AlgErrorAuditor:
[legend]

## 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 &)
Public Member Functions inherited from Auditor
| Auditor (const std::string &name, ISvcLocator *svcloc)
| Constructor.
virtual | ~Auditor ()
| Destructor.
StatusCode | sysInitialize ()
| Initialization method invoked by the framework.
StatusCode | sysFinalize ()
| Finalization method invoked by the framework.
virtual void | before (StandardEventType, INamedInterface *)
| The following methods are meant to be implemented by the child class...
virtual void | before (StandardEventType, const std::string &)
virtual void | before (CustomEventTypeRef, INamedInterface *)
virtual void | before (CustomEventTypeRef, const std::string &)
virtual void | after (StandardEventType, INamedInterface *, const StatusCode &)
virtual void | after (StandardEventType, const std::string &, const StatusCode &)
virtual void | after (CustomEventTypeRef, INamedInterface *, const StatusCode &)
virtual void | after (CustomEventTypeRef, const std::string &, const StatusCode &)
virtual void | beforeInitialize (INamedInterface *)
virtual void | afterInitialize (INamedInterface *)
virtual void | beforeReinitialize (INamedInterface *)
virtual void | afterReinitialize (INamedInterface *)
virtual void | beforeFinalize (INamedInterface *)
virtual void | afterFinalize (INamedInterface *)
virtual void | beforeBeginRun (INamedInterface *)
virtual void | afterBeginRun (INamedInterface *)
virtual void | beforeEndRun (INamedInterface *)
virtual void | afterEndRun (INamedInterface *)
virtual const std::string & | name () const
virtual bool | isEnabled () const
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
int | outputLevel () const
| Retrieve the output level of current auditor.
void | setOutputLevel (int level)
| Set the output level for current auditor.
SmartIF< ISvcLocator > & | serviceLocator () const
| The standard service locator.
template<class T >
StatusCode | service (const std::string &name, T *&svc, bool createIf=false) const
| Access a service by name, creating it if it doesn't already exist.
virtual StatusCode | setProperty (const Property &p)
| Set a value of a property of an auditor.
virtual StatusCode | setProperty (const std::string &s)
| Implementation of IProperty::setProperty.
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
| Implementation of IProperty::setProperty.
virtual StatusCode | getProperty (Property *p) const
| Get the value of a property.
virtual const Property & | getProperty (const std::string &name) const
| Get the property by name.
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
| Implementation of IProperty::getProperty.
const std::vector< Property * > & | getProperties () const
| Get all properties.
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
StatusCode | setProperties ()
| Set the auditor's properties.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.

## 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]

## Additional Inherited Members
Public Types inherited from Auditor
typedef Gaudi::PluginService::Factory2 < IAuditor *, const std::string &, ISvcLocator * > | Factory

## Detailed Description

Monitors the cpu time usage of each algorithm.

Author
  David Quarrie

Definition at line 15 of file AlgErrorAuditor.h.

## Constructor & Destructor Documentation

AlgErrorAuditor::AlgErrorAuditor | ( | const std::string & | name,
|  | ISvcLocator * | pSvcLocator
| ) |  |

Definition at line 8 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 17 of file AlgErrorAuditor.cpp.

{
}

## Member Function Documentation

void AlgErrorAuditor::afterExecute | ( | INamedInterface * | alg,
|  | const StatusCode & | sc
| ) |  |
| virtual

Reimplemented from Auditor.

Definition at line 41 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 22 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 87 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 123 of file AlgErrorAuditor.cpp.

{
std::map<std::string, int>::iterator itr;
if ( (itr=m_algMap[level].find(alg)) != m_algMap[level].end()) {
itr->second++;
} else {
m_algMap[level].insert( std::pair<std::string,int>(alg,1) );
}
}

StatusCode AlgErrorAuditor::initialize | ( |  | ) |
| virtual

Reimplemented from Auditor.

Definition at line 28 of file AlgErrorAuditor.cpp.

{
if (m_abort && m_throw) {
MsgStream log(msgSvc(), name());
log << MSG::INFO << "Both \"Throw\" and \"Abort\" options have been set."
<< " Abort takes precedence." << endmsg;
}
return StatusCode::SUCCESS;
}

## Member Data Documentation

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.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiAud/src/AlgErrorAuditor.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiAud/src/AlgErrorAuditor.cpp