| # Gaudi Framework, version v21r9 |

Home |  | Generated: 3 May 2010

# ChronoStatSvc Class Reference

The Chrono & Stat Sservice: service implements the IChronoStatSvc interface and provides the basic chronometry and some statistical counts needed by all applications. More...

`#include <ChronoStatSvc.h>`

Inheritance diagram for ChronoStatSvc:

[legend]
Collaboration diagram for ChronoStatSvc:

[legend]

List of all members.

## Public Types
typedef std::map < IChronoStatSvc::ChronoTag, ChronoEntity > | ChronoMap
| some useful typedefs
typedef std::map < IChronoStatSvc::StatTag, StatEntity > | StatMap
## Public Member Functions
virtual StatusCode | initialize ()
| Implementation of IService::initialize().
virtual StatusCode | finalize ()
| Implementation of IService::finalize().
virtual ChronoEntity * | chronoStart (const IChronoStatSvc::ChronoTag &chronoTag)
| Implementation of IChronoStatSvc::chronoStart.
virtual const ChronoEntity * | chronoStop (const IChronoStatSvc::ChronoTag &chronoTag)
| Implementation of IChronoStatSvc::chronoStop.
virtual IChronoStatSvc::ChronoTime | chronoDelta (const IChronoStatSvc::ChronoTag &chronoTag, IChronoStatSvc::ChronoType theType)
| Implementation of IchronoStatSvc::chronoDelta.
virtual void | chronoPrint (const IChronoStatSvc::ChronoTag &chronoTag)
| Implementation of IChronoStatSvc::chronoPrint.
virtual ChronoStatus | chronoStatus (const IChronoStatSvc::ChronoTag &chronoTag)
| Implementation of IChronoStatSvc::chronoStatus.
virtual void | stat (const IChronoStatSvc::StatTag &statTag, const IChronoStatSvc::StatFlag &statFlag)
| Implementation of IChronoStatSvc::stat add statistical information to the entity , tagged by its name.
virtual void | statPrint (const IChronoStatSvc::ChronoTag &statTag)
| prints (using message service) info about statistical entity, tagged by its name
virtual const ChronoEntity * | chrono (const IChronoStatSvc::ChronoTag &t) const
| extract the chrono entity for the given tag (name)
virtual const StatEntity * | stat (const IChronoStatSvc::StatTag &t) const
| extract the stat entity for the given tag (name)
| ChronoStatSvc (const std::string &name, ISvcLocator *svcloc)
| Default constructor.
virtual | ~ChronoStatSvc ()
| Destructor.
## Protected Member Functions
void | printStats ()
## Private Member Functions
| ChronoStatSvc ()
| ChronoStatSvc (const ChronoStatSvc &)
ChronoStatSvc & | operator= (const ChronoStatSvc &)
void | saveStats ()
| dump the statistics into an ASCII file for offline processing
## Private Attributes
ChronoMap | m_chronoEntities
| chrono part
int | m_intChronoPrintLevel
| level of info printing
MSG::Level | m_chronoPrintLevel
bool | m_chronoTableFlag
| flag for printing the final table
bool | m_chronoCoutFlag
| flag for destination of the the final table
bool | m_chronoOrderFlag
| flag for formattion the final statistic table
bool | m_printUserTime
| flag for printing User quantities
bool | m_printSystemTime
| flag for printing System quantities
bool | m_printEllapsedTime
| flag for printing Ellapsed quantities
long | m_numberOfSkippedEventsForMemStat
StatMap | m_statEntities
| stat part
int | m_intStatPrintLevel
| level of info printing
MSG::Level | m_statPrintLevel
bool | m_statTableFlag
| flag for printing the final table
bool | m_statCoutFlag
| flag for destination of the t he final table
bool | m_statOrderFlag
| flag for formattion the final statistic table
StringProperty | m_statsOutFileName
| Name of the output file where we'll dump the stats.
std::string | m_header
| the header row
std::string | m_format1
| format for regular statistical printout rows
std::string | m_format2
| format for "efficiency" statistical printout rows
bool | m_useEffFormat
| flag to use the special "efficiency" format

