ATLAS Offline Software
Loading...
Searching...
No Matches
SGAudSvc.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// SGAudSvc.h
6// Header file for class SGAudSvc
7// Author: Ilija Vukotic <ivukotic@cern.ch>
9#ifndef SGCOMPS_SGAUDSVC_H
10#define SGCOMPS_SGAUDSVC_H
11
12// STL includes
13#include <string>
14#include <iosfwd>
15#include <map>
16#include <set>
17#include <fstream>
18
19// FrameWork includes
21#include "GaudiKernel/ServiceHandle.h"
22#include "GaudiKernel/IIncidentListener.h"
23#include "GaudiKernel/IClassIDSvc.h"
24
26
27// Forward declaration
28class ISvcLocator;
29class IChronoStatSvc;
30class IAlgContextSvc;
31class AlgContextSvc;
32
33
42class SGAudSvc : public extends<AthService,
43 ISGAudSvc, IIncidentListener>
44{
45public:
46
48 SGAudSvc( const std::string& name, ISvcLocator* pSvcLocator );
49
51
52 virtual StatusCode initialize() override;
53 virtual StatusCode finalize() override;
55
58 virtual void handle( const Incident& incident ) override;
59
60 // do the auditing, called from DataStore.cxx
61 virtual void SGAudit(const std::string& key, const CLID& id,
62 const int& fnc, const int& store_id) override;
63
64
68 bool SGGetCurrentAlg();
72 virtual void setFakeCurrentAlg(const std::string&) override;
76 virtual void clearFakeCurrentAlg() override;
77
78 private:
79
82
83 void SGAudRETRIEVE(std::string SGobject);
84 void SGAudRECORD(std::string SGobject);
85
86 void getNobj(const std::string& name);
87 void addRead();
88 void addWrite();
89
91 void monitor();
92
93 void writeJSON();
94
96 // Private data:
98 private:
99
100 Gaudi::Property<std::string> m_outFileName{this, "OutFileName", "SGAudSvc.out",
101 "Name of the output file to hold SGAudSvc data"};
102
103 Gaudi::Property<std::string> m_allFileName{ "FullFileName", "",
104 "Name of the output file to hold the full SG aud data"};
105
106 Gaudi::Property<std::string> m_sumFileName{this, "SummaryFileName", "",
107 "Name of the output file to hold the summary output in json format"};
108
109 Gaudi::Property<bool> m_ignoreFakeAlgs{this, "IgnoreFakeAlgs", false,
110 "Set to ignore any attempts to override current-alg"};
111
112 Gaudi::Property<int> m_startEvent{this, "StartEvent", 3,
113 "Event number to start recording data"};
114
115 Gaudi::Property<bool> m_useCLID{this, "UseCLID", true,
116 "Use CLID or DataObj name in Summary File"};
117
121
123 std::vector<std::string> m_vObj;
125 std::vector<std::string> m_vAlg;
127 std::map<int,int> m_timesRead;
129 std::map<int,int> m_timesWritten;
130 std::string m_currAlg;
131 std::string m_currObj;
132 std::string m_fakeCurrAlg;
135 int m_nEvents{0};
136
137 // map<"alg_name", set<"cid/key"> >
138 typedef std::map<std::string, std::set<std::string> > DataMap;
141
142 std::ofstream m_ofa, m_ofs;
143 bool m_inExec{false};
144};
145
146#endif
uint32_t CLID
The Class ID type.
Gaudi::Property< std::string > m_outFileName
Definition SGAudSvc.h:100
bool m_inExec
Definition SGAudSvc.h:143
void addRead()
Definition SGAudSvc.cxx:356
std::string m_fakeCurrAlg
Definition SGAudSvc.h:132
std::string m_currObj
Definition SGAudSvc.h:131
virtual void setFakeCurrentAlg(const std::string &) override
For implementing custom increased granularity auditing of for instance tools.
Definition SGAudSvc.cxx:386
std::string m_currAlg
Definition SGAudSvc.h:130
std::map< int, int > m_timesWritten
map counting Writes of each object by each algorithm.
Definition SGAudSvc.h:129
void SGAudRECORD(std::string SGobject)
Definition SGAudSvc.cxx:205
DataMap m_write
Definition SGAudSvc.h:140
std::map< int, int > m_timesRead
map counting Reads of each object by each algorithm.
Definition SGAudSvc.h:127
virtual void SGAudit(const std::string &key, const CLID &id, const int &fnc, const int &store_id) override
Definition SGAudSvc.cxx:226
void monitor()
just counts events. called at EndEvent incident
Definition SGAudSvc.cxx:173
bool SGGetCurrentAlg()
Gets name of curently running algorithm from AlgContextSvc.
Definition SGAudSvc.cxx:301
void SGAudRETRIEVE(std::string SGobject)
Definition SGAudSvc.cxx:181
Gaudi::Property< bool > m_useCLID
Definition SGAudSvc.h:115
std::ofstream m_ofs
Definition SGAudSvc.h:142
virtual StatusCode initialize() override
Gaudi Service Implementation.
Definition SGAudSvc.cxx:52
int m_nCurrObj
Definition SGAudSvc.h:134
int m_nEvents
Definition SGAudSvc.h:135
SGAudSvc()
Default constructor:
virtual void clearFakeCurrentAlg() override
For implementing custom increased granularity auditing of for instance tools.
Definition SGAudSvc.cxx:391
ServiceHandle< IClassIDSvc > m_pCID
Definition SGAudSvc.h:120
std::vector< std::string > m_vAlg
Vector of names of algorithms accessing SG.
Definition SGAudSvc.h:125
int m_nCurrAlg
Definition SGAudSvc.h:133
Gaudi::Property< std::string > m_sumFileName
Definition SGAudSvc.h:106
virtual void handle(const Incident &incident) override
incident service handle for EndEvent.
Definition SGAudSvc.cxx:136
DataMap m_read
Definition SGAudSvc.h:139
SGAudSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition SGAudSvc.cxx:39
void writeJSON()
Definition SGAudSvc.cxx:396
std::map< std::string, std::set< std::string > > DataMap
Definition SGAudSvc.h:138
Gaudi::Property< int > m_startEvent
Definition SGAudSvc.h:112
void getNobj(const std::string &name)
Definition SGAudSvc.cxx:336
virtual StatusCode finalize() override
Definition SGAudSvc.cxx:81
Gaudi::Property< bool > m_ignoreFakeAlgs
Definition SGAudSvc.h:109
void addWrite()
Definition SGAudSvc.cxx:371
std::vector< std::string > m_vObj
Vector of accessed SG objects names.
Definition SGAudSvc.h:123
std::ofstream m_ofa
Definition SGAudSvc.h:142
Gaudi::Property< std::string > m_allFileName
Definition SGAudSvc.h:103
ServiceHandle< IAlgContextSvc > p_algCtxSvc
Pointer to the AlgContextScv.
Definition SGAudSvc.h:119