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