Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for ChronoStatSvc:
Collaboration graph
[legend]

Public Types

typedef std::map
< IChronoStatSvc::ChronoTag,
ChronoEntity
ChronoMap
 some useful typedefs
 
typedef std::map
< IChronoStatSvc::StatTag,
StatEntity
StatMap
 
- Public Types inherited from extends2< Service, IChronoStatSvc, IIncidentListener >
typedef extends2 base_class
 Typedef to this class.
 
typedef extend_interfaces2
< IChronoStatSvc,
IIncidentListener
extend_interfaces_base
 Typedef to the base of this class.
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces.
 
- Public Types inherited from extend_interfaces2< I1, I2 >
typedef mpl::fold< typename
I1::iid::iids::type, typename
I2::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type 
ext_iids
 MPL set of interfaces extended by this one.
 

Public Member Functions

virtual StatusCode initialize ()
 Implementation of IService::initialize()
 
virtual StatusCode finalize ()
 Implementation of IService::finalize()
 
virtual ChronoEntitychronoStart (const IChronoStatSvc::ChronoTag &chronoTag)
 Implementation of IChronoStatSvc::chronoStart.
 
virtual const ChronoEntitychronoStop (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 ChronoEntitychrono (const IChronoStatSvc::ChronoTag &t) const
 extract the chrono entity for the given tag (name)
 
virtual const StatEntitystat (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.
 
void handle (const Incident &incident)
 
- Public Member Functions inherited from extends2< Service, IChronoStatSvc, IIncidentListener >
 extends2 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments.
 
 extends2 (A1 a1, A2 a2)
 Templated constructor with 2 arguments.
 
 extends2 (A1 a1)
 Templated constructor with 1 argument.
 
 extends2 ()
 Default constructor.
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast.
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface.
 
virtual std::vector< std::stringgetInterfaceNames () const
 Implementation of IInterface::getInterfaceNames.
 
virtual ~extends2 ()
 Virtual destructor.
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance.
 
virtual const std::stringname () const
 Retrieve name of the service.
 
virtual StatusCode configure ()
 
virtual StatusCode start ()
 
virtual StatusCode stop ()
 
virtual StatusCode terminate ()
 
virtual Gaudi::StateMachine::State FSMState () const
 
virtual Gaudi::StateMachine::State targetFSMState () const
 
virtual StatusCode reinitialize ()
 
virtual StatusCode restart ()
 
virtual StatusCode sysInitialize ()
 Initialize Service.
 
virtual StatusCode sysStart ()
 Initialize Service.
 
virtual StatusCode sysStop ()
 Initialize Service.
 
virtual StatusCode sysFinalize ()
 Finalize Service.
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service.
 
virtual StatusCode sysRestart ()
 Re-initialize the Service.
 
virtual StatusCode setProperty (const Property &p)
 
virtual StatusCode setProperty (const std::string &s)
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 
virtual StatusCode getProperty (Property *p) const
 
virtual const PropertygetProperty (const std::string &name) const
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 
virtual const std::vector
< Property * > & 
getProperties () const
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor.
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator.
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job.
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist.
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist.
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties.
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked.
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments.
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments.
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument.
 
 CommonMessaging ()
 Default constructor.
 
virtual ~CommonMessaging ()
 Virtual destructor.
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO)
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream
 
- Public Member Functions inherited from extend_interfaces2< I1, I2 >
virtual ~extend_interfaces2 ()
 Virtual destructor.
 

Protected Member Functions

void printStats ()
 

Private Types

typedef std::map< ChronoTag,
std::vector
< IChronoSvc::ChronoTime > > 
TimeMap
 

Private Member Functions

 ChronoStatSvc ()
 
 ChronoStatSvc (const ChronoStatSvc &)
 
ChronoStatSvcoperator= (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
 
TimeMap m_perEvtTime
 
std::string m_perEventFile
 
std::ofstream m_ofd
 

Additional Inherited Members

- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level.
 
Gaudi::StateMachine::State m_state
 Service state.
 
Gaudi::StateMachine::State m_targetState
 Service state.
 

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..nosp@m.Bely.nosp@m.aev@i.nosp@m.tep..nosp@m.ru : December 1, 1999

Definition at line 38 of file ChronoStatSvc.h.

Member Typedef Documentation

some useful typedefs

Definition at line 43 of file ChronoStatSvc.h.

Definition at line 44 of file ChronoStatSvc.h.

Definition at line 196 of file ChronoStatSvc.h.

Constructor & Destructor Documentation

ChronoStatSvc::ChronoStatSvc ( const std::string name,
ISvcLocator svcloc 
)

Default constructor.

Parameters
nameservice instance name
svclocpointer 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 92 of file ChronoStatSvc.cpp.

: base_class( name , svcloc )
//
// the header row
, m_header ( " Counter | # | sum | mean/eff^* | rms/err^* | min | max |")
// format for regular statistical printout rows
, m_format1 ( " %|-15.15s|%|17t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" )
// format for "efficiency" statistical printout rows
, m_format2 ( "*%|-15.15s|%|17t||%|10d| |%|11.5g| |(%|#9.7g| +- %|-#9.7g|)%%| ------- | ------- |" )
// flag to use the special "efficiency" format
, m_useEffFormat ( true )
{
declareProperty ( "ChronoPrintOutTable" ,
declareProperty ( "ChronoDestinationCout" ,
m_chronoCoutFlag = false );
declareProperty ( "ChronoPrintLevel" ,
declareProperty ( "ChronoTableToBeOrdered" ,
declareProperty ( "PrintUserTime" ,
m_printUserTime = true );
declareProperty ( "PrintSystemTime" ,
m_printSystemTime = false );
declareProperty ( "PrintEllapsedTime" ,
declareProperty ( "StatPrintOutTable" ,
m_statTableFlag = true );
declareProperty ( "StatDestinationCout" ,
m_statCoutFlag = false );
declareProperty ( "StatPrintLevel" ,
declareProperty ( "StatTableToBeOrdered" ,
m_statOrderFlag = true );
// specify the number of events to be skipped by the memory auditor
// in order to better spot memory leak
declareProperty ( "NumberOfSkippedEventsForMemStat" ,
declareProperty( "AsciiStatsOutputFile",
"Name of the output file storing the stats. If empty, no"
" statistics will be saved (default)" );
( "StatTableHeader" , m_header ,
"The header row for the output Stat-table" ) ;
( "RegularRowFormat" , m_format1 ,
"The format for the regular row in the output Stat-table" ) ;
( "EfficiencyRowFormat" , m_format2 ,
"The format for the regular row in the output Stat-table" ) ;
( "UseEfficiencyRowFormat" , m_useEffFormat ,
"Use the special format for printout of efficiency counters" ) ;
( "PerEventFile", m_perEventFile="",
"File name for per-event deltas" );
}
ChronoStatSvc::~ChronoStatSvc ( )
virtual

Destructor.

Definition at line 176 of file ChronoStatSvc.cpp.

{
// clear the container of chrono entities
// clear the container of stat entities
}
ChronoStatSvc::ChronoStatSvc ( )
private
ChronoStatSvc::ChronoStatSvc ( const ChronoStatSvc )
private

Member Function Documentation

const ChronoEntity * ChronoStatSvc::chrono ( const IChronoStatSvc::ChronoTag t) const
virtual

extract the chrono entity for the given tag (name)

See Also
IChronoStatSvc
Parameters
tchrono tag(name)
Returns
pointer to chrono entity

Definition at line 514 of file ChronoStatSvc.cpp.

{
if ( m_chronoEntities.end() != it ) { return &(it->second) ; }
return 0 ;
}
IChronoStatSvc::ChronoTime ChronoStatSvc::chronoDelta ( const IChronoStatSvc::ChronoTag chronoTag,
IChronoStatSvc::ChronoType  theType 
)
virtual

Implementation of IchronoStatSvc::chronoDelta.

See Also
IChronoStatSvc

Definition at line 442 of file ChronoStatSvc.cpp.

{
return m_chronoEntities[ chronoTag ].delta( theType );
}
void ChronoStatSvc::chronoPrint ( const IChronoStatSvc::ChronoTag chronoTag)
virtual

Implementation of IChronoStatSvc::chronoPrint.

See Also
IChronoStatSvc

Definition at line 451 of file ChronoStatSvc.cpp.

{
MsgStream log ( msgSvc() , chronoTag );
<< m_chronoEntities[ chronoTag ].outputUserTime ()
<< endmsg;
}
<< m_chronoEntities[ chronoTag ].outputSystemTime()
<< endmsg;
}
}
ChronoEntity * ChronoStatSvc::chronoStart ( const IChronoStatSvc::ChronoTag chronoTag)
virtual

Implementation of IChronoStatSvc::chronoStart.

See Also
IChronoStatSvc

Definition at line 420 of file ChronoStatSvc.cpp.

{
ChronoEntity& entity = m_chronoEntities [ chronoTag ] ;
entity.start() ;
return &entity ;
}
IChronoStatSvc::ChronoStatus ChronoStatSvc::chronoStatus ( const IChronoStatSvc::ChronoTag chronoTag)
virtual

Implementation of IChronoStatSvc::chronoStatus.

See Also
IChronoStatSvc

Definition at line 470 of file ChronoStatSvc.cpp.

{ return m_chronoEntities[ chronoTag ].status(); }
const ChronoEntity * ChronoStatSvc::chronoStop ( const IChronoStatSvc::ChronoTag chronoTag)
virtual

Implementation of IChronoStatSvc::chronoStop.

See Also
IChronoStatSvc

Definition at line 431 of file ChronoStatSvc.cpp.

{
ChronoEntity& entity = m_chronoEntities [ chronoTag ] ;
entity.stop() ;
return &entity ;
}
StatusCode ChronoStatSvc::finalize ( )
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 251 of file ChronoStatSvc.cpp.

{
std::string local = name()+".finalize()";
MsgStream main_log( msgSvc() , local );
if (m_ofd.is_open()) {
log << MSG::DEBUG << "writing per-event timing data to '" << m_perEventFile << "'" << endmsg;
for (itr=m_perEvtTime.begin(); itr != m_perEvtTime.end(); ++itr) {
alg = itr->first;
alg.erase(alg.length()-8,8);
m_ofd << alg << " ";
for (itt=itr->second.begin(); itt!=itr->second.end(); ++itt) {
m_ofd << " " << (long int)(*itt);
}
}
m_ofd.close();
}
{
MsgStream log( msgSvc() , "*****Chrono*****" );
const std::string stars( ( m_chronoCoutFlag ) ? 126 : 100 , '*' );
{
std::cout << stars << std::endl;
std::cout << local << " The Final CPU consumption (Chrono) Table "
<< ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
std::cout << stars << std::endl;
}
else
{
<< stars << endmsg;
<< " The Final CPU consumption ( Chrono ) Table "
<< ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
log << (MSG::Level) m_chronoPrintLevel << stars << endmsg;
}
{ // prepare container for printing
typedef std::vector<MPair> MCont;
MCont tmpCont;
m_chronoEntities.end() != it ; ++it )
{ tmpCont.push_back( MPair( &(it->second) , &(it->first) ) ) ; }
// sort it
{ std::sort( tmpCont.begin() ,
tmpCont.end() ,
// print User Time statistics
{
for( MCont::iterator iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
{
//
ChronoEntity* entity = iter->first ; if( 0 == entity ) { continue ; }
const ChronoTag* tag = iter->second ; if( 0 == tag ) { continue ; }
entity->stop();
{ std::cout << *tag << "\t" << entity->outputUserTime () << std::endl ; }
else
{
MsgStream(msgSvc(), *tag)
}
//
}
}
{
{ std::cout << stars << std::endl; }
{ log << (MSG::Level) m_chronoPrintLevel << stars << endmsg; }
for( MCont::iterator iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
{
ChronoEntity* entity = iter->first ; if( 0 == entity ) { continue ; }
const ChronoTag* tag = iter->second ; if( 0 == tag ) { continue ; }
entity->stop();
{ std::cout << *tag << "\t" << entity->outputSystemTime() << std::endl ; }
else
{
MsgStream(msgSvc(), *tag)
}
//
}
}
{
{ std::cout << stars << std::endl; }
{ log << (MSG::Level) m_chronoPrintLevel << stars << endmsg; }
for( MCont::iterator iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
{
ChronoEntity* entity = iter->first ; if( 0 == entity ) { continue ; }
const ChronoTag* tag = iter->second ; if( 0 == tag ) { continue ; }
entity->stop();
{ std::cout << *tag << "\t" << entity->outputElapsedTime() << std::endl ; }
else
{
MsgStream(msgSvc(), *tag)
}
//
}
}
tmpCont.clear();
}
if( m_chronoCoutFlag ) { std::cout << stars << std::endl; }
else { log << m_chronoPrintLevel << stars << endmsg; }
}
if ( m_statTableFlag ) { printStats () ; }
if ( !m_statsOutFileName.value().empty() ) {
}
main_log << MSG::INFO << " Service finalized successfully " << endmsg;
return Service::finalize();
}
void ChronoStatSvc::handle ( const Incident incident)

Definition at line 693 of file ChronoStatSvc.cpp.

{
if (! m_ofd.is_open()) return;
for (itr=m_chronoEntities.begin(); itr != m_chronoEntities.end(); ++itr) {
if (itr->first.find(":Execute") == std::string::npos) continue;
itm = m_perEvtTime.find(itr->first);
if (itm == m_perEvtTime.end()) {
// for when we move past gcc46....
// m_perEvtTime[itr->first] =
// std::vector<IChronoSvc::ChronoTime> {
// itr->second.delta(IChronoSvc::ELAPSED) };
m_perEvtTime[itr->first].push_back(itr->second.delta(IChronoSvc::ELAPSED));
} else {
itm->second.push_back( itr->second.delta(IChronoSvc::ELAPSED) );
}
}
}
StatusCode ChronoStatSvc::initialize ( )
virtual

Implementation of IService::initialize()

redefine some "properties"

start its own chrono

Reimplemented from Service.

Definition at line 186 of file ChronoStatSvc.cpp.

{
if ( sc.isFailure() ) return sc;
MsgStream log( msgSvc() , this->name() );
// Set my own properties
sc = setProperties();
if (sc.isFailure()) {
log << MSG::ERROR << "setting my properties" << endmsg;
}
// only add an EndEvent listener if per-event output requested
if (m_perEventFile != "") {
m_ofd.open(m_perEventFile.c_str());
if (!m_ofd.is_open()) {
log << MSG::ERROR << "unable to open per-event output file \""
<< m_perEventFile << "\"" << endmsg;
} else {
if (! ii) {
log << MSG::ERROR << "Unable to find IncidentSvc" << endmsg;
}
ii->addListener(this, IncidentType::EndEvent);
}
}
log << MSG::INFO << " Number of skipped events for MemStat"
}
ChronoStatSvc& ChronoStatSvc::operator= ( const ChronoStatSvc )
private
void ChronoStatSvc::printStats ( )
protected

nothing to print?

CONTINUE

CONTINUE

decoration

Definition at line 615 of file ChronoStatSvc.cpp.

{
if ( m_statEntities.empty() ) { return ; }
MsgStream log ( msgSvc() , "******Stat******" ) ;
const std::string stars( ( m_statCoutFlag ) ? 126 : 100 , '*' ) ;
{
std::cout << stars << std::endl;
std::cout << " The Final stat Table "
<< ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
std::cout << stars << std::endl;
}
else
{
log << m_statPrintLevel << stars << endmsg;
log << m_statPrintLevel << " The Final stat Table "
<< ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
log << m_statPrintLevel << stars << endmsg;
}
{
// prepare container for printing
typedef std::vector<SPair> SCont;
SCont tmpCont;
it != m_statEntities.end(); it++ )
{ tmpCont.push_back( SPair( &(it->second) , &(it->first) ) ) ; }
// sort it
{ std::sort( tmpCont.begin() ,
tmpCont.end() ,
{
// print the table header
else { log << m_statPrintLevel << m_header << endmsg ; }
}
// loop over counters and print them:
for ( SCont::iterator iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
{
const StatEntity* entity = iter->first ;
if ( 0 == entity ) { continue ; }
const StatTag* tag = iter->second ;
if ( 0 == tag ) { continue ; }
{
( *tag , *entity , m_useEffFormat , m_format1 , m_format2 )
}
else
{
( *tag , *entity , m_useEffFormat , m_format1 , m_format2 )
<< endmsg ;
}
}
tmpCont.clear();
}
if ( m_statCoutFlag ) { std::cout << stars << std::endl; }
else { log << m_statPrintLevel << stars << endmsg; }
}
void ChronoStatSvc::saveStats ( )
private

dump the statistics into an ASCII file for offline processing

CONTINUE

CONTINUE

Definition at line 537 of file ChronoStatSvc.cpp.

{
if ( !out.good() ) {
<< "Could not open the output file for writing chrono statistics ["
<< endmsg;
return;
} else {
// format it our way
}
// ChronoEntity
typedef std::vector<MPair> MCont;
MCont chronos;
m_chronoEntities.end() != it ; ++it ) {
chronos.push_back( MPair( &(it->second) , &(it->first) ) ) ;
}
// sort it
std::sort( chronos.begin() ,
chronos.end() ,
// print User Time statistics
for( MCont::iterator iter = chronos.begin() ;
chronos.end() != iter;
++iter ) {
//
const ChronoEntity* entity = iter->first;
if( 0 == entity ) { continue ; }
const ChronoTag* tag = iter->second ;
if( 0 == tag ) { continue ; }
// create an entry in the .INI-like table
out << "\n[" << *tag << "]\n";
// user
out << "cpu_user_total = " << entity->uTotalTime() << "\n";
out << "cpu_user_min = " << entity->uMinimalTime() << "\n";
out << "cpu_user_mean = " << entity->uMeanTime() << "\n";
out << "cpu_user_RMS = " << entity->uRMSTime() << "\n";
out << "cpu_user_max = " << entity->uMaximalTime() << "\n";
out << "cpu_user_nbr = " << entity->nOfMeasurements() << "\n";
// system
out << "\n"; // just for clarity
out << "cpu_system_total = " << entity->kTotalTime() << "\n";
out << "cpu_system_min = " << entity->kMinimalTime() << "\n";
out << "cpu_system_mean = " << entity->kMeanTime() << "\n";
out << "cpu_system_RMS = " << entity->kRMSTime() << "\n";
out << "cpu_system_max = " << entity->kMaximalTime() << "\n";
out << "cpu_system_nbr = " << entity->nOfMeasurements() << "\n";
// real
out << "\n"; // just for clarity
out << "cpu_real_total = " << entity->eTotalTime() << "\n";
out << "cpu_real_min = " << entity->eMinimalTime() << "\n";
out << "cpu_real_mean = " << entity->eMeanTime() << "\n";
out << "cpu_real_RMS = " << entity->eRMSTime() << "\n";
out << "cpu_real_max = " << entity->eMaximalTime() << "\n";
out << "cpu_real_nbr = " << entity->nOfMeasurements() << "\n";
}
out << std::endl;
}
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 476 of file ChronoStatSvc.cpp.

{
StatEntity * theStat=0 ;
// if new entity, specify the number of events to be skipped
if (theIter==m_statEntities.end()){
// new stat entity
StatEntity& theSe = m_statEntities[ statTag ];
theStat=& theSe;
}
else
{
//existing stat entity
theStat=&((*theIter).second);
}
theStat->addFlag ( statFlag ) ;
}
const StatEntity * ChronoStatSvc::stat ( const IChronoStatSvc::StatTag t) const
virtual

extract the stat entity for the given tag (name)

See Also
IChronoStatSvc
Parameters
tstat tag(name)
Returns
pointer to stat entity

Definition at line 528 of file ChronoStatSvc.cpp.

{
if ( m_statEntities.end() != it ) { return &(it->second) ; }
return 0 ;
}
void ChronoStatSvc::statPrint ( const IChronoStatSvc::ChronoTag statTag)
virtual

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

See Also
IChronoStatSvc

Definition at line 501 of file ChronoStatSvc.cpp.

{
MsgStream log ( msgSvc() , statTag ) ;
}

Member Data Documentation

bool ChronoStatSvc::m_chronoCoutFlag
private

flag for destination of the the final table

Definition at line 157 of file ChronoStatSvc.h.

ChronoMap ChronoStatSvc::m_chronoEntities
private

chrono part

Definition at line 150 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_chronoOrderFlag
private

flag for formattion the final statistic table

Definition at line 159 of file ChronoStatSvc.h.

MSG::Level ChronoStatSvc::m_chronoPrintLevel
private

Definition at line 153 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_chronoTableFlag
private

flag for printing the final table

Definition at line 155 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_format1
private

format for regular statistical printout rows

Definition at line 190 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_format2
private

format for "efficiency" statistical printout rows

Definition at line 192 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_header
private

the header row

Definition at line 188 of file ChronoStatSvc.h.

int ChronoStatSvc::m_intChronoPrintLevel
private

level of info printing

Definition at line 152 of file ChronoStatSvc.h.

int ChronoStatSvc::m_intStatPrintLevel
private

level of info printing

Definition at line 174 of file ChronoStatSvc.h.

long ChronoStatSvc::m_numberOfSkippedEventsForMemStat
private

Definition at line 168 of file ChronoStatSvc.h.

std::ofstream ChronoStatSvc::m_ofd
private

Definition at line 199 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_perEventFile
private

Definition at line 198 of file ChronoStatSvc.h.

TimeMap ChronoStatSvc::m_perEvtTime
private

Definition at line 197 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_printEllapsedTime
private

flag for printing Ellapsed quantities

Definition at line 165 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_printSystemTime
private

flag for printing System quantities

Definition at line 163 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_printUserTime
private

flag for printing User quantities

Definition at line 161 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_statCoutFlag
private

flag for destination of the t he final table

Definition at line 179 of file ChronoStatSvc.h.

StatMap ChronoStatSvc::m_statEntities
private

stat part

Definition at line 171 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_statOrderFlag
private

flag for formattion the final statistic table

Definition at line 181 of file ChronoStatSvc.h.

MSG::Level ChronoStatSvc::m_statPrintLevel
private

Definition at line 175 of file ChronoStatSvc.h.

StringProperty ChronoStatSvc::m_statsOutFileName
private

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

Definition at line 185 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_statTableFlag
private

flag for printing the final table

Definition at line 177 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_useEffFormat
private

flag to use the special "efficiency" format

Definition at line 194 of file ChronoStatSvc.h.


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

Generated at Wed Dec 4 2013 14:33:14 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004