| The Gaudi Framework v27r1

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

- File List
- File Members

ChronoStatSvc.h
Go to the documentation of this file.
1 #ifndef GAUDISVC_CHRONOSTATSVC_H__
2 #define GAUDISVC_CHRONOSTATSVC_H__
3 // ============================================================================
4 // include files
5 // ============================================================================
6 // STD & STL
7 // ============================================================================
8 #include <string>
9 #include <map>
10 #include <functional>
11 #include <fstream>
12 // ============================================================================
13 // GaudiKernel
14 // ============================================================================
15 #include "GaudiKernel/Kernel.h"
16 #include "GaudiKernel/Service.h"
17 #include "GaudiKernel/IChronoStatSvc.h"
18 #include "GaudiKernel/IIncidentListener.h"
19 // ============================================================================
21 // ============================================================================
22 class ISvcLocator ;
23 class IMessageSvc ;
24 // ============================================================================
33 class ChronoStatSvc: public extends<Service,
34 IChronoStatSvc,
35 IIncidentListener> {
36 public:
37 // ============================================================================
39 typedef std::map<IChronoStatSvc::ChronoTag,ChronoEntity> ChronoMap ;
40 typedef std::map<IChronoStatSvc::StatTag,StatEntity> StatMap ;
41 // ============================================================================
42 public:
43 // ============================================================================
45 StatusCode initialize() override;
47 StatusCode finalize() override;
48 // ============================================================================
49 public:
50 // ============================================================================
54 virtual ChronoEntity* chronoStart
55 ( const IChronoStatSvc::ChronoTag& chronoTag ) override;
56 // ============================================================================
60 virtual const ChronoEntity* chronoStop
61 ( const IChronoStatSvc::ChronoTag& chronoTag ) override;
62 // ============================================================================
66 virtual IChronoStatSvc::ChronoTime chronoDelta
67 ( const IChronoStatSvc::ChronoTag& chronoTag,
68 IChronoStatSvc::ChronoType theType ) override;
69 // ============================================================================
73 virtual void chronoPrint
74 ( const IChronoStatSvc::ChronoTag& chronoTag ) override;
75 // ============================================================================
79 virtual ChronoStatus chronoStatus
80 ( const IChronoStatSvc::ChronoTag& chronoTag ) override;
81 // ============================================================================
86 virtual void stat
87 ( const IChronoStatSvc::StatTag & statTag ,
88 const IChronoStatSvc::StatFlag & statFlag ) override;
89 // ============================================================================
94 virtual void statPrint
95 ( const IChronoStatSvc::ChronoTag& statTag) override;
96 // ============================================================================
102 virtual const ChronoEntity* chrono
103 ( const IChronoStatSvc::ChronoTag& t ) const override;
104 // ============================================================================
110 virtual const StatEntity* stat
111 ( const IChronoStatSvc::StatTag& t ) const override;
112 // ============================================================================
117 ChronoStatSvc ( const std::string& name, ISvcLocator* svcloc );
119 void merge ( const ChronoStatSvc& css);
121 ~ChronoStatSvc() override = default;
122 // ============================================================================
123
124 public:
125 void handle(const Incident& incident) override;
126
127
128 protected:
129 // ============================================================================
130 // print the "Stat" part of the ChronoStatSvc
131 void printStats() ;
132 // ============================================================================
133 private:
134 // ============================================================================
135 // default/copy constructor and assignment are disabled
136 ChronoStatSvc() = delete;
137 ChronoStatSvc( const ChronoStatSvc& ) = delete;
138 ChronoStatSvc& operator=( const ChronoStatSvc& ) = delete;
139 // ============================================================================
141 void saveStats();
142 // ============================================================================
143 private:
144 // ============================================================================
146 ChronoMap m_chronoEntities;
148 int m_intChronoPrintLevel ;
149 MSG::Level m_chronoPrintLevel = MSG::INFO ;
151 bool m_chronoTableFlag ;
153 bool m_chronoCoutFlag ;
155 bool m_chronoOrderFlag ;
157 bool m_printUserTime ;
159 bool m_printSystemTime ;
161 bool m_printEllapsedTime ;
162
163 // property
164 long m_numberOfSkippedEventsForMemStat ;
165
167 StatMap m_statEntities;
168
170 int m_intStatPrintLevel ;
171 MSG::Level m_statPrintLevel = MSG::INFO;
173 bool m_statTableFlag ;
175 bool m_statCoutFlag ;
177 bool m_statOrderFlag ;
179
181 StringProperty m_statsOutFileName;
182
183 // the header row
184 std::string m_header ;
185 // format for regular statistical printout rows
186 std::string m_format1 ;
187 // format for "efficiency" statistical printout rows
188 std::string m_format2 ;
189 // flag to use the special "efficiency" format
190 bool m_useEffFormat = true ;
191
192 typedef std::map<ChronoTag, std::vector<IChronoSvc::ChronoTime> > TimeMap;
193 TimeMap m_perEvtTime;
194 std::string m_perEventFile;
195 std::ofstream m_ofd;
196
197 // ============================================================================
198 };
199 // ============================================================================
200 // The END
201 // ============================================================================
202 #endif // GAUDISVC_CHRONOSTATSVC_H
203 // ============================================================================
204
205
ChronoStatSvc::operator=
ChronoStatSvc & operator=(const ChronoStatSvc &)=delete
ChronoStatSvc::m_useEffFormat
bool m_useEffFormat
flag to use the special "efficiency" format
Definition: ChronoStatSvc.h:190
ChronoStatSvc::m_intStatPrintLevel
int m_intStatPrintLevel
level of info printing
Definition: ChronoStatSvc.h:170
Kernel.h
ChronoStatSvc::m_chronoOrderFlag
bool m_chronoOrderFlag
flag for formattion the final statistic table
Definition: ChronoStatSvc.h:155
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
ChronoStatSvc::m_printUserTime
bool m_printUserTime
flag for printing User quantities
Definition: ChronoStatSvc.h:157
ChronoStatSvc::chronoStatus
virtual ChronoStatus chronoStatus(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStatus.
Definition: ChronoStatSvc.cpp:438
ChronoStatSvc::m_statEntities
StatMap m_statEntities
stat part
Definition: ChronoStatSvc.h:167
ChronoStatSvc::m_printEllapsedTime
bool m_printEllapsedTime
flag for printing Ellapsed quantities
Definition: ChronoStatSvc.h:161
ChronoEntity
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
ChronoStatSvc::m_header
std::string m_header
the header row
Definition: ChronoStatSvc.h:184
ChronoStatSvc::chronoDelta
virtual IChronoStatSvc::ChronoTime chronoDelta(const IChronoStatSvc::ChronoTag &chronoTag, IChronoStatSvc::ChronoType theType) override
Implementation of IchronoStatSvc::chronoDelta.
Definition: ChronoStatSvc.cpp:410
ChronoStatSvc::m_statsOutFileName
StringProperty m_statsOutFileName
Name of the output file where we'll dump the stats.
Definition: ChronoStatSvc.h:181
ChronoStatSvc::stat
virtual void stat(const IChronoStatSvc::StatTag &statTag, const IChronoStatSvc::StatFlag &statFlag) override
Implementation of IChronoStatSvc::stat add statistical information to the entity , tagged by its name.
Definition: ChronoStatSvc.cpp:444
ChronoStatSvc::statPrint
virtual void statPrint(const IChronoStatSvc::ChronoTag &statTag) override
prints (using message service) info about statistical entity, tagged by its name
Definition: ChronoStatSvc.cpp:469
ChronoStatSvc::m_numberOfSkippedEventsForMemStat
long m_numberOfSkippedEventsForMemStat
Definition: ChronoStatSvc.h:164
ChronoStatSvc::m_format2
std::string m_format2
format for "efficiency" statistical printout rows
Definition: ChronoStatSvc.h:188
std::map< IChronoStatSvc::ChronoTag, ChronoEntity >
ChronoStatSvc::m_chronoTableFlag
bool m_chronoTableFlag
flag for printing the final table
Definition: ChronoStatSvc.h:151
ChronoStatSvc::m_intChronoPrintLevel
int m_intChronoPrintLevel
level of info printing
Definition: ChronoStatSvc.h:148
std::string
STL class.
SimpleProperty< std::string >
Service.h
ChronoStatSvc::printStats
void printStats()
Definition: ChronoStatSvc.cpp:576
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:319
MSG::Level
Level
Definition: IMessageSvc.h:15
std::ofstream
STL class.
ChronoStatSvc::merge
void merge(const ChronoStatSvc &css)
Compound assignment operator.
Definition: ChronoStatSvc.cpp:138
ChronoStatSvc::TimeMap
std::map< ChronoTag, std::vector< IChronoSvc::ChronoTime > > TimeMap
Definition: ChronoStatSvc.h:192
ChronoStatSvc::ChronoStatSvc
ChronoStatSvc()=delete
ChronoStatSvc::saveStats
void saveStats()
dump the statistics into an ASCII file for offline processing
Definition: ChronoStatSvc.cpp:503
ChronoStatSvc::m_statOrderFlag
bool m_statOrderFlag
flag for formattion the final statistic table
Definition: ChronoStatSvc.h:177
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ChronoStatSvc::m_perEvtTime
TimeMap m_perEvtTime
Definition: ChronoStatSvc.h:193
IMessageSvc
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:57
ChronoStatSvc::chronoStop
virtual const ChronoEntity * chronoStop(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStop.
Definition: ChronoStatSvc.cpp:399
ChronoStatSvc::~ChronoStatSvc
~ChronoStatSvc() override=default
Destructor.
ChronoStatSvc::m_ofd
std::ofstream m_ofd
Definition: ChronoStatSvc.h:195
ChronoStatSvc::m_statTableFlag
bool m_statTableFlag
flag for printing the final table
Definition: ChronoStatSvc.h:173
ChronoStatSvc::ChronoMap
std::map< IChronoStatSvc::ChronoTag, ChronoEntity > ChronoMap
some useful typedefs
Definition: ChronoStatSvc.h:39
ChronoStatSvc::m_chronoPrintLevel
MSG::Level m_chronoPrintLevel
Definition: ChronoStatSvc.h:149
ChronoStatSvc::initialize
StatusCode initialize() override
Implementation of IService::initialize()
Definition: ChronoStatSvc.cpp:166
ChronoStatSvc::m_statCoutFlag
bool m_statCoutFlag
flag for destination of the t he final table
Definition: ChronoStatSvc.h:175
ChronoStatSvc::m_printSystemTime
bool m_printSystemTime
flag for printing System quantities
Definition: ChronoStatSvc.h:159
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
ChronoStatSvc::handle
void handle(const Incident &incident) override
Definition: ChronoStatSvc.cpp:649
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
ChronoStatSvc::chronoStart
virtual ChronoEntity * chronoStart(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStart.
Definition: ChronoStatSvc.cpp:388
ChronoStatSvc::m_perEventFile
std::string m_perEventFile
Definition: ChronoStatSvc.h:194
IIncidentListener.h
IChronoStatSvc.h
ChronoStatSvc::m_statPrintLevel
MSG::Level m_statPrintLevel
Definition: ChronoStatSvc.h:171
ChronoStatSvc::m_chronoCoutFlag
bool m_chronoCoutFlag
flag for destination of the the final table
Definition: ChronoStatSvc.h:153
StatEntity
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:64
MSG::INFO
Definition: IMessageSvc.h:19
ChronoStatSvc::chronoPrint
virtual void chronoPrint(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoPrint.
Definition: ChronoStatSvc.cpp:419
ChronoStatSvc::m_format1
std::string m_format1
format for regular statistical printout rows
Definition: ChronoStatSvc.h:186
ChronoStatSvc
The Chrono & Stat Sservice: service implements the IChronoStatSvc interface and provides the basic ch...
Definition: ChronoStatSvc.h:33
ChronoStatSvc::StatMap
std::map< IChronoStatSvc::StatTag, StatEntity > StatMap
Definition: ChronoStatSvc.h:40
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:146
ChronoStatSvc::finalize
StatusCode finalize() override
Implementation of IService::finalize()
Definition: ChronoStatSvc.cpp:229
ChronoStatSvc::chrono
virtual const ChronoEntity * chrono(const IChronoStatSvc::ChronoTag &t) const override
extract the chrono entity for the given tag (name)
Definition: ChronoStatSvc.cpp:482