## Detailed Description

The Chrono & Stat Sservice: service implements the IChronoStatSvc interface and provides the basic chronometry and some statistical counts needed by all applications.

Author:
  : Vanya BELYAEV Ivan.Belyaev@itep.ru : December 1, 1999

Definition at line 36 of file ChronoStatSvc.h.

## Member Typedef Documentation

typedef std::map<IChronoStatSvc::ChronoTag,ChronoEntity> ChronoStatSvc::ChronoMap

some useful typedefs

Definition at line 40 of file ChronoStatSvc.h.

typedef std::map<IChronoStatSvc::StatTag,StatEntity> ChronoStatSvc::StatMap

Definition at line 41 of file ChronoStatSvc.h.

## Constructor & Destructor Documentation

ChronoStatSvc::ChronoStatSvc | ( | const std::string & | name,
|  | ISvcLocator * | svcloc |
| ) |  |  |

Default constructor.

Parameters:

  | name | service instance name
  | svcloc | pointer to servcie locator

decide if the final printout should be performed

define the destination of the table to be printed

print level

if printout is to be performed, should one take care about some ordering?

if User Time information to be printed?

if System Time information to be printed?

if Ellapsed Time information to be printed?

deside if the final printout should be performed

define the destination of the table to be printed

print level

if printout is to be performed, should one take care about some ordering?

Definition at line 91 of file ChronoStatSvc.cpp.

    00092   : base_class( name , svcloc )
    00093   , m_chronoEntities   ()
    00094   , m_chronoPrintLevel ( MSG::INFO )
    00095   , m_statEntities     ()
    00096   , m_statPrintLevel   ( MSG::INFO )
    00097   //
    00098   // the header row
    00099   , m_header  ( "     Counter     |     #     |    sum     | mean/eff^* | rms/err^*  |     min     |     max     |")
    00100   // format for regular statistical printout rows
    00101   , m_format1 ( " %|-15.15s|%|17t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" )
    00102   // format for "efficiency" statistical printout rows
    00103   , m_format2 ( "*%|-15.15s|%|17t||%|10d| |%|11.5g| |(%|#9.7g| +- %|-#9.7g|)%%|   -------   |   -------   |" )
    00104   // flag to use the special "efficiency" format
    00105   , m_useEffFormat ( true )
    00106 {
    00108   declareProperty ( "ChronoPrintOutTable"    ,
    00109                     m_chronoTableFlag      = true      );
    00111   declareProperty ( "ChronoDestinationCout"  ,
    00112                     m_chronoCoutFlag       = false     );
    00114   declareProperty ( "ChronoPrintLevel"       ,
    00115                     m_intChronoPrintLevel  = MSG::INFO );
    00118   declareProperty ( "ChronoTableToBeOrdered" ,
    00119                     m_chronoOrderFlag      = true      );
    00121   declareProperty ( "PrintUserTime"          ,
    00122                     m_printUserTime        = true      );
    00124   declareProperty ( "PrintSystemTime"        ,
    00125                     m_printSystemTime      = false     );
    00127   declareProperty ( "PrintEllapsedTime"      ,
    00128                     m_printEllapsedTime    = false     );
    00131   declareProperty ( "StatPrintOutTable"      ,
    00132                     m_statTableFlag        = true      );
    00134   declareProperty ( "StatDestinationCout"    ,
    00135                     m_statCoutFlag         = false     );
    00137   declareProperty ( "StatPrintLevel"         ,
    00138                     m_intStatPrintLevel    = MSG::INFO );
    00141   declareProperty ( "StatTableToBeOrdered"   ,
    00142                     m_statOrderFlag        = true      );
    00143
    00144   // specify the number of events to be skipped by the memory auditor
    00145   // in order to better spot memory leak
    00146   declareProperty ( "NumberOfSkippedEventsForMemStat"      ,
    00147                     m_numberOfSkippedEventsForMemStat = -1 ) ;
    00148
    00149   declareProperty( "AsciiStatsOutputFile",
    00150                    m_statsOutFileName = "",
    00151                    "Name of the output file storing the stats. If empty, no"
    00152                    " statistics will be saved (default)" );
    00153
    00154   declareProperty
    00155     ( "StatTableHeader"        , m_header                          ,
    00156       "The header row for the output Stat-table"                   ) ;
    00157   declareProperty
    00158     ( "RegularRowFormat"       , m_format1                         ,
    00159       "The format for the regular row in the output Stat-table"    ) ;
    00160   declareProperty
    00161     ( "EfficiencyRowFormat"    , m_format2                         ,
    00162       "The format for the regular row in the outptu Stat-table"    ) ;
    00163   declareProperty
    00164     ( "UseEfficiencyRowFormat" , m_useEffFormat                    ,
    00165       "Use the special format for printout of efficiency counters" ) ;
    00166 }

