| The Gaudi Framework v30r0 (c919700c)

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

- File List
- File Members

ChronoEntity.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_CHRONOENTITY_H
2 #define GAUDIKERNEL_CHRONOENTITY_H 1
3 // ============================================================================
4 // Include files
5 // ============================================================================
6 // GaudiKernel
7 // ============================================================================
8 #include "GaudiKernel/IChronoSvc.h"
9 #include "GaudiKernel/StatEntity.h"
10 #include "GaudiKernel/Timing.h"
11 // ============================================================================
21 class GAUDI_API ChronoEntity
22 {
23 public:
25 ChronoEntity() = default;
26
27 public:
28 // ==========================================================================
29 // The basic Chrono Operations
30 // ==========================================================================
32 IChronoSvc::ChronoStatus start();
34 IChronoSvc::ChronoStatus stop();
35 // ==========================================================================
37 inline IChronoSvc::ChronoTime delta( IChronoSvc::ChronoType type ) const;
39 inline IChronoSvc::ChronoStatus status() const;
40 // ==========================================================================
41 public:
42 // ==========================================================
43 // Access to Chrono Statistics
44 // ==========================================================
46 inline unsigned long nOfMeasurements() const;
47 // ==========================================================
49 inline double uMinimalTime() const;
51 inline double kMinimalTime() const;
53 inline double eMinimalTime() const;
55 inline double uMaximalTime() const;
57 inline double kMaximalTime() const;
59 inline double eMaximalTime() const;
61 inline double uTotalTime() const;
63 inline double kTotalTime() const;
65 inline double eTotalTime() const;
67 inline double totalTime() const;
69 inline double kMeanTime() const;
71 inline double uMeanTime() const;
73 inline double eMeanTime() const;
75 inline double kRMSTime() const;
77 inline double uRMSTime() const;
79 inline double eRMSTime() const;
81 inline double kMeanErrorTime() const;
83 inline double uMeanErrorTime() const;
85 inline double eMeanErrorTime() const;
86 // ==========================================================================
87 public:
88 // ==========================================================================
90 bool operator<( const ChronoEntity& entity ) const;
91 // ==========================================================================
93 ChronoEntity& operator+=( const ChronoEntity& entity );
94 // ==========================================================================
95 public:
96 // ==========================================================================
98 std::string outputUserTime() const;
100 std::string outputSystemTime() const;
102 std::string outputElapsedTime() const;
103 // ==========================================================================
104 public:
105 // ==========================================================================
112 inline std::string outputUserTime( const std::string& fmt, System::TimeType unit ) const;
119 inline std::string outputSystemTime( const std::string& fmt, System::TimeType unit ) const;
126 inline std::string outputElapsedTime( const std::string& fmt, System::TimeType unit ) const;
127 // ==========================================================================
146 std::string outputTime( IChronoSvc::ChronoType typ, const std::string& fmt, System::TimeType unit ) const;
147 // ==========================================================================
148 protected:
149 // ==========================================================================
151 std::string format( const double total, const double minimal, const double mean, const double rms,
152 const double maximal, const unsigned long number ) const;
153 // ==========================================================================
154 private:
155 // ==========================================================================
157 IChronoSvc::ChronoStatus m_status = IChronoSvc::UNKNOWN;
159 System::ProcessTime m_delta;
161 System::ProcessTime m_start;
163 StatEntity m_user; // the actual storage of "user" time
165 StatEntity m_kernel; // the actual storage of "kernel" time
167 StatEntity m_elapsed; // the actual storage of "elapsed" time
169 static const System::TimeType TimeUnit = System::microSec;
170 // ==========================================================================
171 };
172 // ============================================================================
173 // return the status of chrono
174 // ============================================================================
175 inline IChronoSvc::ChronoStatus ChronoEntity::status() const { return m_status; }
176 // ============================================================================
177 // number of chrono measurements
178 // ============================================================================
179 inline unsigned long ChronoEntity::nOfMeasurements() const { return m_user.nEntries(); }
180 // ============================================================================
181 // minimal measurement for user time
182 // ============================================================================
183 inline double ChronoEntity::uMinimalTime() const { return m_user.flagMin(); }
184 // ============================================================================
185 // minimal measurement for kernel time
186 // ============================================================================
187 inline double ChronoEntity::kMinimalTime() const { return m_kernel.flagMin(); }
188 // ============================================================================
189 // minimal measurement for elapsed time
190 // ============================================================================
191 inline double ChronoEntity::eMinimalTime() const { return m_elapsed.flagMin(); }
192 // ============================================================================
193 // maximal measurement for user time
194 // ============================================================================
195 inline double ChronoEntity::uMaximalTime() const { return m_user.flagMax(); }
196 // ============================================================================
197 // maximal measurement for kernel time
198 // ============================================================================
199 inline double ChronoEntity::kMaximalTime() const { return m_kernel.flagMax(); }
200 // ============================================================================
201 // maximal measurement for ellapsed time
202 // ============================================================================
203 inline double ChronoEntity::eMaximalTime() const { return m_elapsed.flagMax(); }
204 // ============================================================================
205 // total user time
206 // ============================================================================
207 inline double ChronoEntity::uTotalTime() const { return m_user.flag(); }
208 // ============================================================================
209 // total Kernel time
210 // ============================================================================
211 inline double ChronoEntity::kTotalTime() const { return m_kernel.flag(); }
212 // ============================================================================
213 // total Elapsed time
214 // ============================================================================
215 inline double ChronoEntity::eTotalTime() const { return m_elapsed.flag(); }
216 // ============================================================================
217 // total time
218 // ============================================================================
219 inline double ChronoEntity::totalTime() const { return uTotalTime() + kTotalTime(); }
220 // ============================================================================
221 // average Kernel Time
222 // ============================================================================
223 inline double ChronoEntity::kMeanTime() const { return m_kernel.flagMean(); }
224 // ============================================================================
225 // average User Time
226 // ============================================================================
227 inline double ChronoEntity::uMeanTime() const { return m_user.flagMean(); }
228 // ============================================================================
229 // average Elapsed Time
230 // ============================================================================
231 inline double ChronoEntity::eMeanTime() const { return m_elapsed.flagMean(); }
232 // ============================================================================
233 // r.m.s Kernel Time
234 // ============================================================================
235 inline double ChronoEntity::kRMSTime() const { return m_kernel.flagRMS(); }
236 // ============================================================================
237 // r.m.s User Time
238 // ============================================================================
239 inline double ChronoEntity::uRMSTime() const { return m_user.flagRMS(); }
240 // ============================================================================
241 // r.m.s Elapsed Time
242 // ============================================================================
243 inline double ChronoEntity::eRMSTime() const { return m_elapsed.flagRMS(); }
244 // ============================================================================
245 // error in mean Kernel time
246 // ============================================================================
247 inline double ChronoEntity::kMeanErrorTime() const { return m_kernel.flagMeanErr(); }
248 // ============================================================================
249 // error in mean User time
250 // ============================================================================
251 inline double ChronoEntity::uMeanErrorTime() const { return m_user.flagMeanErr(); }
252 // ============================================================================
253 // error in mean Elapsed time
254 // ============================================================================
255 inline double ChronoEntity::eMeanErrorTime() const { return m_elapsed.flagMeanErr(); }
256 // ============================================================================
257 // return the last delta-time of type "type"
258 // ============================================================================
259 inline IChronoSvc::ChronoTime ChronoEntity::delta( IChronoSvc::ChronoType type ) const
260 {
261 const IChronoSvc::ChronoTime result = -1;
262 switch ( type ) {
263 case IChronoSvc::USER:
264 return m_delta.userTime<TimeUnit>();
265 case IChronoSvc::KERNEL:
266 return m_delta.kernelTime<TimeUnit>();
267 case IChronoSvc::ELAPSED:
268 return m_delta.elapsedTime<TimeUnit>();
269 default:
270 return result;
271 }
272 // cannot reach this point
273 }
274 // ============================================================================
275 /* print the chrono according the format and units
276 * @param fmt the format string
277 * @param unit the unit
278 * @return the string representations
279 * @see boost::format
280 */
281 // ============================================================================
282 inline std::string ChronoEntity::outputUserTime( const std::string& fmt, System::TimeType unit ) const
283 {
284 return outputTime( IChronoSvc::USER, fmt, unit );
285 }
286 // ============================================================================
287 /* print the chrono according the format and units
288 * @param fmt the format string
289 * @param unit the unit
290 * @return the string representations
291 * @see boost::format
292 */
293 // ============================================================================
294 inline std::string ChronoEntity::outputSystemTime( const std::string& fmt, System::TimeType unit ) const
295 {
296 return outputTime( IChronoSvc::KERNEL, fmt, unit );
297 }
298 // ============================================================================
299 /* print the chrono according the format and units
300 * @param fmt the format string
301 * @param unit the unit
302 * @return the string representations
303 * @see boost::format
304 */
305 // ============================================================================
306 inline std::string ChronoEntity::outputElapsedTime( const std::string& fmt, System::TimeType unit ) const
307 {
308 return outputTime( IChronoSvc::ELAPSED, fmt, unit );
309 }
310 // ============================================================================
311 // The END
312 // ============================================================================
313 #endif // GAUDIKERNEL_CHRONOENTITY_H
314 // ============================================================================
ChronoEntity::outputElapsedTime
std::string outputElapsedTime() const
print the chrono ;
Definition: ChronoEntity.cpp:104
ChronoEntity::kMaximalTime
double kMaximalTime() const
maximal measurement for kernel time
Definition: ChronoEntity.h:199
ChronoEntity::uMinimalTime
double uMinimalTime() const
minimal measurement for user time
Definition: ChronoEntity.h:183
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:120
ChronoEntity::uTotalTime
double uTotalTime() const
total user time
Definition: ChronoEntity.h:207
ChronoEntity::m_elapsed
StatEntity m_elapsed
the actual storage of "elapsed" time
Definition: ChronoEntity.h:167
ChronoEntity::kMeanErrorTime
double kMeanErrorTime() const
error in mean Kernel time
Definition: ChronoEntity.h:247
ChronoEntity
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
ChronoEntity::kTotalTime
double kTotalTime() const
total Kernel time
Definition: ChronoEntity.h:211
IChronoSvc::ChronoStatus
ChronoStatus
Definition: IChronoSvc.h:46
ChronoEntity::m_user
StatEntity m_user
the actual storage of "user" time
Definition: ChronoEntity.h:163
ChronoEntity::uRMSTime
double uRMSTime() const
r.m.s User Time
Definition: ChronoEntity.h:239
IChronoSvc::KERNEL
Definition: IChronoSvc.h:48
ChronoEntity::kMinimalTime
double kMinimalTime() const
minimal measurement for kernel time
Definition: ChronoEntity.h:187
ChronoEntity::eMinimalTime
double eMinimalTime() const
minimal measurement for elapsed time
Definition: ChronoEntity.h:191
ChronoEntity::kRMSTime
double kRMSTime() const
r.m.s Kernel Time
Definition: ChronoEntity.h:235
ChronoEntity::outputSystemTime
std::string outputSystemTime() const
print the chrono ;
Definition: ChronoEntity.cpp:97
std::string
STL class.
IChronoSvc::USER
Definition: IChronoSvc.h:48
ChronoEntity::m_start
System::ProcessTime m_start
start stamp for current measurement of process times
Definition: ChronoEntity.h:161
ChronoEntity::m_delta
System::ProcessTime m_delta
delta process times
Definition: ChronoEntity.h:159
ChronoEntity::kMeanTime
double kMeanTime() const
average Kernel Time
Definition: ChronoEntity.h:223
ChronoEntity::eMeanTime
double eMeanTime() const
average Elapsed Time
Definition: ChronoEntity.h:231
System::microSec
Definition: Timing.h:58
GaudiPython.HistoUtils.mean
mean
Definition: HistoUtils.py:838
System::TimeType
TimeType
Time type for conversion.
Definition: Timing.h:58
gaudirun.type
type
Definition: gaudirun.py:133
ChronoEntity::status
IChronoSvc::ChronoStatus status() const
return the status of chrono
Definition: ChronoEntity.h:175
ChronoEntity::m_kernel
StatEntity m_kernel
the actual storage of "kernel" time
Definition: ChronoEntity.h:165
IOTest.start
start
Definition: IOTest.py:99
System::ProcessTime
Simple class to hold the time information of a process.
Definition: Timing.h:147
ChronoEntity::eRMSTime
double eRMSTime() const
r.m.s Elapsed Time
Definition: ChronoEntity.h:243
ChronoEntity::eMeanErrorTime
double eMeanErrorTime() const
error in mean Elapsed time
Definition: ChronoEntity.h:255
IChronoSvc::ELAPSED
Definition: IChronoSvc.h:48
Timing.h
IChronoSvc::ChronoTime
double ChronoTime
Type of the delta-time.
Definition: IChronoSvc.h:41
ChronoEntity::uMeanTime
double uMeanTime() const
average User Time
Definition: ChronoEntity.h:227
operator<
bool operator<(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:207
ChronoEntity::outputUserTime
std::string outputUserTime() const
print the chrono ;
Definition: ChronoEntity.cpp:89
ChronoEntity::totalTime
double totalTime() const
total time
Definition: ChronoEntity.h:219
IChronoSvc::UNKNOWN
Definition: IChronoSvc.h:46
ChronoEntity::eMaximalTime
double eMaximalTime() const
maximal measurement for elapsed time
Definition: ChronoEntity.h:203
StatEntity.h
IChronoSvc::ChronoType
ChronoType
Definition: IChronoSvc.h:48
ChronoEntity::nOfMeasurements
unsigned long nOfMeasurements() const
number of chrono measurements
Definition: ChronoEntity.h:179
StatEntity
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:65
ChronoEntity::uMaximalTime
double uMaximalTime() const
maximal measurement for user time
Definition: ChronoEntity.h:195
IChronoSvc.h
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
ChronoEntity::eTotalTime
double eTotalTime() const
total Elapsed time
Definition: ChronoEntity.h:215
GaudiPython.HistoUtils.rms
rms
Definition: HistoUtils.py:842
ChronoEntity::delta
IChronoSvc::ChronoTime delta(IChronoSvc::ChronoType type) const
return the last delta-time of type "type"
Definition: ChronoEntity.h:259
ChronoEntity::uMeanErrorTime
double uMeanErrorTime() const
error in mean User time
Definition: ChronoEntity.h:251