Gaudi Framework, version v23r9
Home
Generated: Thu Jul 18 2013
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
GaudiKernel
GaudiKernel
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
();
27
~ChronoEntity
(){}
29
public
:
30
// ==========================================================================
31
// The basic Chrono Operations
32
// ==========================================================================
34
IChronoSvc::ChronoStatus
start
() ;
36
IChronoSvc::ChronoStatus
stop () ;
37
// ==========================================================================
39
inline
IChronoSvc::ChronoTime
delta (
IChronoSvc::ChronoType
type
)
const
;
41
inline
IChronoSvc::ChronoStatus
status()
const
;
42
// ==========================================================================
43
public
:
44
// ==========================================================
45
// Access to Chrono Statistics
46
// ==========================================================
48
inline
unsigned
long
nOfMeasurements ()
const
;
49
// ==========================================================
51
inline
double
uMinimalTime ()
const
;
53
inline
double
kMinimalTime ()
const
;
55
inline
double
eMinimalTime ()
const
;
57
inline
double
uMaximalTime ()
const
;
59
inline
double
kMaximalTime ()
const
;
61
inline
double
eMaximalTime ()
const
;
63
inline
double
uTotalTime ()
const
;
65
inline
double
kTotalTime ()
const
;
67
inline
double
eTotalTime ()
const
;
69
inline
double
totalTime ()
const
;
71
inline
double
kMeanTime ()
const
;
73
inline
double
uMeanTime ()
const
;
75
inline
double
eMeanTime ()
const
;
77
inline
double
kRMSTime ()
const
;
79
inline
double
uRMSTime ()
const
;
81
inline
double
eRMSTime ()
const
;
83
inline
double
kMeanErrorTime ()
const
;
85
inline
double
uMeanErrorTime ()
const
;
87
inline
double
eMeanErrorTime ()
const
;
88
// ==========================================================================
89
public
:
90
// ==========================================================================
92
bool
operator<
(
const
ChronoEntity
& entity )
const
;
93
// ==========================================================================
94
public
:
95
// ==========================================================================
97
std::string
outputUserTime ()
const
;
99
std::string
outputSystemTime ()
const
;
101
std::string
outputElapsedTime ()
const
;
102
// ==========================================================================
103
public
:
104
// ==========================================================================
111
inline
std::string
outputUserTime
112
(
const
std::string
& fmt ,
113
System::TimeType
unit )
const
;
120
inline
std::string
outputSystemTime
121
(
const
std::string
& fmt ,
122
System::TimeType
unit )
const
;
129
inline
std::string
outputElapsedTime
130
(
const
std::string
& fmt ,
131
System::TimeType
unit )
const
;
132
// ==========================================================================
151
std::string
outputTime
152
(
IChronoSvc::ChronoType
typ ,
153
const
std::string
& fmt ,
154
System::TimeType
unit )
const
;
155
// ==========================================================================
156
protected
:
157
// ==========================================================================
159
std::string
format
160
(
const
double
total ,
161
const
double
minimal ,
162
const
double
mean ,
163
const
double
rms ,
164
const
double
maximal ,
165
const
unsigned
long
number )
const
;
166
// ==========================================================================
167
private
:
168
// ==========================================================================
170
IChronoSvc::ChronoStatus
m_status
;
172
System::ProcessTime
m_delta
;
174
System::ProcessTime
m_start
;
176
StatEntity
m_user
;
// the actual storage of "user" time
178
StatEntity
m_kernel
;
// the actual storage of "kernel" time
180
StatEntity
m_elapsed
;
// the actual storage of "elapsed" time
182
static
const
System::TimeType
TimeUnit =
System::microSec
;
183
// ==========================================================================
184
};
185
// ============================================================================
186
// return the status of chrono
187
// ============================================================================
188
inline
IChronoSvc::ChronoStatus
189
ChronoEntity::status
()
const
{
return
m_status
; }
190
// ============================================================================
191
// number of chrono measurements
192
// ============================================================================
193
inline
unsigned
long
194
ChronoEntity::nOfMeasurements
()
const
{
return
m_user
. nEntries() ; }
195
// ============================================================================
196
// minimal measurement for user time
197
// ============================================================================
198
inline
double
ChronoEntity::uMinimalTime
()
const
199
{
return
m_user
. flagMin () ; }
200
// ============================================================================
201
// minimal measurement for kernel time
202
// ============================================================================
203
inline
double
204
ChronoEntity::kMinimalTime
()
const
{
return
m_kernel
. flagMin () ; }
205
// ============================================================================
206
// minimal measurement for elapsed time
207
// ============================================================================
208
inline
double
209
ChronoEntity::eMinimalTime
()
const
{
return
m_elapsed
. flagMin () ; }
210
// ============================================================================
211
// maximal measurement for user time
212
// ============================================================================
213
inline
double
214
ChronoEntity::uMaximalTime
()
const
{
return
m_user
. flagMax () ; }
215
// ============================================================================
216
// maximal measurement for kernel time
217
// ============================================================================
218
inline
double
219
ChronoEntity::kMaximalTime
()
const
{
return
m_kernel
. flagMax () ; }
220
// ============================================================================
221
// maximal measurement for ellapsed time
222
// ============================================================================
223
inline
double
224
ChronoEntity::eMaximalTime
()
const
{
return
m_elapsed
. flagMax () ; }
225
// ============================================================================
226
// total user time
227
// ============================================================================
228
inline
double
229
ChronoEntity::uTotalTime
()
const
{
return
m_user
. flag () ; }
230
// ============================================================================
231
// total Kernel time
232
// ============================================================================
233
inline
double
234
ChronoEntity::kTotalTime
()
const
{
return
m_kernel
. flag () ; }
235
// ============================================================================
236
// total Elapsed time
237
// ============================================================================
238
inline
double
239
ChronoEntity::eTotalTime
()
const
{
return
m_elapsed
. flag () ; }
240
// ============================================================================
241
// total time
242
// ============================================================================
243
inline
double
244
ChronoEntity::totalTime
()
const
245
{
return
uTotalTime
() +
kTotalTime
() ; }
246
// ============================================================================
247
// average Kernel Time
248
// ============================================================================
249
inline
double
250
ChronoEntity::kMeanTime
()
const
{
return
m_kernel
. flagMean () ; }
251
// ============================================================================
252
// average User Time
253
// ============================================================================
254
inline
double
255
ChronoEntity::uMeanTime
()
const
{
return
m_user
. flagMean () ; }
256
// ============================================================================
257
// average Elapsed Time
258
// ============================================================================
259
inline
double
260
ChronoEntity::eMeanTime
()
const
{
return
m_elapsed
. flagMean () ; }
261
// ============================================================================
262
// r.m.s Kernel Time
263
// ============================================================================
264
inline
double
265
ChronoEntity::kRMSTime
()
const
{
return
m_kernel
. flagRMS () ; }
266
// ============================================================================
267
// r.m.s User Time
268
// ============================================================================
269
inline
double
270
ChronoEntity::uRMSTime
()
const
{
return
m_user
. flagRMS () ; }
271
// ============================================================================
272
// r.m.s Elapsed Time
273
// ============================================================================
274
inline
double
275
ChronoEntity::eRMSTime
()
const
{
return
m_elapsed
. flagRMS () ; }
276
// ============================================================================
277
// error in mean Kernel time
278
// ============================================================================
279
inline
double
280
ChronoEntity::kMeanErrorTime
()
const
{
return
m_kernel
. flagMeanErr () ; }
281
// ============================================================================
282
// error in mean User time
283
// ============================================================================
284
inline
double
285
ChronoEntity::uMeanErrorTime
()
const
{
return
m_user
. flagMeanErr () ; }
286
// ============================================================================
287
// error in mean Elapsed time
288
// ============================================================================
289
inline
double
290
ChronoEntity::eMeanErrorTime
()
const
{
return
m_elapsed
. flagMeanErr () ; }
291
// ============================================================================
292
// return the last delta-time of type "type"
293
// ============================================================================
294
inline
IChronoSvc::ChronoTime
295
ChronoEntity::delta
(
IChronoSvc::ChronoType
type
)
const
296
{
297
const
IChronoSvc::ChronoTime
result = -1 ;
298
switch
( type )
299
{
300
case
IChronoSvc::USER
:
return
m_delta
.
userTime
<
TimeUnit
>();
301
case
IChronoSvc::KERNEL
:
return
m_delta
.
kernelTime
<
TimeUnit
>();
302
case
IChronoSvc::ELAPSED
:
return
m_delta
.
elapsedTime
<
TimeUnit
>();
303
default
:
return
result;
304
}
305
// cannot reach this point
306
}
307
// ============================================================================
308
/* print the chrono according the format and units
309
* @param fmt the format string
310
* @param unit the unit
311
* @return the string representations
312
* @see boost::format
313
*/
314
// ============================================================================
315
inline
std::string
316
ChronoEntity::outputUserTime
317
(
const
std::string
& fmt ,
318
System::TimeType
unit )
const
319
{
320
return
outputTime (
IChronoSvc::USER
, fmt , unit ) ;
321
}
322
// ============================================================================
323
/* print the chrono according the format and units
324
* @param fmt the format string
325
* @param unit the unit
326
* @return the string representations
327
* @see boost::format
328
*/
329
// ============================================================================
330
inline
std::string
331
ChronoEntity::outputSystemTime
332
(
const
std::string
& fmt ,
333
System::TimeType
unit )
const
334
{
335
return
outputTime (
IChronoSvc::KERNEL
, fmt , unit ) ;
336
}
337
// ============================================================================
338
/* print the chrono according the format and units
339
* @param fmt the format string
340
* @param unit the unit
341
* @return the string representations
342
* @see boost::format
343
*/
344
// ============================================================================
345
inline
std::string
346
ChronoEntity::outputElapsedTime
347
(
const
std::string
& fmt ,
348
System::TimeType
unit )
const
349
{
350
return
outputTime (
IChronoSvc::ELAPSED
, fmt , unit ) ;
351
}
352
// ============================================================================
353
// The END
354
// ============================================================================
355
#endif // GAUDIKERNEL_CHRONOENTITY_H
356
// ============================================================================
357
358
359
360
361
362
363
364
365
366
Generated at Thu Jul 18 2013 12:18:02 for Gaudi Framework, version v23r9 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004