ChronoStatSvc::~ChronoStatSvc | ( |  | ) | `[virtual]`

Destructor.

Definition at line 170 of file ChronoStatSvc.cpp.

    00171 {
    00172   // clear the container of chrono entities
    00173   m_chronoEntities.clear();
    00174   // clear the container of stat   entities
    00175   m_statEntities.clear();
    00176 }

ChronoStatSvc::ChronoStatSvc | ( |  | ) | `[private]`

ChronoStatSvc::ChronoStatSvc | ( | const ChronoStatSvc & |  | ) | `[private]`

## Member Function Documentation

StatusCode ChronoStatSvc::initialize | ( |  | ) | `[virtual]`

Implementation of IService::initialize().

redefine some "properties"

start its own chrono

Reimplemented from Service.

Definition at line 180 of file ChronoStatSvc.cpp.

    00181 {
    00182   StatusCode sc = Service::initialize();
    00183   if ( sc.isFailure() ) return sc;
    00185   MsgStream log( msgSvc() , this->name() );
    00186
    00187   // Set my own properties
    00188   sc = setProperties();
    00189
    00190   if (sc.isFailure()) {
    00191     log << MSG::ERROR << "setting my properties" << endmsg;
    00192     return StatusCode::FAILURE;
    00193   }
    00194
    00195   log << MSG::INFO << " Number of skipped events for MemStat"
    00196       << m_numberOfSkippedEventsForMemStat << endmsg ;
    00197
    00201   m_statPrintLevel =
    00202     ( MSG::FATAL < m_intStatPrintLevel   ) ? MSG::FATAL :
    00203     ( MSG::NIL   > m_intStatPrintLevel   ) ? MSG::NIL   :
    00204     ( MSG::Level ) m_intStatPrintLevel  ;
    00206   m_chronoPrintLevel =
    00207     ( MSG::FATAL < m_intChronoPrintLevel ) ? MSG::FATAL :
    00208     ( MSG::NIL   > m_intChronoPrintLevel ) ? MSG::NIL   :
    00209     ( MSG::Level ) m_intChronoPrintLevel ;
    00211   if( m_chronoTableFlag  &&
    00212       !m_printUserTime   &&
    00213       !m_printSystemTime &&
    00214       !m_printEllapsedTime ) { m_printUserTime   = true ; }
    00216   if(  m_printUserTime    ||
    00217        m_printSystemTime  ||
    00218        m_printEllapsedTime ) { m_chronoTableFlag = true ; }
    00221   chronoStart( name() ) ;
    00223   return StatusCode::SUCCESS;
    00224 }

StatusCode ChronoStatSvc::finalize | ( | void |  | ) | `[virtual]`

Implementation of IService::finalize().

stop its own chrono

Is the final chrono table to be printed?

decoration

CONTINUE

CONTINUE

stop chrono (if it is still in RUNNING status)

print to std::cout

print to MsgStream

decoration

CONTINUE

CONTINUE

stop chrono (if it is still in RUNNING status)

print to std::cout

print to MsgStream

decoration

CONTINUE

CONTINUE

stop chrono (if it is still in RUNNING status)

print to std::cout

print to MsgStream

clear the temporary container

the final decoration

Is the final stat table to be printed?

< finalize the base class

Reimplemented from Service.

