The Gaudi Framework  master (37c0b60a)
ChronoStatSvc.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifdef _WIN32
12 # pragma warning( disable : 4786 )
13 #endif
14 // ============================================================================
15 // STD & STL
16 // ============================================================================
17 #include <algorithm>
18 #include <fstream>
19 #include <functional>
20 #include <iomanip>
21 #include <iostream>
22 #include <string>
23 // ============================================================================
24 // GaudiKernel
25 // ============================================================================
30 #include <GaudiKernel/Kernel.h>
31 #include <GaudiKernel/MsgStream.h>
32 #include <GaudiKernel/Stat.h>
33 #include <GaudiKernel/StatEntity.h>
34 #include <GaudiKernel/StatusCode.h>
35 // ============================================================================
37 // ============================================================================
38 #include "ChronoStatSvc.h"
39 // ============================================================================
42 // ============================================================================
44 // ============================================================================
51 // ============================================================================
52 // ============================================================================
53 // comparison functor
54 // ============================================================================
55 constexpr struct CompareFirstOfPointerPair_t {
56  template <typename S, typename T>
57  inline bool operator()( const std::pair<S*, T*>& p1, const std::pair<S*, T*>& p2 ) const {
58  auto e1 = p1.first;
59  auto e2 = p2.first;
60  return ( !e1 || !e2 ) || *e1 < *e2;
61  }
63 // ============================================================================
64 // Compound assignment operator.
65 // ============================================================================
66 void ChronoStatSvc::merge( const ChronoStatSvc& css ) {
67 
68  // Add the content of the maps, leave the rest unchanged
69 
70  auto lock = std::scoped_lock{ m_mutex, css.m_mutex };
71  // Merge Chronomaps
72  for ( auto& item : css.m_chronoEntities ) {
73  const IChronoStatSvc::ChronoTag& key = item.first;
74  const ChronoEntity& val = item.second;
75  if ( m_chronoEntities.count( key ) )
76  m_chronoEntities[key] += val;
77  else
79  }
80 
81  // Merge StatMaps
82  for ( auto& item : css.m_statEntities ) {
83  const IChronoStatSvc::StatTag& key = item.first;
84  const StatEntity& val = item.second;
85  if ( m_statEntities.count( key ) )
86  m_statEntities[key] += val;
87  else
88  m_statEntities.emplace( key, val );
89  }
90 }
91 // ============================================================================
92 // Implementation of IService::initialize()
93 // ============================================================================
96  if ( sc.isFailure() ) return sc;
97 
98  // only add an EndEvent listener if per-event output requested
99  if ( !m_perEventFile.empty() ) {
101  if ( !m_ofd.is_open() ) {
102  error() << "unable to open per-event output file \"" << m_perEventFile << "\"" << endmsg;
103  return StatusCode::FAILURE;
104  } else {
105  auto ii = serviceLocator()->service<IIncidentSvc>( "IncidentSvc" );
106  if ( !ii ) {
107  error() << "Unable to find IncidentSvc" << endmsg;
108  return StatusCode::FAILURE;
109  }
110  ii->addListener( this, IncidentType::EndEvent );
111  }
112  }
113 
119  chronoStart( name() );
121  return StatusCode::SUCCESS;
122 }
123 // ============================================================================
124 // Implementation of IService::finalize()
125 // ============================================================================
127  std::string local = name() + ".finalize()";
129  MsgStream main_log( msgSvc(), local );
132  chronoStop( name() );
133 
134  if ( m_ofd.is_open() ) {
135  debug() << "writing per-event timing data to '" << m_perEventFile << "'" << endmsg;
136  for ( const auto& itr : m_perEvtTime ) {
137  m_ofd << itr.first.substr( 0, itr.first.length() - 8 ) << " ";
138  for ( const auto& itt : itr.second ) { m_ofd << " " << (long int)( itt ); }
139  m_ofd << std::endl;
140  }
141 
142  m_ofd.close();
143  }
144 
149  MsgStream log( msgSvc(), "*****Chrono*****" );
150  const std::string stars( ( m_chronoCoutFlag ) ? 126 : 100, '*' );
151  if ( m_chronoCoutFlag ) {
152  std::cout << stars << std::endl;
153  if ( isMT() ) { std::cout << "WARNING: MT job; statistics are unreliable" << std::endl; }
154  std::cout << local << " The Final CPU consumption (Chrono) Table "
155  << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
156  std::cout << stars << std::endl;
157  } else {
158  log << m_chronoPrintLevel << stars << endmsg;
159  if ( isMT() ) { log << m_chronoPrintLevel << "WARNING: MT job; statistics are unreliable" << endmsg; }
160  log << m_chronoPrintLevel << " The Final CPU consumption ( Chrono ) Table "
161  << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
162  log << m_chronoPrintLevel << stars << endmsg;
163  }
165  { // prepare container for printing
167  tmpCont.reserve( m_chronoEntities.size() );
168  for ( auto& it : m_chronoEntities ) { tmpCont.emplace_back( &it.second, &it.first ); }
169  // sort it
170  if ( m_chronoOrderFlag ) std::sort( tmpCont.begin(), tmpCont.end(), CompareFirstOfPointerPair );
171  // print User Time statistics
172  if ( m_printUserTime ) {
173  for ( auto iter = tmpCont.begin(); tmpCont.end() != iter; ++iter ) {
174  //
175  ChronoEntity* entity = iter->first;
176  if ( !entity ) { continue; }
177  const ChronoTag* tag = iter->second;
178  if ( !tag ) { continue; }
179  entity->stop();
181  if ( m_chronoCoutFlag )
183  {
184  std::cout << *tag << "\t" << entity->outputUserTime() << std::endl;
185  } else
186  {
187  MsgStream( msgSvc(), *tag ) << m_chronoPrintLevel << entity->outputUserTime() << endmsg;
188  }
189  //
190  }
191  }
193  if ( m_printSystemTime ) {
197  std::cout << stars << std::endl;
198  } else if ( m_printUserTime && !m_chronoCoutFlag ) {
199  log << m_chronoPrintLevel << stars << endmsg;
200  }
202  for ( auto iter = tmpCont.begin(); tmpCont.end() != iter; ++iter ) {
204  ChronoEntity* entity = iter->first;
205  if ( !entity ) { continue; }
206  const ChronoTag* tag = iter->second;
207  if ( !tag ) { continue; }
208  entity->stop();
210  if ( m_chronoCoutFlag )
212  {
213  std::cout << *tag << "\t" << entity->outputSystemTime() << std::endl;
214  } else
215  {
216  MsgStream( msgSvc(), *tag ) << m_chronoPrintLevel << entity->outputSystemTime() << endmsg;
217  }
218  //
219  }
220  }
222  if ( m_printEllapsedTime ) {
226  std::cout << stars << std::endl;
227  } else if ( ( m_printUserTime || m_printSystemTime ) && !m_chronoCoutFlag ) {
228  log << m_chronoPrintLevel << stars << endmsg;
229  }
231  for ( const auto& i : tmpCont ) {
233  ChronoEntity* entity = i.first;
234  if ( !entity ) { continue; }
235  const ChronoTag* tag = i.second;
236  if ( !tag ) { continue; }
237  entity->stop();
239  if ( m_chronoCoutFlag )
241  {
242  std::cout << *tag << "\t" << entity->outputElapsedTime() << std::endl;
243  } else
244  {
245  MsgStream( msgSvc(), *tag ) << m_chronoPrintLevel << entity->outputElapsedTime() << endmsg;
246  }
247  //
248  }
249  }
251  tmpCont.clear();
252  }
254  if ( m_chronoCoutFlag ) {
255  std::cout << stars << std::endl;
256  } else {
257  log << m_chronoPrintLevel << stars << endmsg;
258  }
259  }
260 
262 
264  if ( m_statTableFlag ) { printStats(); }
265 
266  if ( !m_statsOutFileName.value().empty() ) { saveStats(); }
267 
268  // clear the maps.
272 
273  main_log << MSG::INFO << " Service finalized successfully " << endmsg;
274 
275  return Service::finalize();
276 }
277 // ============================================================================
278 // Implementation of IChronoStatSvc::chronoStart
279 // ============================================================================
280 ChronoEntity* ChronoStatSvc::chronoStart( const ChronoTag& chronoTag ) {
281  ChronoEntity& entity = getEntity( chronoTag );
282  entity.start();
283  return &entity;
284 }
285 // ============================================================================
286 // Implementation of IChronoStatSvc::chronoStop
287 // ============================================================================
288 const ChronoEntity* ChronoStatSvc::chronoStop( const IChronoStatSvc::ChronoTag& chronoTag ) {
289  ChronoEntity& entity = getEntity( chronoTag );
290  entity.stop();
291  return &entity;
292 }
293 // ============================================================================
294 // Implementation of IChronoStatSvc::chronoDelta
295 // ============================================================================
296 IChronoStatSvc::ChronoTime ChronoStatSvc::chronoDelta( const IChronoStatSvc::ChronoTag& chronoTag,
297  IChronoStatSvc::ChronoType theType ) {
298  return getEntity( chronoTag ).delta( theType );
299 }
300 // ============================================================================
301 // Implementation of IChronoStatSvc::chronoPrint
302 // ============================================================================
303 void ChronoStatSvc::chronoPrint( const IChronoStatSvc::ChronoTag& chronoTag ) {
304  MsgStream log( msgSvc(), chronoTag );
305  if ( m_printUserTime ) { log << m_chronoPrintLevel << getEntity( chronoTag ).outputUserTime() << endmsg; }
306  if ( m_printSystemTime ) { log << m_chronoPrintLevel << getEntity( chronoTag ).outputSystemTime() << endmsg; }
307 }
308 // ============================================================================
309 // Implementation of IChronoSvc::chronoStatus
310 // ============================================================================
311 IChronoStatSvc::ChronoStatus ChronoStatSvc::chronoStatus( const IChronoStatSvc::ChronoTag& chronoTag ) {
312  return getEntity( chronoTag ).status();
313 }
314 // ============================================================================
315 // Implementation of IChronoStatSvc::stat
316 // ============================================================================
317 void ChronoStatSvc::stat( const IChronoStatSvc::StatTag& statTag, const IChronoStatSvc::StatFlag& statFlag ) {
318  auto theIter = m_statEntities.find( statTag );
319 
320  StatEntity* theStat = nullptr;
321  // if new entity, specify the number of events to be skipped
322  if ( theIter == m_statEntities.end() ) {
323  // new stat entity
324  StatEntity& theSe = m_statEntities[statTag];
325  theStat = &theSe;
326  } else {
327  // existing stat entity
328  theStat = &theIter->second;
329  }
330 
331  theStat->addFlag( statFlag );
332 }
333 // ============================================================================
334 // Implementation of IChronoStatSvc::statPrint
335 // ============================================================================
336 void ChronoStatSvc::statPrint( const IChronoStatSvc::StatTag& statTag ) {
337  MsgStream log( msgSvc(), statTag );
338  log << m_statPrintLevel << m_statEntities[statTag] << endmsg;
339 }
340 // ============================================================================
341 /* extract the chrono entity for the given tag (name)
342  * @see IChronoStatSvc
343  * @param t chrono tag(name)
344  * @return pointer to chrono entity
345  */
346 // ============================================================================
347 const ChronoEntity* ChronoStatSvc::chrono( const IChronoStatSvc::ChronoTag& t ) const {
348  auto lock = std::scoped_lock{ m_mutex };
349  auto it = m_chronoEntities.find( t );
350  return m_chronoEntities.end() != it ? &( it->second ) : nullptr;
351 }
352 // ============================================================================
353 /* extract the stat entity for the given tag (name)
354  * @see IChronoStatSvc
355  * @param t stat tag(name)
356  * @return pointer to stat entity
357  */
358 // ============================================================================
359 StatEntity* ChronoStatSvc::stat( const IChronoStatSvc::StatTag& t ) {
360  auto it = m_statEntities.find( t );
361  return m_statEntities.end() != it ? &( it->second ) : nullptr;
362 }
363 // ============================================================================
364 // dump all the statistics into an ASCII file
365 // ============================================================================
367  std::ofstream out( m_statsOutFileName.value(), std::ios_base::out | std::ios_base::trunc );
368  if ( !out.good() ) {
369  info() << "Could not open the output file for writing chrono statistics [" << m_statsOutFileName.value() << "]"
370  << endmsg;
371  return;
372  } else {
373  // format it our way
375  }
376 
377  // ChronoEntity
379  {
380  auto lock = std::scoped_lock{ m_mutex };
381  chronos.reserve( m_chronoEntities.size() );
383  []( ChronoMap::const_reference i ) { return std::make_pair( &i.second, &i.first ); } );
384  }
385 
386  // sort it
387  std::sort( std::begin( chronos ), std::end( chronos ), CompareFirstOfPointerPair );
388 
389  // print User Time statistics
390  for ( const auto& iter : chronos ) {
391  //
392  const ChronoEntity* entity = iter.first;
393  if ( !entity ) { continue; }
394 
395  const ChronoTag* tag = iter.second;
396  if ( !tag ) { continue; }
397 
398  // create an entry in the .INI-like table
399  out << "\n[" << *tag << "]\n";
400 
401  // user
402  out << "cpu_user_total = " << entity->uTotalTime() << "\n";
403  out << "cpu_user_min = " << entity->uMinimalTime() << "\n";
404  out << "cpu_user_mean = " << entity->uMeanTime() << "\n";
405  out << "cpu_user_RMS = " << entity->uRMSTime() << "\n";
406  out << "cpu_user_max = " << entity->uMaximalTime() << "\n";
407  out << "cpu_user_nbr = " << entity->nOfMeasurements() << "\n";
408 
409  // system
410  out << "\n"; // just for clarity
411  out << "cpu_system_total = " << entity->kTotalTime() << "\n";
412  out << "cpu_system_min = " << entity->kMinimalTime() << "\n";
413  out << "cpu_system_mean = " << entity->kMeanTime() << "\n";
414  out << "cpu_system_RMS = " << entity->kRMSTime() << "\n";
415  out << "cpu_system_max = " << entity->kMaximalTime() << "\n";
416  out << "cpu_system_nbr = " << entity->nOfMeasurements() << "\n";
417 
418  // real
419  out << "\n"; // just for clarity
420  out << "cpu_real_total = " << entity->eTotalTime() << "\n";
421  out << "cpu_real_min = " << entity->eMinimalTime() << "\n";
422  out << "cpu_real_mean = " << entity->eMeanTime() << "\n";
423  out << "cpu_real_RMS = " << entity->eRMSTime() << "\n";
424  out << "cpu_real_max = " << entity->eMaximalTime() << "\n";
425  out << "cpu_real_nbr = " << entity->nOfMeasurements() << "\n";
426  }
427 
428  out << std::endl;
429 }
430 // ============================================================================
431 // Test if we're running in an MT job.
432 // ============================================================================
433 bool ChronoStatSvc::isMT() const {
434  bool isMT = false;
436  error() << "Cannot retrieve HiveWhiteBoardSvc";
437  } else {
438  // In non-MT mode, `EventDataSvc' does not have an IHiveWhiteBoard interface.
440  if ( wb && wb->getNumberOfStores() > 1 ) { isMT = true; }
441  }
442  return isMT;
443 }
444 // ============================================================================
445 // print the "Stat" part of the ChronoStatSvc
446 // ============================================================================
449  if ( m_statEntities.empty() ) { return; }
450 
451  MsgStream log( msgSvc(), "******Stat******" );
453  const std::string stars( ( m_statCoutFlag ) ? 126 : 100, '*' );
455  if ( m_statCoutFlag ) {
456  std::cout << stars << std::endl;
457  if ( isMT() ) { std::cout << "WARNING: MT job; statistics are unreliable" << std::endl; }
458  std::cout << " The Final stat Table " << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
459  std::cout << stars << std::endl;
460  } else {
461  log << m_statPrintLevel << stars << endmsg;
462  if ( isMT() ) { log << (MSG::Level)m_chronoPrintLevel << "WARNING: MT job; statistics are unreliable" << endmsg; }
463  log << m_statPrintLevel << " The Final stat Table " << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" )
464  << endmsg;
465  log << m_statPrintLevel << stars << endmsg;
466  }
467 
468  {
469  // prepare container for printing
471  typedef std::vector<SPair> SCont;
472  SCont tmpCont;
474  []( StatMap::const_reference i ) { return std::make_pair( &i.second, &i.first ); } );
475  // sort it
476  if ( m_statOrderFlag ) std::sort( tmpCont.begin(), tmpCont.end(), CompareFirstOfPointerPair );
477  // print the table header
478  if ( m_statCoutFlag ) {
480  } else {
482  }
483 
484  // loop over counters and print them:
485  for ( const auto& iter : tmpCont ) {
487  const StatEntity* entity = iter.first;
488  if ( !entity ) { continue; }
489  const StatTag* tag = iter.second;
490  if ( !tag ) { continue; }
491  if ( m_statCoutFlag ) {
493  entity->print( std::cout, true, *tag, m_useEffFormat, "%|-15.15s|%|17t|" );
494  } else {
495  std::ostringstream ost;
496  entity->print( ost, true, *tag, m_useEffFormat, "%|-15.15s|%|17t|" );
497  log << m_statPrintLevel << ost.str() << endmsg;
498  }
499  }
500  tmpCont.clear();
501  }
503  if ( m_statCoutFlag ) {
504  std::cout << stars << std::endl;
505  } else {
506  log << m_statPrintLevel << stars << endmsg;
507  }
508 }
509 
510 // ============================================================================
511 
512 void ChronoStatSvc::handle( const Incident& /* inc */ ) {
513 
514  if ( !m_ofd.is_open() ) return;
515 
516  auto lock = std::scoped_lock{ m_mutex };
517  for ( const auto& itr : m_chronoEntities ) {
518  if ( itr.first.find( ":Execute" ) == std::string::npos ) continue;
519 
520  auto itm = m_perEvtTime.find( itr.first );
521  if ( itm == m_perEvtTime.end() ) {
522  m_perEvtTime[itr.first] = { itr.second.delta( IChronoSvc::ELAPSED ) };
523  } else {
524  itm->second.push_back( itr.second.delta( IChronoSvc::ELAPSED ) );
525  }
526  }
527 }
528 
529 // ============================================================================
530 // The END
531 // ============================================================================
ChronoStatSvc::m_header
Gaudi::Property< std::string > m_header
Definition: ChronoStatSvc.h:198
std::setprecision
T setprecision(T... args)
ChronoStatSvc::m_printSystemTime
Gaudi::Property< bool > m_printSystemTime
Definition: ChronoStatSvc.h:183
ChronoStatSvc::m_chronoOrderFlag
Gaudi::Property< bool > m_chronoOrderFlag
Definition: ChronoStatSvc.h:181
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:118
std::string
STL class.
ChronoEntity::eMinimalTime
double eMinimalTime() const
minimal measurement for elapsed time
Definition: ChronoEntity.h:203
ChronoEntity
Definition: ChronoEntity.h:31
Gaudi.Configuration.log
log
Definition: Configuration.py:28
ChronoEntity::uMinimalTime
double uMinimalTime() const
minimal measurement for user time
Definition: ChronoEntity.h:195
ChronoEntity::stop
IChronoSvc::ChronoStatus stop()
stop the chrono
Definition: ChronoEntity.cpp:61
CompareFirstOfPointerPair_t
Definition: ChronoStatSvc.cpp:55
AlgSequencer.p2
p2
Definition: AlgSequencer.py:30
ChronoEntity::eRMSTime
double eRMSTime() const
r.m.s Elapsed Time
Definition: ChronoEntity.h:255
MSG::INFO
@ INFO
Definition: IMessageSvc.h:25
std::pair
std::vector::reserve
T reserve(T... args)
ChronoStatSvc::getEntity
ChronoEntity & getEntity(const ChronoTag &chronoTag)
Definition: ChronoStatSvc.h:150
IChronoSvc::ELAPSED
@ ELAPSED
Definition: IChronoSvc.h:56
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:162
std::vector
STL class.
std::map::find
T find(T... args)
std::map::size
T size(T... args)
ChronoStatSvc::finalize
StatusCode finalize() override
Implementation of IService::finalize()
Definition: ChronoStatSvc.cpp:126
StatEntity
backward compatible StatEntity class.
Definition: StatEntity.h:23
std::back_inserter
T back_inserter(T... args)
StatEntity.h
ChronoStatSvc::m_statCoutFlag
Gaudi::Property< bool > m_statCoutFlag
Definition: ChronoStatSvc.h:187
std::map::emplace
T emplace(T... args)
ChronoEntity::eMeanTime
double eMeanTime() const
average Elapsed Time
Definition: ChronoEntity.h:243
ChronoStatSvc::chronoStatus
ChronoStatus chronoStatus(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStatus.
Definition: ChronoStatSvc.cpp:311
ChronoEntity::delta
IChronoSvc::ChronoTime delta(IChronoSvc::ChronoType type) const
return the last delta-time of type "type"
Definition: ChronoEntity.h:271
ChronoStatSvc::m_statEntities
StatMap m_statEntities
stat part
Definition: ChronoStatSvc.h:170
ChronoEntity::eTotalTime
double eTotalTime() const
total Elapsed time
Definition: ChronoEntity.h:227
ChronoEntity::kMinimalTime
double kMinimalTime() const
minimal measurement for kernel time
Definition: ChronoEntity.h:199
ChronoStatSvc::merge
void merge(const ChronoStatSvc &css)
Compound assignment operator.
Definition: ChronoStatSvc.cpp:66
StatusCode.h
std::sort
T sort(T... args)
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:222
ChronoStatSvc::stat
void stat(const IChronoStatSvc::StatTag &statTag, const IChronoStatSvc::StatFlag &statFlag) override
Implementation of IChronoStatSvc::stat add statistical information to the entity ,...
Definition: ChronoStatSvc.cpp:317
std::vector::clear
T clear(T... args)
AvalancheSchedulerErrorTest.msgSvc
msgSvc
Definition: AvalancheSchedulerErrorTest.py:80
ChronoEntity::start
IChronoSvc::ChronoStatus start()
start the current chrono
Definition: ChronoEntity.cpp:46
ChronoStatSvc::chronoDelta
IChronoStatSvc::ChronoTime chronoDelta(const IChronoStatSvc::ChronoTag &chronoTag, IChronoStatSvc::ChronoType theType) override
Implementation of IchronoStatSvc::chronoDelta.
Definition: ChronoStatSvc.cpp:296
ChronoEntity::nOfMeasurements
unsigned long nOfMeasurements() const
number of chrono measurements
Definition: ChronoEntity.h:191
IIncidentSvc.h
ChronoStatSvc::chronoStop
const ChronoEntity * chronoStop(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStop.
Definition: ChronoStatSvc.cpp:288
ChronoEntity::uMeanTime
double uMeanTime() const
average User Time
Definition: ChronoEntity.h:239
bug_34121.t
t
Definition: bug_34121.py:31
ChronoEntity::outputSystemTime
std::string outputSystemTime() const
print the chrono ;
Definition: ChronoEntity.cpp:89
ChronoStatSvc::statPrint
void statPrint(const IChronoStatSvc::ChronoTag &statTag) override
prints (using message service) info about statistical entity, tagged by its name
Definition: ChronoStatSvc.cpp:336
ChronoStatSvc::saveStats
void saveStats()
dump the statistics into an ASCII file for offline processing
Definition: ChronoStatSvc.cpp:366
ChronoStatSvc::m_printUserTime
Gaudi::Property< bool > m_printUserTime
Definition: ChronoStatSvc.h:182
ChronoStatSvc::m_mutex
std::mutex m_mutex
Mutex protecting m_chronoEntities.
Definition: ChronoStatSvc.h:164
ServiceHandle::get
T * get() const
Allow non const access to the service, even from a const handle...
Definition: ServiceHandle.h:89
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:332
StatusCode
Definition: StatusCode.h:65
StatEntity::print
std::ostream & print(std::ostream &o, bool tableFormat, std::string_view name, bool flag=true, std::string_view fmtHead="%|-48.48s|%|27t|") const
Definition: StatEntity.h:160
ChronoEntity::kRMSTime
double kRMSTime() const
r.m.s Kernel Time
Definition: ChronoEntity.h:247
ChronoEntity::kTotalTime
double kTotalTime() const
total Kernel time
Definition: ChronoEntity.h:223
ChronoEntity::outputElapsedTime
std::string outputElapsedTime() const
print the chrono ;
Definition: ChronoEntity.cpp:95
std::cout
ChronoStatSvc::printStats
void printStats()
Definition: ChronoStatSvc.cpp:447
ChronoEntity::outputUserTime
std::string outputUserTime() const
print the chrono ;
Definition: ChronoEntity.cpp:82
std::ofstream
STL class.
ChronoStatSvc.h
ChronoStatSvc::m_printEllapsedTime
Gaudi::Property< bool > m_printEllapsedTime
Definition: ChronoStatSvc.h:184
ChronoStatSvc::m_chronoTableFlag
Gaudi::Property< bool > m_chronoTableFlag
Definition: ChronoStatSvc.h:174
Gaudi::Property::value
const ValueType & value() const
Definition: Property.h:237
std::ofstream::close
T close(T... args)
ChronoStatSvc::m_useEffFormat
Gaudi::Property< bool > m_useEffFormat
Definition: ChronoStatSvc.h:202
AlgSequencer.p1
p1
Definition: AlgSequencer.py:29
std::ofstream::open
T open(T... args)
SmartIF< IHiveWhiteBoard >
MsgStream::clear
void clear(STATE_TYPE _i=std::ios_base::failbit)
Definition: MsgStream.h:181
IHiveWhiteBoard.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202
ChronoEntity::status
IChronoSvc::ChronoStatus status() const
return the status of chrono
Definition: ChronoEntity.h:187
ChronoStatSvc::m_chronoPrintLevel
MSG::Level m_chronoPrintLevel
level of info printing
Definition: ChronoStatSvc.h:167
ServiceHandle::retrieve
StatusCode retrieve(T *&service) const override
Do the real retrieval of the Service.
Definition: ServiceHandle.h:97
ChronoStatSvc::isMT
bool isMT() const
Definition: ChronoStatSvc.cpp:433
ChronoStatSvc::m_perEvtTime
TimeMap m_perEvtTime
Definition: ChronoStatSvc.h:210
std::transform
T transform(T... args)
MsgStream
Definition: MsgStream.h:33
e2
HepRndm::Engine< TripleRand > e2
Definition: HepRndmEngines.cpp:203
ChronoEntity::kMaximalTime
double kMaximalTime() const
maximal measurement for kernel time
Definition: ChronoEntity.h:211
Stat.h
ChronoEntity::uRMSTime
double uRMSTime() const
r.m.s User Time
Definition: ChronoEntity.h:251
StatEntity::addFlag
unsigned long addFlag(const double v)
Definition: StatEntity.h:84
std::ostringstream
STL class.
ChronoStatSvc::m_ofd
std::ofstream m_ofd
Definition: ChronoStatSvc.h:211
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
ChronoStatSvc::m_hiveWhiteBoardSvc
ServiceHandle< IInterface > m_hiveWhiteBoardSvc
Definition: ChronoStatSvc.h:207
MSG::Level
Level
Definition: IMessageSvc.h:25
CompareFirstOfPointerPair_t::operator()
bool operator()(const std::pair< S *, T * > &p1, const std::pair< S *, T * > &p2) const
Definition: ChronoStatSvc.cpp:57
ChronoStatSvc::m_statTableFlag
Gaudi::Property< bool > m_statTableFlag
Definition: ChronoStatSvc.h:185
std::vector::emplace_back
T emplace_back(T... args)
ChronoStatSvc::chronoStart
ChronoEntity * chronoStart(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStart.
Definition: ChronoStatSvc.cpp:280
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
std::endl
T endl(T... args)
ChronoEntity.h
IChronoStatSvc.h
ChronoStatSvc::m_statOrderFlag
Gaudi::Property< bool > m_statOrderFlag
Definition: ChronoStatSvc.h:192
std::vector::begin
T begin(T... args)
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
std::map::insert
T insert(T... args)
Kernel.h
ChronoStatSvc::m_chronoCoutFlag
Gaudi::Property< bool > m_chronoCoutFlag
Definition: ChronoStatSvc.h:176
ChronoStatSvc::m_statPrintLevel
MSG::Level m_statPrintLevel
level of info printing
Definition: ChronoStatSvc.h:172
std::map::count
T count(T... args)
std::scientific
T scientific(T... args)
std::map::empty
T empty(T... args)
ChronoStatSvc::handle
void handle(const Incident &incident) override
Definition: ChronoStatSvc.cpp:512
ChronoStatSvc::initialize
StatusCode initialize() override
Implementation of IService::initialize()
Definition: ChronoStatSvc.cpp:94
ChronoEntity::kMeanTime
double kMeanTime() const
average Kernel Time
Definition: ChronoEntity.h:235
std::ostringstream::str
T str(T... args)
ChronoStatSvc::m_perEventFile
Gaudi::Property< std::string > m_perEventFile
Definition: ChronoStatSvc.h:205
HepRndm::Engine
Definition: HepRndmEngine.h:35
std::make_pair
T make_pair(T... args)
std::vector::end
T end(T... args)
ChronoStatSvc::chronoPrint
void chronoPrint(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoPrint.
Definition: ChronoStatSvc.cpp:303
ChronoEntity::uMaximalTime
double uMaximalTime() const
maximal measurement for user time
Definition: ChronoEntity.h:207
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
IIncidentSvc
Definition: IIncidentSvc.h:33
Incident
Definition: Incident.h:27
ChronoStatSvc::m_statsOutFileName
Gaudi::Property< std::string > m_statsOutFileName
Definition: ChronoStatSvc.h:194
ProduceConsume.key
key
Definition: ProduceConsume.py:84
std::ofstream::is_open
T is_open(T... args)
ChronoEntity::eMaximalTime
double eMaximalTime() const
maximal measurement for elapsed time
Definition: ChronoEntity.h:215
ChronoStatSvc::chrono
const ChronoEntity * chrono(const IChronoStatSvc::ChronoTag &t) const override
extract the chrono entity for the given tag (name)
Definition: ChronoStatSvc.cpp:347
ChronoEntity::uTotalTime
double uTotalTime() const
total user time
Definition: ChronoEntity.h:219
ChronoStatSvc
Definition: ChronoStatSvc.h:46
CompareFirstOfPointerPair
constexpr struct CompareFirstOfPointerPair_t CompareFirstOfPointerPair
MsgStream.h
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition: Service.cpp:335
PrepareBase.out
out
Definition: PrepareBase.py:20