| The Gaudi Framework v28r2-patches (bc4ad17a)

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

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

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 <src/AlgErrorAuditor.h>`

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

## Public Member Functions
| ~AlgErrorAuditor () override=default
StatusCode | initialize () override
StatusCode | finalize () override
void | beforeExecute (INamedInterface *alg) override
void | afterExecute (INamedInterface *alg, const StatusCode &) override
Public Member Functions inherited from Auditor
| Auditor (const std::string &name, ISvcLocator *svcloc)
| Constructor. More...
| Auditor (const Auditor &a)=delete
Auditor & | operator= (const Auditor &rhs)=delete
StatusCode | sysInitialize () override
| Initialization method invoked by the framework. More...
StatusCode | sysFinalize () override
| Finalization method invoked by the framework. More...
void | before (StandardEventType, INamedInterface *) override
| The following methods are meant to be implemented by the child class... More...
void | before (StandardEventType, const std::string &) override
void | before (CustomEventTypeRef, INamedInterface *) override
void | before (CustomEventTypeRef, const std::string &) override
void | after (StandardEventType, INamedInterface *, const StatusCode &) override
void | after (StandardEventType, const std::string &, const StatusCode &) override
void | after (CustomEventTypeRef, INamedInterface *, const StatusCode &) override
void | after (CustomEventTypeRef, const std::string &, const StatusCode &) override
void | beforeInitialize (INamedInterface *) override
void | afterInitialize (INamedInterface *) override
void | beforeReinitialize (INamedInterface *) override
void | afterReinitialize (INamedInterface *) override
void | beforeExecute (INamedInterface *) override
void | afterExecute (INamedInterface *, const StatusCode &) override
void | beforeFinalize (INamedInterface *) override
void | afterFinalize (INamedInterface *) override
void | beforeBeginRun (INamedInterface *) override
void | afterBeginRun (INamedInterface *) override
void | beforeEndRun (INamedInterface *) override
void | afterEndRun (INamedInterface *) override
const std::string & | name () const override
bool | isEnabled () const override
SmartIF< ISvcLocator > & | serviceLocator () const override
| The standard service locator. More...
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. More...
template<class T = IService>
SmartIF< T > | service (const std::string &name, bool createIf=false) const
StatusCode | setProperties ()
| Set the auditor's properties. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...

## Private Member Functions
void | incrMap (const std::string &algName, int level)

## Private Attributes
Gaudi::Property< bool > | m_abort {this, "Abort", false, "abort job upon illegal Algorithm return code"}
Gaudi::Property< bool > | m_throw {this, "Throw", false, "throw GaudiException upon illegal Algorithm return code"}
int | m_error = 0
int | m_fatal = 0
std::map< std::string, int > | m_algMap [2]

## Additional Inherited Members
Public Types inherited from Auditor
typedef Gaudi::PluginService::Factory< IAuditor *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IAuditor, IProperty > >
using | base_class = CommonMessaging
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IAuditor, IProperty > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## 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 | ( |  | ) |
| override default

## Member Function Documentation

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

Definition at line 27 of file AlgErrorAuditor.cpp.

27 {
28
29 bool fail(false);
30 if (msgSvc()->messageCount(MSG::ERROR) != m_error && ! sc.isRecoverable() ) {
31 std::ostringstream os;
32 os << "Illegal Return Code: Algorithm " << alg->name()
33 << " reported an ERROR, but returned a StatusCode \"" << sc << "\"";
34 os << std::endl << "Error policy described in "
35 << "https://twiki.cern.ch/twiki/bin/view/AtlasComputing/ReportingErrors";
36
37 error() << os.str() << endmsg;
38 incrMap(alg->name(), 0);
39 fail = true;
40
41 if (m_throw && ! m_abort) {
42 throw GaudiException(os.str(),"AlgErrorAuditor",0);
43 }
44 }
45
46 if (msgSvc()->messageCount(MSG::FATAL) != m_fatal &&
47 sc != StatusCode::FAILURE ) {
48 std::ostringstream os;
49 os << "Illegal Return Code: Algorithm " << alg->name()
50 << " reported a FATAL, but returned a StatusCode \"" << sc << "\"";
51 os << std::endl << "Error policy described in "
52 << "https://twiki.cern.ch/twiki/bin/view/AtlasComputing/ReportingErrors";
53
54 error() << os.str() << endmsg;
55 incrMap(alg->name(), 1);
56 fail = true;
57
58 if (m_throw && ! m_abort) {
59 throw GaudiException(os.str(),"AlgErrorAuditor",0);
60 }
61
62 }
63
64 if (fail && m_abort) {
65 abort();
66 }
67
68 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
StatusCode::FAILURE
Definition: StatusCode.h:29
IMessageSvc::messageCount
virtual int messageCount(MSG::Level level) const =0
Get the number of messages issued at a particular level.
std::endl
T endl(T...args)
AlgErrorAuditor::m_error
int m_error
Definition: AlgErrorAuditor.h:33
MSG::FATAL
Definition: IMessageSvc.h:22
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
AlgErrorAuditor::incrMap
void incrMap(const std::string &algName, int level)
Definition: AlgErrorAuditor.cpp:100
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)
AlgErrorAuditor::m_fatal
int m_fatal
Definition: AlgErrorAuditor.h:34
StatusCode::isRecoverable
bool isRecoverable() const
Definition: StatusCode.h:85
AlgErrorAuditor::m_abort
Gaudi::Property< bool > m_abort
Definition: AlgErrorAuditor.h:28
AlgErrorAuditor::m_throw
Gaudi::Property< bool > m_throw
Definition: AlgErrorAuditor.h:29
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:70
MSG::ERROR
Definition: IMessageSvc.h:21
std::abort
T abort(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.

void AlgErrorAuditor::beforeExecute | ( | INamedInterface * | alg | ) |
| override

Definition at line 9 of file AlgErrorAuditor.cpp.

9 {
10 m_error = msgSvc()->messageCount(MSG::ERROR);
11 m_fatal = msgSvc()->messageCount(MSG::FATAL);
12 }
IMessageSvc::messageCount
virtual int messageCount(MSG::Level level) const =0
Get the number of messages issued at a particular level.
AlgErrorAuditor::m_error
int m_error
Definition: AlgErrorAuditor.h:33
MSG::FATAL
Definition: IMessageSvc.h:22
AlgErrorAuditor::m_fatal
int m_fatal
Definition: AlgErrorAuditor.h:34
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:70
MSG::ERROR
Definition: IMessageSvc.h:21

StatusCode AlgErrorAuditor::finalize | ( |  | ) |
| override virtual

Reimplemented from Auditor.

Definition at line 71 of file AlgErrorAuditor.cpp.

71 {
72
73 if (m_algMap[0].size() != 0) {
74 info() << "Found " << m_algMap[0].size()
75 << " instances where an Algorithm::execute() produced an ERROR "
76 << "but returned a SUCCESS:" << std::endl;
77
78 for (const auto& i : m_algMap[0] ) {
79 msgStream() << i.first << ": " << i.second << std::endl;
80 }
81
82 msgStream() << endmsg;
83 }
84
85 if (m_algMap[1].size() != 0) {
86 info() << "Found " << m_algMap[1].size()
87 << " instances where an Algorithm::execute() produced a FATAL "
88 << "but returned a SUCCESS:" << std::endl;
89
90 for (const auto& i : m_algMap[1]) {
91 msgStream() << i.first << ": " << i.second << std::endl;
92 }
93
94 msgStream() << endmsg;
95 }
96 return StatusCode::SUCCESS;
97 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
AlgErrorAuditor::m_algMap
std::map< std::string, int > m_algMap[2]
Definition: AlgErrorAuditor.h:36
std::endl
T endl(T...args)
std::map::size
T size(T...args)
CommonMessagingBase::msgStream
MsgStream & msgStream() const
Return an uninitialized MsgStream.
Definition: CommonMessaging.h:88
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

void AlgErrorAuditor::incrMap | ( | const std::string & | algName,
|  | int | level
| ) |  |
| private

Definition at line 100 of file AlgErrorAuditor.cpp.

100 {
101 auto i=m_algMap[level].find(alg);
102 if ( i != m_algMap[level].end()) {
103 i->second++;
104 } else {
105 m_algMap[level].emplace( alg,1 );
106 }
107 }
AlgErrorAuditor::m_algMap
std::map< std::string, int > m_algMap[2]
Definition: AlgErrorAuditor.h:36
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:50
std::map::find
T find(T...args)
std::map::emplace
T emplace(T...args)
gaudirun.level
level
Definition: gaudirun.py:261

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

Reimplemented from Auditor.

Definition at line 15 of file AlgErrorAuditor.cpp.

15 {
16
17 if (m_abort && m_throw) {
18 info() << "Both \"Throw\" and \"Abort\" options have been set."
19 << " Abort takes precedence." << endmsg;
20 }
21
22 return StatusCode::SUCCESS;
23 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
AlgErrorAuditor::m_abort
Gaudi::Property< bool > m_abort
Definition: AlgErrorAuditor.h:28
AlgErrorAuditor::m_throw
Gaudi::Property< bool > m_throw
Definition: AlgErrorAuditor.h:29
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

## Member Data Documentation

Gaudi::Property<bool> AlgErrorAuditor::m_abort {this, "Abort", false, "abort job upon illegal Algorithm return code"}
| private

Definition at line 28 of file AlgErrorAuditor.h.

std::map<std::string, int> AlgErrorAuditor::m_algMap[2]
| private

Definition at line 36 of file AlgErrorAuditor.h.

int AlgErrorAuditor::m_error = 0
| private

Definition at line 33 of file AlgErrorAuditor.h.

int AlgErrorAuditor::m_fatal = 0
| private

Definition at line 34 of file AlgErrorAuditor.h.

Gaudi::Property<bool> AlgErrorAuditor::m_throw {this, "Throw", false, "throw GaudiException upon illegal Algorithm return code"}
| private

Definition at line 29 of file AlgErrorAuditor.h.

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

- GaudiAud/src/AlgErrorAuditor.h
- GaudiAud/src/AlgErrorAuditor.cpp