Definition at line 228 of file ChronoStatSvc.cpp.

    00229 {
    00230   std::string local = name()+".finalize()";
    00232   MsgStream main_log( msgSvc() , local );
    00235   chronoStop( name() ) ;
    00236
    00239   if ( m_chronoTableFlag &&
    00240        !m_chronoEntities.empty() &&
    00241        ( m_printUserTime || m_printSystemTime ) )
    00242     {
    00244       MsgStream log( msgSvc() , "*****Chrono*****" );
    00245       const std::string stars( ( m_chronoCoutFlag ) ? 126 : 100  , '*' );
    00246       if( m_chronoCoutFlag  )
    00247         {
    00248           std::cout << stars << std::endl;
    00249           std::cout << local <<  " The Final CPU consumption (Chrono) Table "
    00250                     << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
    00251           std::cout << stars << std::endl;
    00252         }
    00253       else
    00254         {
    00255           log << (MSG::Level) m_chronoPrintLevel
    00256         << stars << endmsg;
    00257           log << (MSG::Level) m_chronoPrintLevel
    00258         << " The Final CPU consumption ( Chrono ) Table "
    00259               << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
    00260           log << (MSG::Level) m_chronoPrintLevel << stars << endmsg;
    00261         }
    00263       {  // prepare container for printing
    00264         typedef std::pair<ChronoEntity*,const ChronoTag*>        MPair;
    00265         typedef std::vector<MPair>                               MCont;
    00266         MCont tmpCont;
    00267         for( ChronoMap::iterator it = m_chronoEntities.begin() ;
    00268        m_chronoEntities.end() != it ;  ++it )
    00269           { tmpCont.push_back( MPair( &(it->second) , &(it->first) ) ) ; }
    00270         // sort it
    00271         if( m_chronoOrderFlag )
    00272   { std::sort( tmpCont.begin() ,
    00273                tmpCont.end()   ,
    00274                ComparePairOfChronoEntityAndChronoTag() ); }
    00275         // print User Time statistics
    00276         if( m_printUserTime   )
    00277           {
    00278             for( MCont::iterator iter = tmpCont.begin() ;  tmpCont.end() != iter ; ++iter )
    00279               {
    00280                 //
    00281                 ChronoEntity*    entity = iter->first  ; if( 0 == entity ) { continue ; }
    00282                 const ChronoTag* tag    = iter->second ; if( 0 == tag    ) { continue ; }
    00283
    00284                 entity->stop();
    00285
    00286                 if     ( m_chronoCoutFlag )
    00287                   { std::cout << *tag << "\t"  << entity->outputUserTime  () << std::endl ; }
    00288                 else
    00289                   {
    00290                     MsgStream(msgSvc(), *tag)
    00291           << m_chronoPrintLevel << entity->outputUserTime  () << endmsg ;
    00292                   }
    00293                 //
    00294               }
    00295           }
    00297         if( m_printSystemTime )
    00298           {
    00301             if      ( m_printUserTime && m_chronoCoutFlag   )
    00302               { std::cout << stars << std::endl;                           }
    00303             else if ( m_printUserTime && !m_chronoCoutFlag  )
    00304               { log << (MSG::Level) m_chronoPrintLevel << stars << endmsg; }
    00306             for( MCont::iterator iter = tmpCont.begin() ;  tmpCont.end() != iter ; ++iter )
    00307               {
    00309                 ChronoEntity*    entity = iter->first  ; if( 0 == entity ) { continue ; }
    00310                 const ChronoTag* tag    = iter->second ; if( 0 == tag    ) { continue ; }
    00311
    00312                 entity->stop();
    00313
    00314                 if     ( m_chronoCoutFlag )
    00315                   { std::cout << *tag << "\t"  << entity->outputSystemTime() << std::endl ; }
    00316                 else
    00317                   {
    00318                     MsgStream(msgSvc(), *tag)
    00319           << m_chronoPrintLevel << entity->outputSystemTime() << endmsg ;
    00320                   }
    00321                 //
    00322               }
    00323           }
    00325         if( m_printEllapsedTime )
    00326           {
    00329             if      ( ( m_printUserTime || m_printSystemTime ) &&  m_chronoCoutFlag  )
    00330               { std::cout << stars << std::endl;                           }
    00331             else if ( ( m_printUserTime || m_printSystemTime ) && !m_chronoCoutFlag  )
    00332               { log << (MSG::Level) m_chronoPrintLevel << stars << endmsg; }
    00334             for( MCont::iterator iter = tmpCont.begin() ;  tmpCont.end() != iter ; ++iter )
    00335               {
    00337                 ChronoEntity*    entity = iter->first  ; if( 0 == entity ) { continue ; }
    00338                 const ChronoTag* tag    = iter->second ; if( 0 == tag    ) { continue ; }
    00339
    00340                 entity->stop();
    00341
    00342                 if     ( m_chronoCoutFlag )
    00343                   { std::cout << *tag << "\t"  << entity->outputElapsedTime() << std::endl ; }
    00344                 else
    00345                   {
    00346                     MsgStream(msgSvc(), *tag)
    00347           << m_chronoPrintLevel << entity->outputElapsedTime() << endmsg ;
    00348                   }
    00349                 //
    00350               }
    00351           }
    00353         tmpCont.clear();
    00354       }
    00356       if( m_chronoCoutFlag  ) { std::cout << stars << std::endl;              }
    00357       else                    { log << m_chronoPrintLevel << stars << endmsg; }
    00358     }
    00359
    00361
    00363   if ( m_statTableFlag ) { printStats () ; }
    00364
    00365   if ( !m_statsOutFileName.value().empty() ) {
    00366     saveStats();
    00367   }
    00368
    00369   main_log << MSG::INFO << " Service finalized successfully " << endmsg;
    00370
    00371   return Service::finalize();
    00372 }

