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 <iostream>
8 #include <iomanip>
9 #include <string>
10 #include <algorithm>
11 #include <functional>
12 #include <fstream>
13 #include <iomanip>
14 // ============================================================================
15 // GaudiKernel
16 // ============================================================================
17 #include "GaudiKernel/Kernel.h"
18 #include "GaudiKernel/StatusCode.h"
19 #include "GaudiKernel/IChronoStatSvc.h"
20 #include "GaudiKernel/MsgStream.h"
21 #include "GaudiKernel/ChronoEntity.h"
22 #include "GaudiKernel/StatEntity.h"
23 #include "GaudiKernel/Stat.h"
24 #include "GaudiKernel/IIncidentSvc.h"
25 // ============================================================================
27 // ============================================================================
28 #include "ChronoStatSvc.h"
29 // ============================================================================
32 // ============================================================================
34 // ============================================================================
41 // ============================================================================
42 // ============================================================================
43 // comparison functor
44 // ============================================================================
46 {
47  template <typename S, typename T>
48  inline bool operator() ( const std::pair<S*,T*>& p1,
49  const std::pair<S*,T*>& p2) const
50  {
51  auto e1 = p1.first;
52  auto e2 = p2.first;
53  return ( !e1 || !e2 ) || *e1<*e2 ;
54  }
56 // ============================================================================
57 // Constructor
58 // ============================================================================
60 ( const std::string& name, ISvcLocator* svcloc )
61  : base_class( name , svcloc )
62  //
63  // the header row
64  , m_header ( " Counter | # | sum | mean/eff^* | rms/err^* | min | max |")
65  // format for regular statistical printout rows
66  , m_format1 ( " %|-15.15s|%|17t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" )
67  // format for "efficiency" statistical printout rows
68  , m_format2 ( "*%|-15.15s|%|17t||%|10d| |%|11.5g| |(%|#9.7g| +- %|-#9.7g|)%%| ------- | ------- |" )
69 {
71  declareProperty ( "ChronoPrintOutTable" ,
72  m_chronoTableFlag = true );
74  declareProperty ( "ChronoDestinationCout" ,
75  m_chronoCoutFlag = false );
77  declareProperty ( "ChronoPrintLevel" ,
78  m_intChronoPrintLevel = MSG::INFO );
81  declareProperty ( "ChronoTableToBeOrdered" ,
82  m_chronoOrderFlag = true );
84  declareProperty ( "PrintUserTime" ,
85  m_printUserTime = true );
87  declareProperty ( "PrintSystemTime" ,
88  m_printSystemTime = false );
90  declareProperty ( "PrintEllapsedTime" ,
91  m_printEllapsedTime = false );
94  declareProperty ( "StatPrintOutTable" ,
95  m_statTableFlag = true );
97  declareProperty ( "StatDestinationCout" ,
98  m_statCoutFlag = false );
100  declareProperty ( "StatPrintLevel" ,
101  m_intStatPrintLevel = MSG::INFO );
104  declareProperty ( "StatTableToBeOrdered" ,
105  m_statOrderFlag = true );
106 
107  // specify the number of events to be skipped by the memory auditor
108  // in order to better spot memory leak
109  declareProperty ( "NumberOfSkippedEventsForMemStat" ,
110  m_numberOfSkippedEventsForMemStat = -1 ) ;
111 
112  declareProperty( "AsciiStatsOutputFile",
113  m_statsOutFileName = "",
114  "Name of the output file storing the stats. If empty, no"
115  " statistics will be saved (default)" );
116 
117  declareProperty
118  ( "StatTableHeader" , m_header ,
119  "The header row for the output Stat-table" ) ;
120  declareProperty
121  ( "RegularRowFormat" , m_format1 ,
122  "The format for the regular row in the output Stat-table" ) ;
123  declareProperty
124  ( "EfficiencyRowFormat" , m_format2 ,
125  "The format for the regular row in the output Stat-table" ) ;
126  declareProperty
127  ( "UseEfficiencyRowFormat" , m_useEffFormat ,
128  "Use the special format for printout of efficiency counters" ) ;
129 
130  declareProperty
131  ( "PerEventFile", m_perEventFile="",
132  "File name for per-event deltas" );
133 
134 }
135 // ============================================================================
136 // Implementation of IService::initialize()
137 // ============================================================================
139 {
141  if ( sc.isFailure() ) return sc;
143  MsgStream log( msgSvc() , this->name() );
144 
145  // Set my own properties
146  sc = setProperties();
147 
148  if (sc.isFailure()) {
149  log << MSG::ERROR << "setting my properties" << endmsg;
150  return StatusCode::FAILURE;
151  }
152 
153  // only add an EndEvent listener if per-event output requested
154  if (!m_perEventFile.empty()) {
155  m_ofd.open(m_perEventFile);
156  if (!m_ofd.is_open()) {
157  log << MSG::ERROR << "unable to open per-event output file \""
158  << m_perEventFile << "\"" << endmsg;
159  return StatusCode::FAILURE;
160  } else {
161  auto ii = serviceLocator()->service<IIncidentSvc>("IncidentSvc");
162  if ( !ii) {
163  log << MSG::ERROR << "Unable to find IncidentSvc" << endmsg;
164  return StatusCode::FAILURE;
165  }
166  ii->addListener(this, IncidentType::EndEvent);
167  }
168  }
169 
170  log << MSG::INFO << " Number of skipped events for MemStat"
172 
186  if( m_chronoTableFlag &&
187  !m_printUserTime &&
189  !m_printEllapsedTime ) { m_printUserTime = true ; }
191  if( m_printUserTime ||
196  chronoStart( name() ) ;
198  return StatusCode::SUCCESS;
199 }
200 // ============================================================================
201 // Implementation of IService::finalize()
202 // ============================================================================
204 {
205  std::string local = name()+".finalize()";
207  MsgStream main_log( msgSvc() , local );
210  chronoStop( name() ) ;
211 
212  if (m_ofd.is_open()) {
213  MsgStream log(msgSvc(), name());
214  log << MSG::DEBUG << "writing per-event timing data to '" << m_perEventFile << "'" << endmsg;
215  for (const auto& itr:m_perEvtTime) {
216  m_ofd << itr.first.substr(0,itr.first.length()-8 ) << " ";
217  for (const auto& itt:itr.second) {
218  m_ofd << " " << (long int)(itt);
219  }
220  m_ofd << std::endl;
221  }
222 
223  m_ofd.close();
224  }
225 
228  if ( m_chronoTableFlag &&
229  !m_chronoEntities.empty() &&
231  {
233  MsgStream log( msgSvc() , "*****Chrono*****" );
234  const std::string stars( ( m_chronoCoutFlag ) ? 126 : 100 , '*' );
235  if( m_chronoCoutFlag )
236  {
237  std::cout << stars << std::endl;
238  std::cout << local << " The Final CPU consumption (Chrono) Table "
239  << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
240  std::cout << stars << std::endl;
241  }
242  else
243  {
245  << stars << endmsg;
247  << " The Final CPU consumption ( Chrono ) Table "
248  << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
249  log << (MSG::Level) m_chronoPrintLevel << stars << endmsg;
250  }
252  { // prepare container for printing
253  std::vector<std::pair<ChronoEntity*,const ChronoTag*>> tmpCont;
254  tmpCont.reserve(m_chronoEntities.size());
255  for( auto& it : m_chronoEntities )
256  { tmpCont.emplace_back( &it.second , &it.first ) ; }
257  // sort it
258  if( m_chronoOrderFlag ) std::sort( tmpCont.begin(), tmpCont.end(),
260  // print User Time statistics
261  if( m_printUserTime )
262  {
263  for( auto iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
264  {
265  //
266  ChronoEntity* entity = iter->first ; if( !entity ) { continue ; }
267  const ChronoTag* tag = iter->second ; if( !tag ) { continue ; }
268  entity->stop();
270  if ( m_chronoCoutFlag )
272  { std::cout << *tag << "\t" << entity->outputUserTime () << std::endl ; }
273  else
274  {
275  MsgStream(msgSvc(), *tag)
276  << m_chronoPrintLevel << entity->outputUserTime () << endmsg ;
277  }
278  //
279  }
280  }
282  if( m_printSystemTime )
283  {
287  { std::cout << stars << std::endl; }
288  else if ( m_printUserTime && !m_chronoCoutFlag )
289  { log << (MSG::Level) m_chronoPrintLevel << stars << endmsg; }
291  for( auto iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
292  {
294  ChronoEntity* entity = iter->first ; if( !entity ) { continue ; }
295  const ChronoTag* tag = iter->second ; if( !tag ) { continue ; }
296  entity->stop();
298  if ( m_chronoCoutFlag )
300  { std::cout << *tag << "\t" << entity->outputSystemTime() << std::endl ; }
301  else
302  {
303  MsgStream(msgSvc(), *tag)
304  << m_chronoPrintLevel << entity->outputSystemTime() << endmsg ;
305  }
306  //
307  }
308  }
310  if( m_printEllapsedTime )
311  {
315  { std::cout << stars << std::endl; }
316  else if ( ( m_printUserTime || m_printSystemTime ) && !m_chronoCoutFlag )
317  { log << (MSG::Level) m_chronoPrintLevel << stars << endmsg; }
319  for( const auto& i : tmpCont )
320  {
322  ChronoEntity* entity = i.first ; if( !entity ) { continue ; }
323  const ChronoTag* tag = i.second ; if( !tag ) { continue ; }
324  entity->stop();
326  if ( m_chronoCoutFlag )
328  { std::cout << *tag << "\t" << entity->outputElapsedTime() << std::endl ; }
329  else
330  {
331  MsgStream(msgSvc(), *tag)
332  << m_chronoPrintLevel << entity->outputElapsedTime() << endmsg ;
333  }
334  //
335  }
336  }
338  tmpCont.clear();
339  }
341  if( m_chronoCoutFlag ) { std::cout << stars << std::endl; }
342  else { log << m_chronoPrintLevel << stars << endmsg; }
343  }
344 
346 
348  if ( m_statTableFlag ) { printStats () ; }
349 
350  if ( !m_statsOutFileName.value().empty() ) {
351  saveStats();
352  }
353 
354  main_log << MSG::INFO << " Service finalized successfully " << endmsg;
355 
356  return Service::finalize();
357 }
358 // ============================================================================
359 // Implementation of IChronoStatSvc::chronoStart
360 // ============================================================================
363 ( const ChronoTag& chronoTag )
364 {
365  ChronoEntity& entity = m_chronoEntities [ chronoTag ] ;
366  entity.start() ;
367  return &entity ;
368 }
369 // ============================================================================
370 // Implementation of IChronoStatSvc::chronoStop
371 // ============================================================================
372 const ChronoEntity*
374 ( const IChronoStatSvc::ChronoTag& chronoTag )
375 {
376  ChronoEntity& entity = m_chronoEntities [ chronoTag ] ;
377  entity.stop() ;
378  return &entity ;
379 }
380 // ============================================================================
381 // Implementation of IChronoStatSvc::chronoDelta
382 // ============================================================================
383 IChronoStatSvc::ChronoTime
385 ( const IChronoStatSvc::ChronoTag& chronoTag,
386  IChronoStatSvc::ChronoType theType )
387 {
388  return m_chronoEntities[ chronoTag ].delta( theType );
389 }
390 // ============================================================================
391 // Implementation of IChronoStatSvc::chronoPrint
392 // ============================================================================
394 ( const IChronoStatSvc::ChronoTag& chronoTag )
395 {
396  MsgStream log ( msgSvc() , chronoTag );
397  if( m_printUserTime ) {
398  log << (MSG::Level) m_chronoPrintLevel
399  << m_chronoEntities[ chronoTag ].outputUserTime ()
400  << endmsg;
401  }
402  if( m_printSystemTime ) {
403  log << (MSG::Level) m_chronoPrintLevel
404  << m_chronoEntities[ chronoTag ].outputSystemTime()
405  << endmsg;
406  }
407 }
408 // ============================================================================
409 // Implementation of IChronoSvc::chronoStatus
410 // ============================================================================
411 IChronoStatSvc::ChronoStatus
413 ( const IChronoStatSvc::ChronoTag& chronoTag )
414 { return m_chronoEntities[ chronoTag ].status(); }
415 // ============================================================================
416 // Implementation of IChronoStatSvc::stat
417 // ============================================================================
419 ( const IChronoStatSvc::StatTag & statTag ,
420  const IChronoStatSvc::StatFlag & statFlag )
421 {
422  auto theIter=m_statEntities.find(statTag);
423 
424  StatEntity * theStat=nullptr ;
425  // if new entity, specify the number of events to be skipped
426  if (theIter==m_statEntities.end()){
427  // new stat entity
428  StatEntity& theSe = m_statEntities[ statTag ];
429  theStat=& theSe;
430  theStat->setnEntriesBeforeReset(m_numberOfSkippedEventsForMemStat);
431  }
432  else
433  {
434  //existing stat entity
435  theStat=&theIter->second;
436  }
437 
438  theStat->addFlag ( statFlag ) ;
439 }
440 // ============================================================================
441 // Implementation of IChronoStatSvc::statPrint
442 // ============================================================================
444 ( const IChronoStatSvc::StatTag& statTag )
445 {
446  MsgStream log ( msgSvc() , statTag ) ;
447  log << (MSG::Level) m_statPrintLevel << m_statEntities[ statTag ] << endmsg;
448 }
449 // ============================================================================
450 /* extract the chrono entity for the given tag (name)
451  * @see IChronoStatSvc
452  * @param t chrono tag(name)
453  * @return pointer to chrono entity
454  */
455 // ============================================================================
457 ( const IChronoStatSvc::ChronoTag& t ) const
458 {
459  auto it = m_chronoEntities.find ( t ) ;
460  return m_chronoEntities.end() != it ? &(it->second) : nullptr;
461 }
462 // ============================================================================
463 /* extract the stat entity for the given tag (name)
464  * @see IChronoStatSvc
465  * @param t stat tag(name)
466  * @return pointer to stat entity
467  */
468 // ============================================================================
470 ( const IChronoStatSvc::StatTag& t ) const
471 {
472  auto it = m_statEntities.find ( t ) ;
473  return m_statEntities.end() != it ? &(it->second) : nullptr;
474 }
475 // ============================================================================
476 // dump all the statistics into an ASCII file
477 // ============================================================================
479 {
480  std::ofstream out( m_statsOutFileName.value(),
481  std::ios_base::out | std::ios_base::trunc );
482  if ( !out.good() ) {
483  MsgStream msg( msgSvc() , name() );
484  msg << MSG::INFO
485  << "Could not open the output file for writing chrono statistics ["
486  << m_statsOutFileName.value() << "]"
487  << endmsg;
488  return;
489  } else {
490  // format it our way
491  out << std::scientific << std::setprecision(8) ;
492  }
493 
494  // ChronoEntity
495  std::vector<std::pair<const ChronoEntity*, const ChronoTag*> > chronos;
496  chronos.reserve(m_chronoEntities.size() );
498  std::back_inserter(chronos),
499  [](ChronoMap::const_reference i)
500  { return std::make_pair( &i.second, &i.first ); } );
501 
502  // sort it
503  std::sort( std::begin(chronos) ,
504  std::end(chronos) ,
506 
507  // print User Time statistics
508  for( const auto& iter : chronos ) {
509  //
510  const ChronoEntity* entity = iter.first;
511  if( !entity ) { continue ; }
512 
513  const ChronoTag* tag = iter.second ;
514  if( !tag ) { continue ; }
515 
516  // create an entry in the .INI-like table
517  out << "\n[" << *tag << "]\n";
518 
519  // user
520  out << "cpu_user_total = " << entity->uTotalTime() << "\n";
521  out << "cpu_user_min = " << entity->uMinimalTime() << "\n";
522  out << "cpu_user_mean = " << entity->uMeanTime() << "\n";
523  out << "cpu_user_RMS = " << entity->uRMSTime() << "\n";
524  out << "cpu_user_max = " << entity->uMaximalTime() << "\n";
525  out << "cpu_user_nbr = " << entity->nOfMeasurements() << "\n";
526 
527  // system
528  out << "\n"; // just for clarity
529  out << "cpu_system_total = " << entity->kTotalTime() << "\n";
530  out << "cpu_system_min = " << entity->kMinimalTime() << "\n";
531  out << "cpu_system_mean = " << entity->kMeanTime() << "\n";
532  out << "cpu_system_RMS = " << entity->kRMSTime() << "\n";
533  out << "cpu_system_max = " << entity->kMaximalTime() << "\n";
534  out << "cpu_system_nbr = " << entity->nOfMeasurements() << "\n";
535 
536  // real
537  out << "\n"; // just for clarity
538  out << "cpu_real_total = " << entity->eTotalTime() << "\n";
539  out << "cpu_real_min = " << entity->eMinimalTime() << "\n";
540  out << "cpu_real_mean = " << entity->eMeanTime() << "\n";
541  out << "cpu_real_RMS = " << entity->eRMSTime() << "\n";
542  out << "cpu_real_max = " << entity->eMaximalTime() << "\n";
543  out << "cpu_real_nbr = " << entity->nOfMeasurements() << "\n";
544 
545  }
546 
547  out << std::endl;
548 }
549 // ============================================================================
550 // print the "Stat" part of the ChronoStatSvc
551 // ============================================================================
553 {
555  if ( m_statEntities.empty() ) { return ; }
556 
557  MsgStream log ( msgSvc() , "******Stat******" ) ;
559  const std::string stars( ( m_statCoutFlag ) ? 126 : 100 , '*' ) ;
561  if ( m_statCoutFlag )
562  {
563  std::cout << stars << std::endl;
564  std::cout << " The Final stat Table "
565  << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
566  std::cout << stars << std::endl;
567  }
568  else
569  {
570  log << m_statPrintLevel << stars << endmsg;
571  log << m_statPrintLevel << " The Final stat Table "
572  << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
573  log << m_statPrintLevel << stars << endmsg;
574  }
575 
576  {
577  // prepare container for printing
578  typedef std::pair<const StatEntity*,const StatTag*> SPair;
579  typedef std::vector<SPair> SCont;
580  SCont tmpCont;
582  std::back_inserter(tmpCont),
583  [](StatMap::const_reference i)
584  { return std::make_pair( &i.second, &i.first); } );
585  // sort it
586  if ( m_statOrderFlag ) std::sort( tmpCont.begin(), tmpCont.end(),
588  // print the table header
589  if ( m_statCoutFlag ) { std::cout << m_header << std::endl ; }
590  else { log << m_statPrintLevel << m_header << endmsg ; }
591 
592  // loop over counters and print them:
593  for ( const auto& iter : tmpCont ) {
595  const StatEntity* entity = iter.first ;
596  if ( !entity ) { continue ; }
597  const StatTag* tag = iter.second ;
598  if ( !tag ) { continue ; }
599  if ( m_statCoutFlag )
601  {
602  std::cout
604  ( *tag , *entity , m_useEffFormat , m_format1 , m_format2 )
605  << std::endl;
606  }
607  else
608  {
609  log
612  ( *tag , *entity , m_useEffFormat , m_format1 , m_format2 )
613  << endmsg ;
614  }
615  }
616  tmpCont.clear();
617  }
619  if ( m_statCoutFlag ) { std::cout << stars << std::endl; }
620  else { log << m_statPrintLevel << stars << endmsg; }
621 }
622 
623 // ============================================================================
624 
625 void ChronoStatSvc::handle(const Incident& /* inc */) {
626 
627  if (! m_ofd.is_open()) return;
628 
629  for (const auto& itr:m_chronoEntities) {
630  if (itr.first.find(":Execute") == std::string::npos) continue;
631 
632  auto itm = m_perEvtTime.find(itr.first);
633  if (itm == m_perEvtTime.end()) {
634  m_perEvtTime[itr.first] = { itr.second.delta(IChronoSvc::ELAPSED) };
635  } else {
636  itm->second.push_back( itr.second.delta(IChronoSvc::ELAPSED) );
637  }
638  }
639 }
640 
641 // ============================================================================
642 // The END
643 // ============================================================================
std::string outputElapsedTime() const
print the chrono ;
bool m_useEffFormat
flag to use the special "efficiency" format
int m_intStatPrintLevel
level of info printing
double kMaximalTime() const
maximal measurement for kernel time
Definition: ChronoEntity.h:216
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode initialize() override
Definition: Service.cpp:62
double uMinimalTime() const
minimal measurement for user time
Definition: ChronoEntity.h:195
bool m_chronoOrderFlag
flag for formattion the final statistic table
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
bool m_printUserTime
flag for printing User quantities
double uTotalTime() const
total user time
Definition: ChronoEntity.h:226
virtual ChronoStatus chronoStatus(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStatus.
StatusCode finalize() override
Definition: Service.cpp:187
tuple itm
Definition: ana.py:57
StatMap m_statEntities
stat part
bool m_printEllapsedTime
flag for printing Ellapsed quantities
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
std::string m_header
the header row
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:45
virtual IChronoStatSvc::ChronoTime chronoDelta(const IChronoStatSvc::ChronoTag &chronoTag, IChronoStatSvc::ChronoType theType) override
Implementation of IchronoStatSvc::chronoDelta.
double kTotalTime() const
total Kernel time
Definition: ChronoEntity.h:231
StringProperty m_statsOutFileName
Name of the output file where we'll dump the stats.
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.
double uRMSTime() const
r.m.s User Time
Definition: ChronoEntity.h:267
double kMinimalTime() const
minimal measurement for kernel time
Definition: ChronoEntity.h:201
double eMinimalTime() const
minimal measurement for elapsed time
Definition: ChronoEntity.h:206
double kRMSTime() const
r.m.s Kernel Time
Definition: ChronoEntity.h:262
virtual void statPrint(const IChronoStatSvc::ChronoTag &statTag) override
prints (using message service) info about statistical entity, tagged by its name
long m_numberOfSkippedEventsForMemStat
std::string outputSystemTime() const
print the chrono ;
IChronoSvc::ChronoStatus start()
start the current chrono
std::string m_format2
format for "efficiency" statistical printout rows
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
bool m_chronoTableFlag
flag for printing the final table
int m_intChronoPrintLevel
level of info printing
void setnEntriesBeforeReset(unsigned long nEntriesBeforeReset)
DR specify number of entry before reset.
Definition: StatEntity.cpp:219
double kMeanTime() const
average Kernel Time
Definition: ChronoEntity.h:247
const std::string EndEvent
Processing of the last event has finished.
Definition: Incident.h:61
double eMeanTime() const
average Elapsed Time
Definition: ChronoEntity.h:257
ChronoStatSvc()=delete
void saveStats()
dump the statistics into an ASCII file for offline processing
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
bool m_statOrderFlag
flag for formattion the final statistic table
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
constexpr struct CompareFirstOfPointerPair_t CompareFirstOfPointerPair
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
void clear(STATE_TYPE _i=std::ios_base::failbit)
Definition: MsgStream.h:222
TimeMap m_perEvtTime
virtual const ChronoEntity * chronoStop(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStop.
double eRMSTime() const
r.m.s Elapsed Time
Definition: ChronoEntity.h:272
std::ofstream m_ofd
bool m_statTableFlag
flag for printing the final table
const TYPE & value() const
explicit conversion
Definition: Property.h:341
unsigned long addFlag(const double Flag)
add a flag
Definition: StatEntity.h:412
MSG::Level m_chronoPrintLevel
StatusCode initialize() override
Implementation of IService::initialize()
double uMeanTime() const
average User Time
Definition: ChronoEntity.h:252
std::string outputUserTime() const
print the chrono ;
bool m_statCoutFlag
flag for destination of the t he final table
bool m_printSystemTime
flag for printing System quantities
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
void handle(const Incident &incident) override
double eMaximalTime() const
maximal measurement for elapsed time
Definition: ChronoEntity.h:221
Base class for all Incidents (computing events).
Definition: Incident.h:16
virtual ChronoEntity * chronoStart(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStart.
std::string m_perEventFile
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:299
unsigned long nOfMeasurements() const
number of chrono measurements
Definition: ChronoEntity.h:191
MSG::Level m_statPrintLevel
bool m_chronoCoutFlag
flag for destination of the the final table
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:64
IChronoSvc::ChronoStatus stop()
stop the chrono
double uMaximalTime() const
maximal measurement for user time
Definition: ChronoEntity.h:211
list i
Definition: ana.py:128
double eTotalTime() const
total Elapsed time
Definition: ChronoEntity.h:236
virtual void chronoPrint(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoPrint.
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:21
std::string m_format1
format for regular statistical printout rows
The Chrono & Stat Sservice: service implements the IChronoStatSvc interface and provides the basic ch...
Definition: ChronoStatSvc.h:33
ChronoMap m_chronoEntities
chrono part
StatusCode finalize() override
Implementation of IService::finalize()
virtual const ChronoEntity * chrono(const IChronoStatSvc::ChronoTag &t) const override
extract the chrono entity for the given tag (name)