ATLAS Offline Software
Loading...
Searching...
No Matches
ValgrindAuditor.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef VALKYRIE_VALGRINDAUDITOR_H
6#define VALKYRIE_VALGRINDAUDITOR_H
7
8// STL/Boost includes
9#include <string>
10#include <vector>
11#include <utility>
12#include <boost/regex.hpp>
13
14// FrameWork includes
15#include "Gaudi/Auditor.h"
16#include "GaudiKernel/ServiceHandle.h"
17#include "GaudiKernel/IIncidentListener.h"
18#include "GAUDI_VERSION.h"
19
20// Forward declaration
21class INamedInterface;
22class IValgrindSvc;
23
33
34class ValgrindAuditor : public Gaudi::Auditor,
35 virtual public IIncidentListener
36{
37public:
38 ValgrindAuditor(const std::string& name, ISvcLocator* pSvcLocator);
39 virtual ~ValgrindAuditor();
40
41 virtual StatusCode initialize() override;
42
44 virtual void handle( const Incident& incident ) override;
45
47
48 virtual void before(const std::string& event, const std::string& name,
49 const EventContext& ctx) override;
50
51 virtual void after(const std::string& event, const std::string& name,
52 const EventContext& ctx, const StatusCode& sc) override;
54
55
57 virtual void do_beforeExecute(const std::string& name);
58
60 virtual void do_afterExecute(const std::string& name);
61
62public:
64 typedef std::pair<boost::regex,std::string> NameEvt;
65
66
67private:
70
72 std::vector<std::string> m_algs;
73
75 std::vector<std::string> m_intervals;
76
79
82
84 unsigned int m_eventCounter;
85
87 std::vector<boost::regex> m_algsRegEx;
88
90 std::vector< std::pair<NameEvt,NameEvt> > m_hooks;
91
92 void do_before(const std::string& name, const std::string& hook);
93 void do_after(const std::string& name, const std::string& hook);
94 StatusCode decodeIntervals();
95
96 bool algMatch(const std::string& name);
97};
98
99#endif
static Double_t sc
Abstract interface for ValgrindSvc.
virtual StatusCode initialize() override
ValgrindAuditor(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< std::string > m_algs
List of algorithms to profile.
StatusCode decodeIntervals()
unsigned int m_eventCounter
Internal event counter for BeginEvent incident.
void do_after(const std::string &name, const std::string &hook)
virtual void after(const std::string &event, const std::string &name, const EventContext &ctx, const StatusCode &sc) override
void do_before(const std::string &name, const std::string &hook)
std::vector< std::string > m_intervals
List of auditor intervals to profile.
std::pair< boost::regex, std::string > NameEvt
Typedef for algorithm/event pair, e.g. ("MyAlg","initialize")
virtual void handle(const Incident &incident) override
Incident handler.
virtual ~ValgrindAuditor()
bool algMatch(const std::string &name)
std::vector< std::pair< NameEvt, NameEvt > > m_hooks
Internal storage of intervals.
unsigned int m_ignoreFirstNEvents
Don't profile on the first N events.
bool m_dumpAfterEachInterval
Dump profile after each interval.
ServiceHandle< IValgrindSvc > m_valSvc
Handle to ValgrindSvc.
virtual void do_beforeExecute(const std::string &name)
Start callgrind instrumentation.
virtual void do_afterExecute(const std::string &name)
Stop callgrind instrumentation.
std::vector< boost::regex > m_algsRegEx
Regular expressions for algorithm name matching.
virtual void before(const std::string &event, const std::string &name, const EventContext &ctx) override