virtual ChronoEntity* ChronoStatSvc::chronoStart | ( | const IChronoStatSvc::ChronoTag & | chronoTag | ) | `[virtual]`

Implementation of IChronoStatSvc::chronoStart.

See also:
  IChronoStatSvc

const ChronoEntity * ChronoStatSvc::chronoStop | ( | const IChronoStatSvc::ChronoTag & | chronoTag | ) | `[virtual]`

Implementation of IChronoStatSvc::chronoStop.

See also:
  IChronoStatSvc

Definition at line 389 of file ChronoStatSvc.cpp.

    00390 {
    00391   ChronoEntity& entity = m_chronoEntities [ chronoTag ] ;
    00392   entity.stop() ;
    00393   return &entity ;
    00394 }

IChronoStatSvc::ChronoTime ChronoStatSvc::chronoDelta | ( | const IChronoStatSvc::ChronoTag & | chronoTag,
|  | IChronoStatSvc::ChronoType | theType |
| ) |  |  | `[virtual]`

Implementation of IchronoStatSvc::chronoDelta.

See also:
  IChronoStatSvc

Definition at line 400 of file ChronoStatSvc.cpp.

    00402 {
    00403   return m_chronoEntities[ chronoTag ].delta( theType );
    00404 }

void ChronoStatSvc::chronoPrint | ( | const IChronoStatSvc::ChronoTag & | chronoTag | ) | `[virtual]`

Implementation of IChronoStatSvc::chronoPrint.

See also:
  IChronoStatSvc

Definition at line 409 of file ChronoStatSvc.cpp.

    00410 {
    00411   MsgStream log ( msgSvc() , chronoTag );
    00412   if( m_printUserTime   ) {
    00413     log << (MSG::Level) m_chronoPrintLevel
    00414         << m_chronoEntities[ chronoTag ].outputUserTime  ()
    00415         << endmsg;
    00416   }
    00417   if( m_printSystemTime ) {
    00418     log << (MSG::Level) m_chronoPrintLevel
    00419         << m_chronoEntities[ chronoTag ].outputSystemTime()
    00420         << endmsg;
    00421   }
    00422 }

IChronoStatSvc::ChronoStatus ChronoStatSvc::chronoStatus | ( | const IChronoStatSvc::ChronoTag & | chronoTag | ) | `[virtual]`

Implementation of IChronoStatSvc::chronoStatus.

