ATLAS Offline Software
TrigCostAuditor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "GaudiKernel/ThreadLocalContext.h"
6 
8 #include "TrigCostSvc.h"
9 
10 
12 
13 TrigCostAuditor::TrigCostAuditor(const std::string& name, ISvcLocator* pSvcLocator) :
14 Auditor(name, pSvcLocator),
16 {
17  ATH_MSG_DEBUG("TrigCostAuditor constructor");
18 }
19 
20 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
21 
23  ATH_MSG_DEBUG("TrigCostAuditor initialize()");
24  ATH_CHECK( m_trigCostSvcHandle.retrieve() );
25  return StatusCode::SUCCESS;
26 }
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
29 
31  ATH_MSG_DEBUG("TrigCostAuditor finalize()");
32  return StatusCode::SUCCESS;
33 }
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
36 
37 void TrigCostAuditor::before(StandardEventType evt, const std::string& caller) {
38  if (evt != StandardEventType::Execute) return; // I only care for execution time
39  ATH_MSG_DEBUG("Before Execute: " << caller);
40  callService(caller, ITrigCostSvc::AuditType::Before);
41 
42 }
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
45 
46 void TrigCostAuditor::after(StandardEventType evt, const std::string& caller, const StatusCode& sc) {
47  if (evt != StandardEventType::Execute) return; // I only care for execution time
48  ATH_MSG_DEBUG("After Execute: " << caller << " " << sc);
49  callService(caller, ITrigCostSvc::AuditType::After);
50 }
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
53 
54 void TrigCostAuditor::callService(const std::string& caller, ITrigCostSvc::AuditType type) {
55  // Note: Using ThreadLocalContext.h, better would be for the auditor to be told the Context
56  if (m_trigCostSvcHandle->processAlg(Gaudi::Hive::currentContext(), caller, type).isFailure()) {
57  ATH_MSG_FATAL("Error in TrigCostSvc called by TrigCostAuditor, auditing algorithm: " << caller);
58  throw std::runtime_error("TrigCostAuditor exception");
59  }
60 }
61 
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
64 
65 
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
TrigCostAuditor::callService
void callService(const std::string &caller, ITrigCostSvc::AuditType type)
Performs internal call to the trigger cost service.
Definition: TrigCostAuditor.cxx:54
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TrigCostAuditor::before
virtual void before(StandardEventType evt, const std::string &caller) override
Audit before an algorithm standard event type is called.
Definition: TrigCostAuditor.cxx:37
LArPulseShapeRunConfig.Execute
Execute
Definition: LArPulseShapeRunConfig.py:62
TrigCostAuditor::initialize
virtual StatusCode initialize() override
Initialise auditor.
Definition: TrigCostAuditor.cxx:22
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigCostAuditor::m_trigCostSvcHandle
ServiceHandle< ITrigCostSvc > m_trigCostSvcHandle
Definition: TrigCostAuditor.h:83
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrigCostSvc.h
TrigCostAuditor.h
TrigCostAuditor::TrigCostAuditor
TrigCostAuditor(const std::string &name, ISvcLocator *svcloc)
< Inherit CustomEventType as a noop
Definition: TrigCostAuditor.cxx:13
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ITrigCostSvc::AuditType
AuditType
Disambiguation enum for the start or the end of an algorithm's execution.
Definition: ITrigCostSvc.h:36
TrigCostAuditor::after
virtual void after(StandardEventType evt, const std::string &, const StatusCode &sc) override
Audit after an algorithm standard event type is called.
Definition: TrigCostAuditor.cxx:46
TrigCostAuditor::finalize
virtual StatusCode finalize() override
Does nothing.
Definition: TrigCostAuditor.cxx:30