| The Gaudi Framework v28r2-patches (bc4ad17a)

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

- File List
- File Members

ChronoStatSvc.cpp
Go to the documentation of this file.
1 #ifdef _WIN32
2 #pragma warning( disable : 4786 )
3 #endif
4 // ============================================================================
5 // STD & STL
6 // ============================================================================
7 #include <algorithm>
8 #include <fstream>
9 #include <functional>
10 #include <iomanip>
11 #include <iomanip>
12 #include <iostream>
13 #include <string>
14 // ============================================================================
15 // GaudiKernel
16 // ============================================================================
17 #include "GaudiKernel/ChronoEntity.h"
18 #include "GaudiKernel/IChronoStatSvc.h"
19 #include "GaudiKernel/IIncidentSvc.h"
20 #include "GaudiKernel/Kernel.h"
21 #include "GaudiKernel/MsgStream.h"
22 #include "GaudiKernel/Stat.h"
23 #include "GaudiKernel/StatEntity.h"
24 #include "GaudiKernel/StatusCode.h"
25 // ============================================================================
27 // ============================================================================
28 #include "ChronoStatSvc.h"
29 // ============================================================================
32 // ============================================================================
33 DECLARE_COMPONENT( ChronoStatSvc )
34 // ============================================================================
41 // ============================================================================
42 // ============================================================================
43 // comparison functor
44 // ============================================================================
45 constexpr struct CompareFirstOfPointerPair_t {
46 template <typename S, typename T>
47 inline bool operator()( const std::pair<S*, T*>& p1, const std::pair<S*, T*>& p2 ) const
48 {
49 auto e1 = p1.first;
50 auto e2 = p2.first;
51 return ( !e1 || !e2 ) || *e1 < *e2;
52 }
53 } CompareFirstOfPointerPair{};
54 // ============================================================================
55 // Compound assignment operator.
56 // ============================================================================
57 void ChronoStatSvc::merge( const ChronoStatSvc& css )
58 {
59
60 // Add the content of the maps, leave the rest unchanged
61
62 // Merge Chronomaps
63 for ( auto& item : css.m_chronoEntities ) {
64 const IChronoStatSvc::ChronoTag& key = item.first;
65 const ChronoEntity& val = item.second;
66 if ( m_chronoEntities.count( key ) )
67 m_chronoEntities[key] += val;
68 else
69 m_chronoEntities.insert( std::pair<IChronoStatSvc::ChronoTag, ChronoEntity>( key, val ) );
70 }
71
72 // Merge StatMaps
73 for ( auto& item : css.m_statEntities ) {
74 const IChronoStatSvc::StatTag& key = item.first;
75 const StatEntity& val = item.second;
76 if ( m_statEntities.count( key ) )
77 m_statEntities[key] += val;
78 else
79 m_statEntities.insert( std::pair<IChronoStatSvc::StatTag, StatEntity>( key, val ) );
80 }
81 }
82 ChronoStatSvc::ChronoStatSvc( const std::string& name, ISvcLocator* svcloc ) : base_class( name, svcloc )
83 {
84 // basically limit the integer to MSG::Level range
85 auto int2level = []( int l ) -> MSG::Level {
86 return static_cast<MSG::Level>(
87 std::max( std::min( l, static_cast<int>( MSG::FATAL ) ), static_cast<int>( MSG::NIL ) ) );
88 };
89
90 m_intStatPrintLevel.declareUpdateHandler(
91 [this, int2level]( Gaudi::Details::PropertyBase& ) { m_statPrintLevel = int2level( m_intStatPrintLevel ); } );
92 m_intChronoPrintLevel.declareUpdateHandler(
93 [this, int2level]( Gaudi::Details::PropertyBase& ) { m_chronoPrintLevel = int2level( m_intChronoPrintLevel ); } );
94 }
95 // ============================================================================
96 // Implementation of IService::initialize()
97 // ============================================================================
98 StatusCode ChronoStatSvc::initialize()
99 {
100 StatusCode sc = Service::initialize();
101 if ( sc.isFailure() ) return sc;
103 // Set my own properties
104 sc = setProperties();
105
106 if ( sc.isFailure() ) {
107 error() << "setting my properties" << endmsg;
108 return StatusCode::FAILURE;
109 }
110
111 // only add an EndEvent listener if per-event output requested
112 if ( !m_perEventFile.empty() ) {
113 m_ofd.open( m_perEventFile );
114 if ( !m_ofd.is_open() ) {
115 error() << "unable to open per-event output file \"" << m_perEventFile << "\"" << endmsg;
116 return StatusCode::FAILURE;
117 } else {
118 auto ii = serviceLocator()->service<IIncidentSvc>( "IncidentSvc" );
119 if ( !ii ) {
120 error() << "Unable to find IncidentSvc" << endmsg;
121 return StatusCode::FAILURE;
122 }
123 ii->addListener( this, IncidentType::EndEvent );
124 }
125 }
126
127 info() << " Number of skipped events for MemStat" << m_numberOfSkippedEventsForMemStat.value() << endmsg;
128
129 if ( m_chronoTableFlag && !m_printUserTime && !m_printSystemTime && !m_printEllapsedTime ) {
130 m_printUserTime = true;
131 }
133 if ( m_printUserTime || m_printSystemTime || m_printEllapsedTime ) {
134 m_chronoTableFlag = true;
135 }
138 chronoStart( name() );
140 return StatusCode::SUCCESS;
141 }
142 // ============================================================================
143 // Implementation of IService::finalize()
144 // ============================================================================
145 StatusCode ChronoStatSvc::finalize()
146 {
147 std::string local = name() + ".finalize()";
149 MsgStream main_log( msgSvc(), local );
152 chronoStop( name() );
153
154 if ( m_ofd.is_open() ) {
155 debug() << "writing per-event timing data to '" << m_perEventFile << "'" << endmsg;
156 for ( const auto& itr : m_perEvtTime ) {
157 m_ofd << itr.first.substr( 0, itr.first.length() - 8 ) << " ";
158 for ( const auto& itt : itr.second ) {
159 m_ofd << " " << (long int)( itt );
160 }
161 m_ofd << std::endl;
162 }
163
164 m_ofd.close();
165 }
166
169 if ( m_chronoTableFlag && !m_chronoEntities.empty() && ( m_printUserTime || m_printSystemTime ) ) {
171 MsgStream log( msgSvc(), "*****Chrono*****" );
172 const std::string stars( ( m_chronoCoutFlag ) ? 126 : 100, '*' );
173 if ( m_chronoCoutFlag ) {
174 std::cout << stars << std::endl;
175 std::cout << local << " The Final CPU consumption (Chrono) Table "
176 << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
177 std::cout << stars << std::endl;
178 } else {
179 log << (MSG::Level)m_chronoPrintLevel << stars << endmsg;
180 log << (MSG::Level)m_chronoPrintLevel << " The Final CPU consumption ( Chrono ) Table "
181 << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
182 log << (MSG::Level)m_chronoPrintLevel << stars << endmsg;
183 }
185 { // prepare container for printing
186 std::vector<std::pair<ChronoEntity*, const ChronoTag*>> tmpCont;
187 tmpCont.reserve( m_chronoEntities.size() );
188 for ( auto& it : m_chronoEntities ) {
189 tmpCont.emplace_back( &it.second, &it.first );
190 }
191 // sort it
192 if ( m_chronoOrderFlag ) std::sort( tmpCont.begin(), tmpCont.end(), CompareFirstOfPointerPair );
193 // print User Time statistics
194 if ( m_printUserTime ) {
195 for ( auto iter = tmpCont.begin(); tmpCont.end() != iter; ++iter ) {
196 //
197 ChronoEntity* entity = iter->first;
198 if ( !entity ) {
199 continue;
200 }
201 const ChronoTag* tag = iter->second;
202 if ( !tag ) {
203 continue;
204 }
205 entity->stop();
207 if ( m_chronoCoutFlag )
209 {
210 std::cout << *tag << "\t" << entity->outputUserTime() << std::endl;
211 } else
212 {
213 MsgStream( msgSvc(), *tag ) << m_chronoPrintLevel << entity->outputUserTime() << endmsg;
214 }
215 //
216 }
217 }
219 if ( m_printSystemTime ) {
222 if ( m_printUserTime && m_chronoCoutFlag ) {
223 std::cout << stars << std::endl;
224 } else if ( m_printUserTime && !m_chronoCoutFlag ) {
225 log << (MSG::Level)m_chronoPrintLevel << stars << endmsg;
226 }
228 for ( auto iter = tmpCont.begin(); tmpCont.end() != iter; ++iter ) {
230 ChronoEntity* entity = iter->first;
231 if ( !entity ) {
232 continue;
233 }
234 const ChronoTag* tag = iter->second;
235 if ( !tag ) {
236 continue;
237 }
238 entity->stop();
240 if ( m_chronoCoutFlag )
242 {
243 std::cout << *tag << "\t" << entity->outputSystemTime() << std::endl;
244 } else
245 {
246 MsgStream( msgSvc(), *tag ) << m_chronoPrintLevel << entity->outputSystemTime() << endmsg;
247 }
248 //
249 }
250 }
252 if ( m_printEllapsedTime ) {
255 if ( ( m_printUserTime || m_printSystemTime ) && m_chronoCoutFlag ) {
256 std::cout << stars << std::endl;
257 } else if ( ( m_printUserTime || m_printSystemTime ) && !m_chronoCoutFlag ) {
258 log << (MSG::Level)m_chronoPrintLevel << stars << endmsg;
259 }
261 for ( const auto& i : tmpCont ) {
263 ChronoEntity* entity = i.first;
264 if ( !entity ) {
265 continue;
266 }
267 const ChronoTag* tag = i.second;
268 if ( !tag ) {
269 continue;
270 }
271 entity->stop();
273 if ( m_chronoCoutFlag )
275 {
276 std::cout << *tag << "\t" << entity->outputElapsedTime() << std::endl;
277 } else
278 {
279 MsgStream( msgSvc(), *tag ) << m_chronoPrintLevel << entity->outputElapsedTime() << endmsg;
280 }
281 //
282 }
283 }
285 tmpCont.clear();
286 }
288 if ( m_chronoCoutFlag ) {
289 std::cout << stars << std::endl;
290 } else {
291 log << m_chronoPrintLevel << stars << endmsg;
292 }
293 }
294
296
298 if ( m_statTableFlag ) {
299 printStats();
300 }
301
302 if ( !m_statsOutFileName.value().empty() ) {
303 saveStats();
304 }
305
306 main_log << MSG::INFO << " Service finalized successfully " << endmsg;
307
308 return Service::finalize();
309 }
310 // ============================================================================
311 // Implementation of IChronoStatSvc::chronoStart
312 // ============================================================================
313 ChronoEntity* ChronoStatSvc::chronoStart( const ChronoTag& chronoTag )
314 {
315 ChronoEntity& entity = m_chronoEntities[chronoTag];
316 entity.start();
317 return &entity;
318 }
319 // ============================================================================
320 // Implementation of IChronoStatSvc::chronoStop
321 // ============================================================================
322 const ChronoEntity* ChronoStatSvc::chronoStop( const IChronoStatSvc::ChronoTag& chronoTag )
323 {
324 ChronoEntity& entity = m_chronoEntities[chronoTag];
325 entity.stop();
326 return &entity;
327 }
328 // ============================================================================
329 // Implementation of IChronoStatSvc::chronoDelta
330 // ============================================================================
331 IChronoStatSvc::ChronoTime ChronoStatSvc::chronoDelta( const IChronoStatSvc::ChronoTag& chronoTag,
332 IChronoStatSvc::ChronoType theType )
333 {
334 return m_chronoEntities[chronoTag].delta( theType );
335 }
336 // ============================================================================
337 // Implementation of IChronoStatSvc::chronoPrint
338 // ============================================================================
339 void ChronoStatSvc::chronoPrint( const IChronoStatSvc::ChronoTag& chronoTag )
340 {
341 MsgStream log( msgSvc(), chronoTag );
342 if ( m_printUserTime ) {
343 log << (MSG::Level)m_chronoPrintLevel << m_chronoEntities[chronoTag].outputUserTime() << endmsg;
344 }
345 if ( m_printSystemTime ) {
346 log << (MSG::Level)m_chronoPrintLevel << m_chronoEntities[chronoTag].outputSystemTime() << endmsg;
347 }
348 }
349 // ============================================================================
350 // Implementation of IChronoSvc::chronoStatus
351 // ============================================================================
352 IChronoStatSvc::ChronoStatus ChronoStatSvc::chronoStatus( const IChronoStatSvc::ChronoTag& chronoTag )
353 {
354 return m_chronoEntities[chronoTag].status();
355 }
356 // ============================================================================
357 // Implementation of IChronoStatSvc::stat
358 // ============================================================================
359 void ChronoStatSvc::stat( const IChronoStatSvc::StatTag& statTag, const IChronoStatSvc::StatFlag& statFlag )
360 {
361 auto theIter = m_statEntities.find( statTag );
362
363 StatEntity* theStat = nullptr;
364 // if new entity, specify the number of events to be skipped
365 if ( theIter == m_statEntities.end() ) {
366 // new stat entity
367 StatEntity& theSe = m_statEntities[statTag];
368 theStat = &theSe;
369 theStat->setnEntriesBeforeReset( m_numberOfSkippedEventsForMemStat );
370 } else {
371 // existing stat entity
372 theStat = &theIter->second;
373 }
374
375 theStat->addFlag( statFlag );
376 }
377 // ============================================================================
378 // Implementation of IChronoStatSvc::statPrint
379 // ============================================================================
380 void ChronoStatSvc::statPrint( const IChronoStatSvc::StatTag& statTag )
381 {
382 MsgStream log( msgSvc(), statTag );
383 log << (MSG::Level)m_statPrintLevel << m_statEntities[statTag] << endmsg;
384 }
385 // ============================================================================
386 /* extract the chrono entity for the given tag (name)
387 * @see IChronoStatSvc
388 * @param t chrono tag(name)
389 * @return pointer to chrono entity
390 */
391 // ============================================================================
392 const ChronoEntity* ChronoStatSvc::chrono( const IChronoStatSvc::ChronoTag& t ) const
393 {
394 auto it = m_chronoEntities.find( t );
395 return m_chronoEntities.end() != it ? &( it->second ) : nullptr;
396 }
397 // ============================================================================
398 /* extract the stat entity for the given tag (name)
399 * @see IChronoStatSvc
400 * @param t stat tag(name)
401 * @return pointer to stat entity
402 */
403 // ============================================================================
404 const StatEntity* ChronoStatSvc::stat( const IChronoStatSvc::StatTag& t ) const
405 {
406 auto it = m_statEntities.find( t );
407 return m_statEntities.end() != it ? &( it->second ) : nullptr;
408 }
409 // ============================================================================
410 // dump all the statistics into an ASCII file
411 // ============================================================================
412 void ChronoStatSvc::saveStats()
413 {
414 std::ofstream out( m_statsOutFileName.value(), std::ios_base::out | std::ios_base::trunc );
415 if ( !out.good() ) {
416 info() << "Could not open the output file for writing chrono statistics [" << m_statsOutFileName.value() << "]"
417 << endmsg;
418 return;
419 } else {
420 // format it our way
421 out << std::scientific << std::setprecision( 8 );
422 }
423
424 // ChronoEntity
425 std::vector<std::pair<const ChronoEntity*, const ChronoTag*>> chronos;
426 chronos.reserve( m_chronoEntities.size() );
427 std::transform( std::begin( m_chronoEntities ), std::end( m_chronoEntities ), std::back_inserter( chronos ),
428 []( ChronoMap::const_reference i ) { return std::make_pair( &i.second, &i.first ); } );
429
430 // sort it
431 std::sort( std::begin( chronos ), std::end( chronos ), CompareFirstOfPointerPair );
432
433 // print User Time statistics
434 for ( const auto& iter : chronos ) {
435 //
436 const ChronoEntity* entity = iter.first;
437 if ( !entity ) {
438 continue;
439 }
440
441 const ChronoTag* tag = iter.second;
442 if ( !tag ) {
443 continue;
444 }
445
446 // create an entry in the .INI-like table
447 out << "\n[" << *tag << "]\n";
448
449 // user
450 out << "cpu_user_total = " << entity->uTotalTime() << "\n";
451 out << "cpu_user_min = " << entity->uMinimalTime() << "\n";
452 out << "cpu_user_mean = " << entity->uMeanTime() << "\n";
453 out << "cpu_user_RMS = " << entity->uRMSTime() << "\n";
454 out << "cpu_user_max = " << entity->uMaximalTime() << "\n";
455 out << "cpu_user_nbr = " << entity->nOfMeasurements() << "\n";
456
457 // system
458 out << "\n"; // just for clarity
459 out << "cpu_system_total = " << entity->kTotalTime() << "\n";
460 out << "cpu_system_min = " << entity->kMinimalTime() << "\n";
461 out << "cpu_system_mean = " << entity->kMeanTime() << "\n";
462 out << "cpu_system_RMS = " << entity->kRMSTime() << "\n";
463 out << "cpu_system_max = " << entity->kMaximalTime() << "\n";
464 out << "cpu_system_nbr = " << entity->nOfMeasurements() << "\n";
465
466 // real
467 out << "\n"; // just for clarity
468 out << "cpu_real_total = " << entity->eTotalTime() << "\n";
469 out << "cpu_real_min = " << entity->eMinimalTime() << "\n";
470 out << "cpu_real_mean = " << entity->eMeanTime() << "\n";
471 out << "cpu_real_RMS = " << entity->eRMSTime() << "\n";
472 out << "cpu_real_max = " << entity->eMaximalTime() << "\n";
473 out << "cpu_real_nbr = " << entity->nOfMeasurements() << "\n";
474 }
475
476 out << std::endl;
477 }
478 // ============================================================================
479 // print the "Stat" part of the ChronoStatSvc
480 // ============================================================================
481 void ChronoStatSvc::printStats()
482 {
484 if ( m_statEntities.empty() ) {
485 return;
486 }
487
488 MsgStream log( msgSvc(), "******Stat******" );
490 const std::string stars( ( m_statCoutFlag ) ? 126 : 100, '*' );
492 if ( m_statCoutFlag ) {
493 std::cout << stars << std::endl;
494 std::cout << " The Final stat Table " << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
495 std::cout << stars << std::endl;
496 } else {
497 log << m_statPrintLevel << stars << endmsg;
498 log << m_statPrintLevel << " The Final stat Table " << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" )
499 << endmsg;
500 log << m_statPrintLevel << stars << endmsg;
501 }
502
503 {
504 // prepare container for printing
505 typedef std::pair<const StatEntity*, const StatTag*> SPair;
506 typedef std::vector<SPair> SCont;
507 SCont tmpCont;
508 std::transform( std::begin( m_statEntities ), std::end( m_statEntities ), std::back_inserter( tmpCont ),
509 []( StatMap::const_reference i ) { return std::make_pair( &i.second, &i.first ); } );
510 // sort it
511 if ( m_statOrderFlag ) std::sort( tmpCont.begin(), tmpCont.end(), CompareFirstOfPointerPair );
512 // print the table header
513 if ( m_statCoutFlag ) {
514 std::cout << m_header.value() << std::endl;
515 } else {
516 log << m_statPrintLevel << m_header.value() << endmsg;
517 }
518
519 // loop over counters and print them:
520 for ( const auto& iter : tmpCont ) {
522 const StatEntity* entity = iter.first;
523 if ( !entity ) {
524 continue;
525 }
526 const StatTag* tag = iter.second;
527 if ( !tag ) {
528 continue;
529 }
530 if ( m_statCoutFlag ) {
532 std::cout << Gaudi::Utils::formatAsTableRow( *tag, *entity, m_useEffFormat, m_format1, m_format2 ) << std::endl;
533 } else {
534 log << m_statPrintLevel << Gaudi::Utils::formatAsTableRow( *tag, *entity, m_useEffFormat, m_format1, m_format2 )
535 << endmsg;
536 }
537 }
538 tmpCont.clear();
539 }
541 if ( m_statCoutFlag ) {
542 std::cout << stars << std::endl;
543 } else {
544 log << m_statPrintLevel << stars << endmsg;
545 }
546 }
547
548 // ============================================================================
549
550 void ChronoStatSvc::handle( const Incident& /* inc */ )
551 {
552
553 if ( !m_ofd.is_open() ) return;
554
555 for ( const auto& itr : m_chronoEntities ) {
556 if ( itr.first.find( ":Execute" ) == std::string::npos ) continue;
557
558 auto itm = m_perEvtTime.find( itr.first );
559 if ( itm == m_perEvtTime.end() ) {
560 m_perEvtTime[itr.first] = {itr.second.delta( IChronoSvc::ELAPSED )};
561 } else {
562 itm->second.push_back( itr.second.delta( IChronoSvc::ELAPSED ) );
563 }
564 }
565 }
566
567 // ============================================================================
568 // The END
569 // ============================================================================
ChronoStatSvc::m_intStatPrintLevel
Gaudi::Property< int > m_intStatPrintLevel
Definition: ChronoStatSvc.h:156
ChronoEntity::outputElapsedTime
std::string outputElapsedTime() const
print the chrono ;
Definition: ChronoEntity.cpp:110
ChronoEntity::kMaximalTime
double kMaximalTime() const
maximal measurement for kernel time
Definition: ChronoEntity.h:219
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
StatusCode::SUCCESS
Definition: StatusCode.h:30
Kernel.h
std::map::empty
T empty(T...args)
ChronoEntity::uMinimalTime
double uMinimalTime() const
minimal measurement for user time
Definition: ChronoEntity.h:198
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
std::ofstream::open
T open(T...args)
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
ChronoEntity::uTotalTime
double uTotalTime() const
total user time
Definition: ChronoEntity.h:229
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
StatusCode::FAILURE
Definition: StatusCode.h:29
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:174
MsgStream.h
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
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
ChronoEntity::kTotalTime
double kTotalTime() const
total Kernel time
Definition: ChronoEntity.h:234
ChronoStatSvc::m_numberOfSkippedEventsForMemStat
Gaudi::Property< long > m_numberOfSkippedEventsForMemStat
Definition: ChronoStatSvc.h:159
std::endl
T endl(T...args)
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.h
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
ChronoEntity::uRMSTime
double uRMSTime() const
r.m.s User Time
Definition: ChronoEntity.h:270
std::vector::end
T end(T...args)
ChronoEntity::kMinimalTime
double kMinimalTime() const
minimal measurement for kernel time
Definition: ChronoEntity.h:204
ChronoEntity::eMinimalTime
double eMinimalTime() const
minimal measurement for elapsed time
Definition: ChronoEntity.h:209
ChronoEntity::kRMSTime
double kRMSTime() const
r.m.s Kernel Time
Definition: ChronoEntity.h:265
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
ChronoEntity::outputSystemTime
std::string outputSystemTime() const
print the chrono ;
Definition: ChronoEntity.cpp:98
ChronoEntity::start
IChronoSvc::ChronoStatus start()
start the current chrono
Definition: ChronoEntity.cpp:47
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
Gaudi::Utils::formatAsTableRow
GAUDI_API std::string formatAsTableRow(const StatEntity &counter, const bool flag, const std::string &format1=" |%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |", const std::string &format2="*|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |")
print the counter in a form of the table row
Definition: StatEntity.cpp:326
std::string
STL class.
StatEntity::setnEntriesBeforeReset
void setnEntriesBeforeReset(unsigned long nEntriesBeforeReset)
DR specify number of entry before reset.
Definition: StatEntity.cpp:246
std::min
T min(T...args)
HepRndm::Engine
Definition: HepRndmEngine.h:26
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::FATAL
Definition: IMessageSvc.h:22
ChronoEntity::kMeanTime
double kMeanTime() const
average Kernel Time
Definition: ChronoEntity.h:250
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
MSG::Level
Level
Definition: IMessageSvc.h:15
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
std::ofstream
STL class.
ChronoEntity::eMeanTime
double eMeanTime() const
average Elapsed Time
Definition: ChronoEntity.h:260
ChronoStatSvc::merge
void merge(const ChronoStatSvc &css)
Compound assignment operator.
Definition: ChronoStatSvc.cpp:57
HiveAlgSequencer.p2
p2
Definition: HiveAlgSequencer.py:23
ChronoStatSvc::ChronoStatSvc
ChronoStatSvc()=delete
CompareFirstOfPointerPair_t::operator()
bool operator()(const std::pair< S *, T * > &p1, const std::pair< S *, T * > &p2) const
Definition: ChronoStatSvc.cpp:47
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
IIncidentSvc.h
CompareFirstOfPointerPair
constexpr struct CompareFirstOfPointerPair_t CompareFirstOfPointerPair
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
MsgStream::clear
void clear(STATE_TYPE _i=std::ios_base::failbit)
Definition: MsgStream.h:222
ChronoStatSvc::m_perEvtTime
TimeMap m_perEvtTime
Definition: ChronoStatSvc.h:184
ChronoStatSvc::m_format2
Gaudi::Property< std::string > m_format2
Definition: ChronoStatSvc.h:174
std::ofstream::close
T close(T...args)
ChronoStatSvc::chronoStop
virtual const ChronoEntity * chronoStop(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStop.
Definition: ChronoStatSvc.cpp:322
MSG::NIL
Definition: IMessageSvc.h:16
ChronoStatSvc::m_statOrderFlag
Gaudi::Property< bool > m_statOrderFlag
Definition: ChronoStatSvc.h:157
std::make_pair
T make_pair(T...args)
ChronoEntity::eRMSTime
double eRMSTime() const
r.m.s Elapsed Time
Definition: ChronoEntity.h:275
ChronoStatSvc::m_chronoTableFlag
Gaudi::Property< bool > m_chronoTableFlag
Definition: ChronoStatSvc.h:143
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
std::vector::clear
T clear(T...args)
ChronoStatSvc::m_ofd
std::ofstream m_ofd
Definition: ChronoStatSvc.h:185
ChronoStatSvc::m_format1
Gaudi::Property< std::string > m_format1
Definition: ChronoStatSvc.h:171
std::max
T max(T...args)
StatEntity::addFlag
unsigned long addFlag(const double Flag)
add a flag
Definition: StatEntity.h:417
Service::setProperties
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
Definition: Service.cpp:295
IChronoSvc::ELAPSED
Definition: IChronoSvc.h:57
std::map::count
T count(T...args)
std::scientific
T scientific(T...args)
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
gaudirun.l
dictionary l
Definition: gaudirun.py:421
std::pair
ChronoStatSvc::m_printEllapsedTime
Gaudi::Property< bool > m_printEllapsedTime
Definition: ChronoStatSvc.h:151
std::map::insert
T insert(T...args)
ChronoEntity::uMeanTime
double uMeanTime() const
average User Time
Definition: ChronoEntity.h:255
ChronoEntity::outputUserTime
std::string outputUserTime() const
print the chrono ;
Definition: ChronoEntity.cpp:85
std::map::find
T find(T...args)
std::map::size
T size(T...args)
e2
HepRndm::Engine< TripleRand > e2
Definition: HepRndmEngines.cpp:194
std::vector
STL class.
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:126
std::vector::begin
T begin(T...args)
ChronoStatSvc::handle
void handle(const Incident &incident) override
Definition: ChronoStatSvc.cpp:550
std::back_inserter
T back_inserter(T...args)
ChronoStatSvc::m_statTableFlag
Gaudi::Property< bool > m_statTableFlag
Definition: ChronoStatSvc.h:152
ChronoEntity::eMaximalTime
double eMaximalTime() const
maximal measurement for elapsed time
Definition: ChronoEntity.h:224
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
StatEntity.h
HiveAlgSequencer.p1
p1
Definition: HiveAlgSequencer.py:22
CommonMessaging
Definition: CommonMessaging.h:55
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:70
Stat.h
CompareFirstOfPointerPair_t
Definition: ChronoStatSvc.cpp:45
ChronoEntity::nOfMeasurements
unsigned long nOfMeasurements() const
number of chrono measurements
Definition: ChronoEntity.h:194
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
std::sort
T sort(T...args)
std::transform
T transform(T...args)
StatusCode.h
StatEntity
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:65
std::ofstream::is_open
T is_open(T...args)
MSG::INFO
Definition: IMessageSvc.h:19
ChronoEntity::stop
IChronoSvc::ChronoStatus stop()
stop the chrono
Definition: ChronoEntity.cpp:63
ChronoEntity::uMaximalTime
double uMaximalTime() const
maximal measurement for user time
Definition: ChronoEntity.h:214
std::setprecision
T setprecision(T...args)
ChronoEntity.h
std::cout
ChronoEntity::eTotalTime
double eTotalTime() const
total Elapsed time
Definition: ChronoEntity.h:239
ChronoStatSvc::chronoPrint
virtual void chronoPrint(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoPrint.
Definition: ChronoStatSvc.cpp:339
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
ChronoStatSvc
The Chrono & Stat Sservice: service implements the IChronoStatSvc interface and provides the basic ch...
Definition: ChronoStatSvc.h:33
std::vector::reserve
T reserve(T...args)
Gaudi.Configuration.log
log
Definition: Configuration.py:13
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134
std::vector::emplace_back
T emplace_back(T...args)
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