See also:
  IChronoStatSvc

Definition at line 428 of file ChronoStatSvc.cpp.

    00429 { return m_chronoEntities[ chronoTag ].status(); }

void ChronoStatSvc::stat | ( | const IChronoStatSvc::StatTag & | statTag,
|  | const IChronoStatSvc::StatFlag & | statFlag |
| ) |  |  | `[virtual]`

Implementation of IChronoStatSvc::stat add statistical information to the entity , tagged by its name.

See also:
  IChronoStatSvc

Definition at line 434 of file ChronoStatSvc.cpp.

    00436 {
    00437   StatMap::iterator theIter=m_statEntities.find(statTag);
    00438
    00439   StatEntity * theStat=0 ;
    00440   // if new entity, specify the neumber of events to be skipped
    00441   if (theIter==m_statEntities.end()){
    00442     // new stat entity
    00443     StatEntity& theSe = m_statEntities[ statTag ];
    00444     theStat=& theSe;
    00445     theStat->setnEntriesBeforeReset(m_numberOfSkippedEventsForMemStat);
    00446   }
    00447   else
    00448   {
    00449     //existing stat entity
    00450     theStat=&((*theIter).second);
    00451   }
    00452
    00453   theStat->addFlag ( statFlag ) ;
    00454 }

virtual void ChronoStatSvc::statPrint | ( | const IChronoStatSvc::ChronoTag & | statTag | ) | `[virtual]`

prints (using message service) info about statistical entity, tagged by its name

See also:
  IChronoStatSvc

const ChronoEntity * ChronoStatSvc::chrono | ( | const IChronoStatSvc::ChronoTag & | t | ) | const`[virtual]`

extract the chrono entity for the given tag (name)

See also:
  IChronoStatSvc

Parameters:

  | t | chrono tag(name)

Returns:
  pointer to chrono entity

Definition at line 472 of file ChronoStatSvc.cpp.

    00473 {
    00474   ChronoMap::const_iterator it = m_chronoEntities.find ( t ) ;
    00475   if ( m_chronoEntities.end() != it ) { return &(it->second) ; }
    00476   return 0 ;
    00477 }

const StatEntity * ChronoStatSvc::stat | ( | const IChronoStatSvc::StatTag & | t | ) | const`[virtual]`

extract the stat entity for the given tag (name)

See also:
  IChronoStatSvc

Parameters:

  | t | stat tag(name)

Returns:
  pointer to stat entity

Definition at line 486 of file ChronoStatSvc.cpp.

    00487 {
    00488   StatMap::const_iterator it = m_statEntities.find ( t ) ;
    00489   if ( m_statEntities.end() != it ) { return &(it->second) ; }
    00490   return 0 ;
    00491 }

void ChronoStatSvc::printStats | ( |  | ) | `[protected]`

nothing to print?

CONTINUE

CONTINUE

decoration

