| The Gaudi Framework v28r2-patches (bc4ad17a)

- 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 <fstream>
9 #include <functional>
10 #include <map>
11 #include <string>
12 // ============================================================================
13 // GaudiKernel
14 // ============================================================================
15 #include "GaudiKernel/IChronoStatSvc.h"
16 #include "GaudiKernel/IIncidentListener.h"
17 #include "GaudiKernel/Kernel.h"
18 #include "GaudiKernel/Service.h"
19 // ============================================================================
21 // ============================================================================
22 class ISvcLocator;
23 class IMessageSvc;
24 // ============================================================================
33 class ChronoStatSvc : public extends<Service, IChronoStatSvc, IIncidentListener>
34 {
35 public:
36 // ============================================================================
38 typedef std::map<IChronoStatSvc::ChronoTag, ChronoEntity> ChronoMap;
39 typedef std::map<IChronoStatSvc::StatTag, StatEntity> StatMap;
40 // ============================================================================
41 public:
42 // ============================================================================
44 StatusCode initialize() override;
46 StatusCode finalize() override;
47 // ============================================================================
48 public:
49 // ============================================================================
53 virtual ChronoEntity* chronoStart( const IChronoStatSvc::ChronoTag& chronoTag ) override;
54 // ============================================================================
58 virtual const ChronoEntity* chronoStop( const IChronoStatSvc::ChronoTag& chronoTag ) override;
59 // ============================================================================
63 virtual IChronoStatSvc::ChronoTime chronoDelta( const IChronoStatSvc::ChronoTag& chronoTag,
64 IChronoStatSvc::ChronoType theType ) override;
65 // ============================================================================
69 virtual void chronoPrint( const IChronoStatSvc::ChronoTag& chronoTag ) override;
70 // ============================================================================
74 virtual ChronoStatus chronoStatus( const IChronoStatSvc::ChronoTag& chronoTag ) override;
75 // ============================================================================
80 virtual void stat( const IChronoStatSvc::StatTag& statTag, const IChronoStatSvc::StatFlag& statFlag ) override;
81 // ============================================================================
86 virtual void statPrint( const IChronoStatSvc::ChronoTag& statTag ) override;
87 // ============================================================================
93 virtual const ChronoEntity* chrono( const IChronoStatSvc::ChronoTag& t ) const override;
94 // ============================================================================
100 virtual const StatEntity* stat( const IChronoStatSvc::StatTag& t ) const override;
101 // ============================================================================
106 ChronoStatSvc( const std::string& name, ISvcLocator* svcloc );
108 void merge( const ChronoStatSvc& css );
110 ~ChronoStatSvc() override = default;
111 // ============================================================================
112
113 public:
114 void handle( const Incident& incident ) override;
115
116 protected:
117 // ============================================================================
118 // print the "Stat" part of the ChronoStatSvc
119 void printStats();
120 // ============================================================================
121 private:
122 // ============================================================================
123 // default/copy constructor and assignment are disabled
124 ChronoStatSvc() = delete;
125 ChronoStatSvc( const ChronoStatSvc& ) = delete;
126 ChronoStatSvc& operator=( const ChronoStatSvc& ) = delete;
127 // ============================================================================
129 void saveStats();
130 // ============================================================================
131 private:
132 // ============================================================================
134 ChronoMap m_chronoEntities;
136 MSG::Level m_chronoPrintLevel = MSG::INFO;
137
139 StatMap m_statEntities;
141 MSG::Level m_statPrintLevel = MSG::INFO;
142
143 Gaudi::Property<bool> m_chronoTableFlag{this, "ChronoPrintOutTable", true,
144 "decide if the final printout should be performed"};
145 Gaudi::Property<bool> m_chronoCoutFlag{this, "ChronoDestinationCout", false,
146 "define the destination of the table to be printed"};
147 Gaudi::Property<int> m_intChronoPrintLevel{this, "ChronoPrintLevel", MSG::INFO, "print level"};
148 Gaudi::Property<bool> m_chronoOrderFlag{this, "ChronoTableToBeOrdered", true, "should the printout be ordered"};
149 Gaudi::Property<bool> m_printUserTime{this, "PrintUserTime", true};
150 Gaudi::Property<bool> m_printSystemTime{this, "PrintSystemTime", false};
151 Gaudi::Property<bool> m_printEllapsedTime{this, "PrintEllapsedTime", false};
152 Gaudi::Property<bool> m_statTableFlag{this, "StatPrintOutTable", true,
153 "decide if the final printout should be performed"};
154 Gaudi::Property<bool> m_statCoutFlag{this, "StatDestinationCout", false,
155 "define the destination of the table to be printed"};
156 Gaudi::Property<int> m_intStatPrintLevel{this, "StatPrintLevel", MSG::INFO, "print level"};
157 Gaudi::Property<bool> m_statOrderFlag{this, "StatTableToBeOrdered", true, "should the printout be ordered"};
158
159 Gaudi::Property<long> m_numberOfSkippedEventsForMemStat{
160 this, "NumberOfSkippedEventsForMemStat", -1,
161 "specify the number of events to be skipped by the memory auditor in order to better spot memory leak"};
162
163 Gaudi::Property<std::string> m_statsOutFileName{
164 this, "AsciiStatsOutputFile", "",
165 "Name of the output file storing the stats. If empty, no statistics will be saved (default)"};
166
167 Gaudi::Property<std::string> m_header{
168 this, "StatTableHeader",
169 " Counter | # | sum | mean/eff^* | rms/err^* | min | max |",
170 "The header row for the output Stat-table"};
171 Gaudi::Property<std::string> m_format1{
172 this, "RegularRowFormat", " %|-15.15s|%|17t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |",
173 "The format for the regular row in the output Stat-table"};
174 Gaudi::Property<std::string> m_format2{
175 this, "EfficiencyRowFormat",
176 "*%|-15.15s|%|17t||%|10d| |%|11.5g| |(%|#9.7g| +- %|-#9.7g|)%%| ------- | ------- |",
177 "The format for the regular row in the output Stat-table"};
178 Gaudi::Property<bool> m_useEffFormat{this, "UseEfficiencyRowFormat", true,
179 "Use the special format for printout of efficiency counters"};
180
181 Gaudi::Property<std::string> m_perEventFile{this, "PerEventFile", "", "File name for per-event deltas"};
182
183 typedef std::map<ChronoTag, std::vector<IChronoSvc::ChronoTime>> TimeMap;
184 TimeMap m_perEvtTime;
185 std::ofstream m_ofd;
186
187 // ============================================================================
188 };
189 // ============================================================================
190 // The END
191 // ============================================================================
192 #endif // GAUDISVC_CHRONOSTATSVC_H
193 // ============================================================================
ChronoStatSvc::m_intStatPrintLevel
Gaudi::Property< int > m_intStatPrintLevel
Definition: ChronoStatSvc.h:156
ChronoStatSvc::operator=
ChronoStatSvc & operator=(const ChronoStatSvc &)=delete
Kernel.h
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
ChronoStatSvc::chronoStatus
virtual ChronoStatus chronoStatus(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStatus.
Definition: ChronoStatSvc.cpp:352
ChronoStatSvc::m_header
Gaudi::Property< std::string > m_header
Definition: ChronoStatSvc.h:167
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:314
ChronoStatSvc::m_statEntities
StatMap m_statEntities
stat part
Definition: ChronoStatSvc.h:139
ChronoEntity
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
ChronoStatSvc::m_statCoutFlag
Gaudi::Property< bool > m_statCoutFlag
Definition: ChronoStatSvc.h:154
ChronoStatSvc::chronoDelta
virtual IChronoStatSvc::ChronoTime chronoDelta(const IChronoStatSvc::ChronoTag &chronoTag, IChronoStatSvc::ChronoType theType) override
Implementation of IchronoStatSvc::chronoDelta.
Definition: ChronoStatSvc.cpp:331
ChronoStatSvc::m_numberOfSkippedEventsForMemStat
Gaudi::Property< long > m_numberOfSkippedEventsForMemStat
Definition: ChronoStatSvc.h:159
ChronoStatSvc::m_chronoOrderFlag
Gaudi::Property< bool > m_chronoOrderFlag
Definition: ChronoStatSvc.h:148
ChronoStatSvc::m_printUserTime
Gaudi::Property< bool > m_printUserTime
Definition: ChronoStatSvc.h:149
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:359
ChronoStatSvc::ChronoMap
std::map< IChronoStatSvc::ChronoTag, ChronoEntity > ChronoMap
some useful typedefs
Definition: ChronoStatSvc.h:38
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:380
std::map< IChronoStatSvc::ChronoTag, ChronoEntity >
std::string
STL class.
Service.h
ChronoStatSvc::printStats
void printStats()
Definition: ChronoStatSvc.cpp:481
ChronoStatSvc::chrono
virtual const ChronoEntity * chrono(const IChronoStatSvc::ChronoTag &t) const override
extract the chrono entity for the given tag (name)
Definition: ChronoStatSvc.cpp:392
MSG::Level
Level
Definition: IMessageSvc.h:15
std::ofstream
STL class.
ChronoStatSvc::merge
void merge(const ChronoStatSvc &css)
Compound assignment operator.
Definition: ChronoStatSvc.cpp:57
ChronoStatSvc::TimeMap
std::map< ChronoTag, std::vector< IChronoSvc::ChronoTime > > TimeMap
Definition: ChronoStatSvc.h:183
ChronoStatSvc::ChronoStatSvc
ChronoStatSvc()=delete
ChronoStatSvc::m_useEffFormat
Gaudi::Property< bool > m_useEffFormat
Definition: ChronoStatSvc.h:178
ChronoStatSvc::saveStats
void saveStats()
dump the statistics into an ASCII file for offline processing
Definition: ChronoStatSvc.cpp:412
ChronoStatSvc::m_intChronoPrintLevel
Gaudi::Property< int > m_intChronoPrintLevel
Definition: ChronoStatSvc.h:147
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:184
ChronoStatSvc::m_format2
Gaudi::Property< std::string > m_format2
Definition: ChronoStatSvc.h:174
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:322
ChronoStatSvc::m_statOrderFlag
Gaudi::Property< bool > m_statOrderFlag
Definition: ChronoStatSvc.h:157
ChronoStatSvc::~ChronoStatSvc
~ChronoStatSvc() override=default
Destructor.
ChronoStatSvc::m_chronoTableFlag
Gaudi::Property< bool > m_chronoTableFlag
Definition: ChronoStatSvc.h:143
ChronoStatSvc::m_ofd
std::ofstream m_ofd
Definition: ChronoStatSvc.h:185
ChronoStatSvc::m_format1
Gaudi::Property< std::string > m_format1
Definition: ChronoStatSvc.h:171
ChronoStatSvc::m_chronoPrintLevel
MSG::Level m_chronoPrintLevel
level of info printing
Definition: ChronoStatSvc.h:136
ChronoStatSvc::initialize
StatusCode initialize() override
Implementation of IService::initialize()
Definition: ChronoStatSvc.cpp:98
ChronoStatSvc::m_printEllapsedTime
Gaudi::Property< bool > m_printEllapsedTime
Definition: ChronoStatSvc.h:151
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:550
ChronoStatSvc::m_statTableFlag
Gaudi::Property< bool > m_statTableFlag
Definition: ChronoStatSvc.h:152
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:313
IIncidentListener.h
IChronoStatSvc.h
ChronoStatSvc::m_statsOutFileName
Gaudi::Property< std::string > m_statsOutFileName
Definition: ChronoStatSvc.h:163
ChronoStatSvc::m_statPrintLevel
MSG::Level m_statPrintLevel
level of info printing
Definition: ChronoStatSvc.h:141
ChronoStatSvc::m_chronoCoutFlag
Gaudi::Property< bool > m_chronoCoutFlag
Definition: ChronoStatSvc.h:145
StatEntity
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:65
MSG::INFO
Definition: IMessageSvc.h:19
ChronoStatSvc::chronoPrint
virtual void chronoPrint(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoPrint.
Definition: ChronoStatSvc.cpp:339
ChronoStatSvc::StatMap
std::map< IChronoStatSvc::StatTag, StatEntity > StatMap
Definition: ChronoStatSvc.h:39
ChronoStatSvc
The Chrono & Stat Sservice: service implements the IChronoStatSvc interface and provides the basic ch...
Definition: ChronoStatSvc.h:33
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134
ChronoStatSvc::m_printSystemTime
Gaudi::Property< bool > m_printSystemTime
Definition: ChronoStatSvc.h:150
ChronoStatSvc::finalize
StatusCode finalize() override
Implementation of IService::finalize()
Definition: ChronoStatSvc.cpp:145
ChronoStatSvc::m_perEventFile
Gaudi::Property< std::string > m_perEventFile
Definition: ChronoStatSvc.h:181