ATLAS Offline Software
FPEAuditor.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // FPEAuditor.h
8 // Header file for class FPEAuditor
9 // Author: S.Binet<binet@cern.ch>
11 #ifndef ATHENASERVICES_FPEAUDITOR_H
12 #define ATHENASERVICES_FPEAUDITOR_H 1
13 
14 // STL includes
15 #include <string>
16 #include <list>
17 #include <utility> // for std::pair
18 #include <atomic>
19 
20 // FrameWork includes
21 #include "GaudiKernel/Auditor.h"
24 
25 
26 #include <signal.h>
27 #include <fenv.h>
28 
29 // Forward declaration
30 class INamedInterface;
31 
32 
33 class FPEAuditor : public AthCommonMsg<Auditor>
34 {
35  using Auditor::before;
36  using Auditor::after;
37 
39  // Public methods:
41  public:
42 
44  FPEAuditor(const std::string& name, ISvcLocator* pSvcLocator);
45 
47  virtual ~FPEAuditor();
48 
50  virtual StatusCode initialize() override;
51 
52  virtual StatusCode finalize() override;
53 
54 
55  // standard event auditing...
56  virtual void before(StandardEventType evt, INamedInterface* comp) override;
57  virtual void after(StandardEventType evt, INamedInterface* comp, const StatusCode& sc) override;
58 
59  // custom event auditing...
60 
62  virtual void before(IAuditor::CustomEventTypeRef evt,
63  INamedInterface* caller) override
64  { return this->before (evt, caller->name()); }
65 
70  virtual void before (IAuditor::CustomEventTypeRef evt,
71  const std::string& caller) override;
72 
74  virtual void after (IAuditor::CustomEventTypeRef evt,
75  INamedInterface* caller,
76  const StatusCode& sc) override
77  { return this->after (evt, caller->name(), sc); }
78 
83  virtual void after (CustomEventTypeRef evt, const std::string& caller,
84  const StatusCode& sc) override;
85 
87  // Private data:
89  private:
90 
93  void report_fpe(const std::string& step, const std::string& caller);
94 
97  void add_fpe_node();
98 
101  void pop_fpe_node();
102 
103  typedef std::pair<int,int> FpeNode_t;
104  typedef std::list<FpeNode_t> FpeStack_t;
107  static thread_local FpeStack_t s_fpe_stack;
108 
110 
111  std::atomic<unsigned int> m_CountFPEs[FPEAUDITOR_ARRAYSIZE];
112 
113  unsigned int m_NstacktracesOnFPE=0;
114 
115  unsigned int m_Nstacklines=100;
116 
117  void InstallHandler();
118 
119  void UninstallHandler();
120 
121  //fexcept_t m_flagp;
122 
124  fenv_t m_env;
125 
126  std::atomic<int> m_nexceptions;
127 };
128 
129 // I/O operators
131 
133 // Inline methods:
135 
136 #endif //> ATHENASERVICES_FPEAUDITOR_H
FPEAuditor
Definition: FPEAuditor.h:34
plotting.yearwise_luminosity_vs_mu.comp
comp
Definition: yearwise_luminosity_vs_mu.py:23
FPEAuditor::FpeNode_t
std::pair< int, int > FpeNode_t
Definition: FPEAuditor.h:103
AthCommonMsg.h
Templated class that provides backwards compatibility for legacy MsgService manipulation methods.
FPEAuditor::FPEAUDITOR_INVALID
@ FPEAUDITOR_INVALID
Definition: FPEAuditor.h:109
AthMsgStreamMacros.h
FPEAuditor::before
virtual void before(IAuditor::CustomEventTypeRef evt, INamedInterface *caller) override
Audit the start of a custom "event".
Definition: FPEAuditor.h:62
FPEAuditor::add_fpe_node
void add_fpe_node()
add an fpe node
Definition: FPEAuditor.cxx:292
FPEAuditor::before
virtual void before(StandardEventType evt, INamedInterface *comp) override
Definition: FPEAuditor.cxx:163
FPEAuditor::before
virtual void before(IAuditor::CustomEventTypeRef evt, const std::string &caller) override
Audit the start of a custom "event" for callers that do not implement the INamedInterface.
FPEAuditor::m_nexceptions
std::atomic< int > m_nexceptions
Definition: FPEAuditor.h:126
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
FPEAuditor::~FPEAuditor
virtual ~FPEAuditor()
Destructor.
Definition: FPEAuditor.cxx:84
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
FPEAuditor::report_fpe
void report_fpe(const std::string &step, const std::string &caller)
report fpes which happened during step 'step' on behalf of 'caller'
Definition: FPEAuditor.cxx:211
FPEAuditor::FPEAUDITOR_DIVBYZERO
@ FPEAUDITOR_DIVBYZERO
Definition: FPEAuditor.h:109
FPEAuditor::pop_fpe_node
void pop_fpe_node()
pop an fpe node
Definition: FPEAuditor.cxx:313
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FPEAuditor::FpeStack_t
std::list< FpeNode_t > FpeStack_t
Definition: FPEAuditor.h:104
FPEAuditor::after
virtual void after(StandardEventType evt, INamedInterface *comp, const StatusCode &sc) override
Definition: FPEAuditor.cxx:178
FPEAuditor::InstallHandler
void InstallHandler()
Definition: FPEAuditor.cxx:117
FPEAuditor::finalize
virtual StatusCode finalize() override
Definition: FPEAuditor.cxx:101
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
FPEAuditor::after
virtual void after(IAuditor::CustomEventTypeRef evt, INamedInterface *caller, const StatusCode &sc) override
Audit the end of a custom "event".
Definition: FPEAuditor.h:74
FPEAuditor::FPEAuditor
FPEAuditor(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: FPEAuditor.cxx:63
FPEAuditor::initialize
virtual StatusCode initialize() override
Gaudi hooks.
Definition: FPEAuditor.cxx:89
FPEAuditor::m_Nstacklines
unsigned int m_Nstacklines
Definition: FPEAuditor.h:115
AthCommonMsg
Definition: AthCommonMsg.h:19
LArCellBinning.step
step
Definition: LArCellBinning.py:158
FPEAuditor::m_CountFPEs
std::atomic< unsigned int > m_CountFPEs[FPEAUDITOR_ARRAYSIZE]
Definition: FPEAuditor.h:111
FPEAuditor::m_env
fenv_t m_env
The FP environment before we initialize.
Definition: FPEAuditor.h:124
FPEAuditor::s_fpe_stack
static thread_local FpeStack_t s_fpe_stack
a stack of FPE exceptions which have been raised
Definition: FPEAuditor.h:107
FPEAuditor::m_NstacktracesOnFPE
unsigned int m_NstacktracesOnFPE
Definition: FPEAuditor.h:113
FPEAuditor::FPEAUDITOR_ARRAYSIZE
@ FPEAUDITOR_ARRAYSIZE
Definition: FPEAuditor.h:109
FPEAuditor::FPEAUDITOR_OVERFLOW
@ FPEAUDITOR_OVERFLOW
Definition: FPEAuditor.h:109
FPEAuditor::UninstallHandler
void UninstallHandler()
Definition: FPEAuditor.cxx:150