Definition at line 573 of file ChronoStatSvc.cpp.

    00574 {
    00576   if ( m_statEntities.empty() ) { return ; }
    00577
    00578   MsgStream log ( msgSvc() , "******Stat******" ) ;
    00580   const std::string stars( ( m_statCoutFlag ) ? 126 : 100  , '*' ) ;
    00582   if ( m_statCoutFlag  )
    00583         {
    00584           std::cout << stars << std::endl;
    00585           std::cout <<  " The Final stat Table "
    00586               << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
    00587           std::cout << stars << std::endl;
    00588         }
    00589   else
    00590   {
    00591           log << m_statPrintLevel << stars << endmsg;
    00592           log <<  m_statPrintLevel << " The Final stat Table "
    00593               << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
    00594           log << m_statPrintLevel << stars << endmsg;
    00595         }
    00596
    00597   {
    00598     // prepare container for printing
    00599     typedef std::pair<const StatEntity*,const StatTag*>  SPair;
    00600     typedef std::vector<SPair>                           SCont;
    00601     SCont tmpCont;
    00602     for( StatMap::const_iterator it = m_statEntities.begin();
    00603          it != m_statEntities.end(); it++ )
    00604     { tmpCont.push_back( SPair( &(it->second) , &(it->first) ) ) ; }
    00605     // sort it
    00606     if ( m_statOrderFlag )
    00607     { std::sort( tmpCont.begin() ,
    00608                  tmpCont.end()   ,
    00609                  ComparePairOfStatEntityAndStatTag() ); }
    00610
    00611
    00612     {
    00613       // print the table header
    00614       if ( m_statCoutFlag ) { std::cout <<                     m_header << std::endl ; }
    00615       else                  { log       << m_statPrintLevel << m_header << endmsg    ; }
    00616     }
    00617     // loop over counters and print them:
    00618     for ( SCont::iterator iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
    00619           {
    00621       const StatEntity* entity = iter->first  ;
    00622       if ( 0 == entity ) { continue ; }
    00623       const StatTag*    tag    = iter->second ;
    00624       if ( 0 == tag    ) { continue ; }
    00625
    00626             if ( m_statCoutFlag )
    00627       {
    00628         std::cout
    00629           << Gaudi::Utils::formatAsTableRow
    00630           ( *tag , *entity , m_useEffFormat , m_format1 , m_format2 )
    00631           << std::endl;
    00632       }
    00633             else
    00634       {
    00635         log
    00636           << m_statPrintLevel
    00637           << Gaudi::Utils::formatAsTableRow
    00638           ( *tag , *entity , m_useEffFormat , m_format1 , m_format2 )
    00639           << endmsg ;
    00640       }
    00641           }
    00642     tmpCont.clear();
    00643   }
    00645   if ( m_statCoutFlag  ) { std::cout << stars << std::endl;            }
    00646   else                   { log << m_statPrintLevel << stars << endmsg; }
    00647 }

ChronoStatSvc& ChronoStatSvc::operator= | ( | const ChronoStatSvc & |  | ) | `[private]`

void ChronoStatSvc::saveStats | ( |  | ) | `[private]`

dump the statistics into an ASCII file for offline processing

CONTINUE

CONTINUE

Definition at line 495 of file ChronoStatSvc.cpp.

    00496 {
    00497   std::ofstream out( m_statsOutFileName.value().c_str(),
    00498                      std::ios_base::out | std::ios_base::trunc );
    00499   if ( !out.good() ) {
    00500     MsgStream msg( msgSvc() , name() );
    00501     msg << MSG::INFO
    00502         << "Could not open the output file for writing chrono statistics ["
    00503         << m_statsOutFileName.value() << "]"
    00504         << endmsg;
    00505     return;
    00506   } else {
    00507     // format it our way
    00508     out << std::scientific << std::setprecision(8) ;
    00509   }
    00510
    00511   // ChronoEntity
    00512   typedef std::pair<ChronoEntity*, const ChronoTag*> MPair;
    00513   typedef std::vector<MPair>                         MCont;
    00514   MCont chronos;
    00515
    00516   for( ChronoMap::iterator it = m_chronoEntities.begin() ;
    00517        m_chronoEntities.end() != it ;  ++it ) {
    00518     chronos.push_back( MPair( &(it->second) , &(it->first) ) ) ;
    00519   }
    00520
    00521   // sort it
    00522   std::sort( chronos.begin() ,
    00523              chronos.end()   ,
    00524              ComparePairOfChronoEntityAndChronoTag() );
    00525
    00526   // print User Time statistics
    00527   for( MCont::iterator iter = chronos.begin() ;
    00528        chronos.end() != iter;
    00529        ++iter ) {
    00530     //
    00531     const ChronoEntity*    entity = iter->first;
    00532     if( 0 == entity ) { continue ; }
    00533
    00534     const ChronoTag* tag    = iter->second ;
    00535     if( 0 == tag    ) { continue ; }
    00536
    00537     // create an entry in the .INI-like table
    00538     out << "\n[" << *tag << "]\n";
    00539
    00540     // user
    00541     out << "cpu_user_total = " << entity->uTotalTime() << "\n";
    00542     out << "cpu_user_min = "   << entity->uMinimalTime() << "\n";
    00543     out << "cpu_user_mean = "  << entity->uMeanTime() << "\n";
    00544     out << "cpu_user_RMS = "   << entity->uRMSTime() << "\n";
    00545     out << "cpu_user_max = "   << entity->uMaximalTime() << "\n";
    00546     out << "cpu_user_nbr = "   << entity->nOfMeasurements() << "\n";
    00547
    00548     // system
    00549     out << "\n"; // just for clarity
    00550     out << "cpu_system_total = " << entity->kTotalTime() << "\n";
    00551     out << "cpu_system_min = "   << entity->kMinimalTime() << "\n";
    00552     out << "cpu_system_mean = "  << entity->kMeanTime() << "\n";
    00553     out << "cpu_system_RMS = "   << entity->kRMSTime() << "\n";
    00554     out << "cpu_system_max = "   << entity->kMaximalTime() << "\n";
    00555     out << "cpu_system_nbr = "   << entity->nOfMeasurements() << "\n";
    00556
    00557     // real
    00558     out << "\n"; // just for clarity
    00559     out << "cpu_real_total = " << entity->eTotalTime() << "\n";
    00560     out << "cpu_real_min = "   << entity->eMinimalTime() << "\n";
    00561     out << "cpu_real_mean = "  << entity->eMeanTime() << "\n";
    00562     out << "cpu_real_RMS = "   << entity->eRMSTime() << "\n";
    00563     out << "cpu_real_max = "   << entity->eMaximalTime() << "\n";
    00564     out << "cpu_real_nbr = "   << entity->nOfMeasurements() << "\n";
    00565
    00566   }
    00567
    00568   out << std::endl;
    00569 }

## Member Data Documentation

ChronoMap ChronoStatSvc::m_chronoEntities`[private]`

chrono part

Definition at line 142 of file ChronoStatSvc.h.

int ChronoStatSvc::m_intChronoPrintLevel`[private]`

level of info printing

Definition at line 144 of file ChronoStatSvc.h.

MSG::Level ChronoStatSvc::m_chronoPrintLevel`[private]`

Definition at line 145 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_chronoTableFlag`[private]`

flag for printing the final table

Definition at line 147 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_chronoCoutFlag`[private]`

flag for destination of the the final table

Definition at line 149 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_chronoOrderFlag`[private]`

flag for formattion the final statistic table

Definition at line 151 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_printUserTime`[private]`

flag for printing User quantities

Definition at line 153 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_printSystemTime`[private]`

flag for printing System quantities

Definition at line 155 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_printEllapsedTime`[private]`

flag for printing Ellapsed quantities

Definition at line 157 of file ChronoStatSvc.h.

long ChronoStatSvc::m_numberOfSkippedEventsForMemStat`[private]`

Definition at line 160 of file ChronoStatSvc.h.

StatMap ChronoStatSvc::m_statEntities`[private]`

stat part

Definition at line 163 of file ChronoStatSvc.h.

int ChronoStatSvc::m_intStatPrintLevel`[private]`

level of info printing

Definition at line 166 of file ChronoStatSvc.h.

MSG::Level ChronoStatSvc::m_statPrintLevel`[private]`

Definition at line 167 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_statTableFlag`[private]`

flag for printing the final table

Definition at line 169 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_statCoutFlag`[private]`

flag for destination of the t he final table

Definition at line 171 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_statOrderFlag`[private]`

flag for formattion the final statistic table

Definition at line 173 of file ChronoStatSvc.h.

StringProperty ChronoStatSvc::m_statsOutFileName`[private]`

Name of the output file where we'll dump the stats.

Definition at line 177 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_header`[private]`

the header row

Definition at line 180 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_format1`[private]`

format for regular statistical printout rows

Definition at line 182 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_format2`[private]`

format for "efficiency" statistical printout rows

Definition at line 184 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_useEffFormat`[private]`

flag to use the special "efficiency" format

Definition at line 186 of file ChronoStatSvc.h.

The documentation for this class was generated from the following files:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r9/GaudiSvc/src/ChronoStatSvc/ChronoStatSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r9/GaudiSvc/src/ChronoStatSvc/ChronoStatSvc.cpp