All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 <src/ChronoStatSvc.h>

Inheritance diagram for ChronoStatSvc:
Collaboration diagram for ChronoStatSvc:

Public Types

typedef std::map
< IChronoStatSvc::ChronoTag,
ChronoEntity
ChronoMap
 some useful typedefs More...
 
typedef std::map
< IChronoStatSvc::StatTag,
StatEntity
StatMap
 
- Public Types inherited from extends2< Service, IChronoStatSvc, IIncidentListener >
typedef extends2 base_class
 Typedef to this class. More...
 
typedef extend_interfaces2
< IChronoStatSvc,
IIncidentListener
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from Service
typedef
Gaudi::PluginService::Factory2
< IService *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IService, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename
IService::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Public Types inherited from extend_interfaces2< IChronoStatSvc, IIncidentListener >
typedef mpl::fold< typename
IChronoStatSvc::iid::iids::type,
typename
IIncidentListener::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from extend_interfaces3< IService, IChronoSvc, IStatSvc >
typedef mpl::fold< typename
IService::iid::iids::type,
typename mpl::fold< typename
IChronoSvc::iid::iids::type,
typename
IStatSvc::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IChronoSvc
enum  ChronoStatus { UNKNOWN = 0, RUNNING, STOPPED }
 
enum  ChronoType { USER = 0, KERNEL, ELAPSED }
 
typedef std::string ChronoTag
 the actual type of identifier for Chrono objects More...
 
typedef double ChronoTime
 Type of the delta-time. More...
 
- Public Types inherited from IStatSvc
typedef std::string StatTag
 the actual identificator of Stat More...
 
typedef double StatFlag
 the actual value type used for Stat More...
 

Public Member Functions

virtual StatusCode initialize ()
 Implementation of IService::initialize() More...
 
virtual StatusCode finalize ()
 Implementation of IService::finalize() More...
 
virtual ChronoEntitychronoStart (const IChronoStatSvc::ChronoTag &chronoTag)
 Implementation of IChronoStatSvc::chronoStart. More...
 
virtual const ChronoEntitychronoStop (const IChronoStatSvc::ChronoTag &chronoTag)
 Implementation of IChronoStatSvc::chronoStop. More...
 
virtual IChronoStatSvc::ChronoTime chronoDelta (const IChronoStatSvc::ChronoTag &chronoTag, IChronoStatSvc::ChronoType theType)
 Implementation of IchronoStatSvc::chronoDelta. More...
 
virtual void chronoPrint (const IChronoStatSvc::ChronoTag &chronoTag)
 Implementation of IChronoStatSvc::chronoPrint. More...
 
virtual ChronoStatus chronoStatus (const IChronoStatSvc::ChronoTag &chronoTag)
 Implementation of IChronoStatSvc::chronoStatus. More...
 
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. More...
 
virtual void statPrint (const IChronoStatSvc::ChronoTag &statTag)
 prints (using message service) info about statistical entity, tagged by its name More...
 
virtual const ChronoEntitychrono (const IChronoStatSvc::ChronoTag &t) const
 extract the chrono entity for the given tag (name) More...
 
virtual const StatEntitystat (const IChronoStatSvc::StatTag &t) const
 extract the stat entity for the given tag (name) More...
 
 ChronoStatSvc (const std::string &name, ISvcLocator *svcloc)
 Default constructor. More...
 
virtual ~ChronoStatSvc ()
 Destructor. More...
 
void handle (const Incident &incident)
 Inform that a new incident has occurred. More...
 
- Public Member Functions inherited from extends2< Service, IChronoStatSvc, IIncidentListener >
 extends2 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends2 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends2 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends2 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends2 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
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. More...
 
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. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- 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. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces2< IChronoStatSvc, IIncidentListener >
virtual ~extend_interfaces2 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IChronoStatSvc
 DeclareInterfaceIDMultiBase (IChronoStatSvc, 6, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IChronoSvc, IStatSvc >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IChronoSvc
 DeclareInterfaceID (IChronoSvc, 3, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStatSvc
 DeclareInterfaceID (IStatSvc, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IIncidentListener
 DeclareInterfaceID (IIncidentListener, 2, 0)
 InterfaceID. More...
 

Protected Member Functions

void printStats ()
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
- Protected Member Functions inherited from IChronoStatSvc
virtual ~IChronoStatSvc ()
 virtual desctructor More...
 
- Protected Member Functions inherited from IChronoSvc
virtual ~IChronoSvc ()
 protected and virtual destructor More...
 
- Protected Member Functions inherited from IStatSvc
virtual ~IStatSvc ()
 Destructor. More...
 

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 More...
 

Private Attributes

ChronoMap m_chronoEntities
 chrono part More...
 
int m_intChronoPrintLevel
 level of info printing More...
 
MSG::Level m_chronoPrintLevel
 
bool m_chronoTableFlag
 flag for printing the final table More...
 
bool m_chronoCoutFlag
 flag for destination of the the final table More...
 
bool m_chronoOrderFlag
 flag for formattion the final statistic table More...
 
bool m_printUserTime
 flag for printing User quantities More...
 
bool m_printSystemTime
 flag for printing System quantities More...
 
bool m_printEllapsedTime
 flag for printing Ellapsed quantities More...
 
long m_numberOfSkippedEventsForMemStat
 
StatMap m_statEntities
 stat part More...
 
int m_intStatPrintLevel
 level of info printing More...
 
MSG::Level m_statPrintLevel
 
bool m_statTableFlag
 flag for printing the final table More...
 
bool m_statCoutFlag
 flag for destination of the t he final table More...
 
bool m_statOrderFlag
 flag for formattion the final statistic table More...
 
StringProperty m_statsOutFileName
 Name of the output file where we'll dump the stats. More...
 
std::string m_header
 the header row More...
 
std::string m_format1
 format for regular statistical printout rows More...
 
std::string m_format2
 format for "efficiency" statistical printout rows More...
 
bool m_useEffFormat
 flag to use the special "efficiency" format More...
 
TimeMap m_perEvtTime
 
std::string m_perEventFile
 
std::ofstream m_ofd
 

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

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 33 of file ChronoStatSvc.h.

Member Typedef Documentation

some useful typedefs

Definition at line 38 of file ChronoStatSvc.h.

Definition at line 39 of file ChronoStatSvc.h.

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

Definition at line 191 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 87 of file ChronoStatSvc.cpp.

88  : base_class( name , svcloc )
89  , m_chronoEntities ()
91  , m_statEntities ()
93  //
94  // the header row
95  , m_header ( " Counter | # | sum | mean/eff^* | rms/err^* | min | max |")
96  // format for regular statistical printout rows
97  , m_format1 ( " %|-15.15s|%|17t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" )
98  // format for "efficiency" statistical printout rows
99  , m_format2 ( "*%|-15.15s|%|17t||%|10d| |%|11.5g| |(%|#9.7g| +- %|-#9.7g|)%%| ------- | ------- |" )
100  // flag to use the special "efficiency" format
101  , m_useEffFormat ( true )
102 {
104  declareProperty ( "ChronoPrintOutTable" ,
105  m_chronoTableFlag = true );
107  declareProperty ( "ChronoDestinationCout" ,
108  m_chronoCoutFlag = false );
110  declareProperty ( "ChronoPrintLevel" ,
114  declareProperty ( "ChronoTableToBeOrdered" ,
115  m_chronoOrderFlag = true );
117  declareProperty ( "PrintUserTime" ,
118  m_printUserTime = true );
120  declareProperty ( "PrintSystemTime" ,
121  m_printSystemTime = false );
123  declareProperty ( "PrintEllapsedTime" ,
124  m_printEllapsedTime = false );
127  declareProperty ( "StatPrintOutTable" ,
128  m_statTableFlag = true );
130  declareProperty ( "StatDestinationCout" ,
131  m_statCoutFlag = false );
133  declareProperty ( "StatPrintLevel" ,
137  declareProperty ( "StatTableToBeOrdered" ,
138  m_statOrderFlag = true );
139 
140  // specify the number of events to be skipped by the memory auditor
141  // in order to better spot memory leak
142  declareProperty ( "NumberOfSkippedEventsForMemStat" ,
144 
145  declareProperty( "AsciiStatsOutputFile",
146  m_statsOutFileName = "",
147  "Name of the output file storing the stats. If empty, no"
148  " statistics will be saved (default)" );
149 
151  ( "StatTableHeader" , m_header ,
152  "The header row for the output Stat-table" ) ;
154  ( "RegularRowFormat" , m_format1 ,
155  "The format for the regular row in the output Stat-table" ) ;
157  ( "EfficiencyRowFormat" , m_format2 ,
158  "The format for the regular row in the output Stat-table" ) ;
160  ( "UseEfficiencyRowFormat" , m_useEffFormat ,
161  "Use the special format for printout of efficiency counters" ) ;
162 
164  ( "PerEventFile", m_perEventFile="",
165  "File name for per-event deltas" );
166 
167 }
bool m_useEffFormat
flag to use the special "efficiency" format
int m_intStatPrintLevel
level of info printing
bool m_chronoOrderFlag
flag for formattion the final statistic table
bool m_printUserTime
flag for printing User quantities
StatMap m_statEntities
stat part
bool m_printEllapsedTime
flag for printing Ellapsed quantities
std::string m_header
the header row
extends2 base_class
Typedef to this class.
Definition: extends.h:77
StringProperty m_statsOutFileName
Name of the output file where we'll dump the stats.
long m_numberOfSkippedEventsForMemStat
std::string m_format2
format for "efficiency" statistical printout rows
bool m_chronoTableFlag
flag for printing the final table
int m_intChronoPrintLevel
level of info printing
bool m_statOrderFlag
flag for formattion the final statistic table
bool m_statTableFlag
flag for printing the final table
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
MSG::Level m_chronoPrintLevel
bool m_statCoutFlag
flag for destination of the t he final table
bool m_printSystemTime
flag for printing System quantities
std::string m_perEventFile
MSG::Level m_statPrintLevel
bool m_chronoCoutFlag
flag for destination of the the final table
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:209
std::string m_format1
format for regular statistical printout rows
ChronoMap m_chronoEntities
chrono part
ChronoStatSvc::~ChronoStatSvc ( )
virtual

Destructor.

Definition at line 171 of file ChronoStatSvc.cpp.

172 {
173  // clear the container of chrono entities
174  m_chronoEntities.clear();
175  // clear the container of stat entities
176  m_statEntities.clear();
177 }
StatMap m_statEntities
stat part
ChronoMap m_chronoEntities
chrono part
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

Implements IChronoSvc.

Definition at line 509 of file ChronoStatSvc.cpp.

510 {
511  ChronoMap::const_iterator it = m_chronoEntities.find ( t ) ;
512  if ( m_chronoEntities.end() != it ) { return &(it->second) ; }
513  return 0 ;
514 }
ChronoMap m_chronoEntities
chrono part
IChronoStatSvc::ChronoTime ChronoStatSvc::chronoDelta ( const IChronoStatSvc::ChronoTag chronoTag,
IChronoStatSvc::ChronoType  theType 
)
virtual

Implementation of IchronoStatSvc::chronoDelta.

See also
IChronoStatSvc

Implements IChronoSvc.

Definition at line 437 of file ChronoStatSvc.cpp.

439 {
440  return m_chronoEntities[ chronoTag ].delta( theType );
441 }
ChronoMap m_chronoEntities
chrono part
void ChronoStatSvc::chronoPrint ( const IChronoStatSvc::ChronoTag chronoTag)
virtual

Implementation of IChronoStatSvc::chronoPrint.

See also
IChronoStatSvc

Implements IChronoSvc.

Definition at line 446 of file ChronoStatSvc.cpp.

447 {
448  MsgStream log ( msgSvc() , chronoTag );
449  if( m_printUserTime ) {
451  << m_chronoEntities[ chronoTag ].outputUserTime ()
452  << endmsg;
453  }
454  if( m_printSystemTime ) {
456  << m_chronoEntities[ chronoTag ].outputSystemTime()
457  << endmsg;
458  }
459 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool m_printUserTime
flag for printing User quantities
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
MSG::Level m_chronoPrintLevel
bool m_printSystemTime
flag for printing System quantities
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243
ChronoMap m_chronoEntities
chrono part
ChronoEntity * ChronoStatSvc::chronoStart ( const IChronoStatSvc::ChronoTag chronoTag)
virtual

Implementation of IChronoStatSvc::chronoStart.

See also
IChronoStatSvc

Implements IChronoSvc.

Definition at line 415 of file ChronoStatSvc.cpp.

416 {
417  ChronoEntity& entity = m_chronoEntities [ chronoTag ] ;
418  entity.start() ;
419  return &entity ;
420 }
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
IChronoSvc::ChronoStatus start()
start the current chrono
ChronoMap m_chronoEntities
chrono part
IChronoStatSvc::ChronoStatus ChronoStatSvc::chronoStatus ( const IChronoStatSvc::ChronoTag chronoTag)
virtual

Implementation of IChronoStatSvc::chronoStatus.

See also
IChronoStatSvc

Implements IChronoSvc.

Definition at line 465 of file ChronoStatSvc.cpp.

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

Implementation of IChronoStatSvc::chronoStop.

See also
IChronoStatSvc

Implements IChronoSvc.

Definition at line 426 of file ChronoStatSvc.cpp.

427 {
428  ChronoEntity& entity = m_chronoEntities [ chronoTag ] ;
429  entity.stop() ;
430  return &entity ;
431 }
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
IChronoSvc::ChronoStatus stop()
stop the chrono
ChronoMap m_chronoEntities
chrono part
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 246 of file ChronoStatSvc.cpp.

247 {
248  std::string local = name()+".finalize()";
250  MsgStream main_log( msgSvc() , local );
253  chronoStop( name() ) ;
254 
255  if (m_ofd.is_open()) {
256  MsgStream log(msgSvc(), name());
257  log << MSG::DEBUG << "writing per-event timing data to '" << m_perEventFile << "'" << endmsg;
258  std::string alg;
259  TimeMap::const_iterator itr;
260  for (itr=m_perEvtTime.begin(); itr != m_perEvtTime.end(); ++itr) {
261  alg = itr->first;
262  alg.erase(alg.length()-8,8);
263  m_ofd << alg << " ";
264  std::vector<IChronoSvc::ChronoTime>::const_iterator itt;
265  for (itt=itr->second.begin(); itt!=itr->second.end(); ++itt) {
266  m_ofd << " " << (long int)(*itt);
267  }
268  m_ofd << std::endl;
269  }
270 
271  m_ofd.close();
272  }
273 
276  if ( m_chronoTableFlag &&
277  !m_chronoEntities.empty() &&
279  {
281  MsgStream log( msgSvc() , "*****Chrono*****" );
282  const std::string stars( ( m_chronoCoutFlag ) ? 126 : 100 , '*' );
283  if( m_chronoCoutFlag )
284  {
285  std::cout << stars << std::endl;
286  std::cout << local << " The Final CPU consumption (Chrono) Table "
287  << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
288  std::cout << stars << std::endl;
289  }
290  else
291  {
293  << stars << endmsg;
295  << " The Final CPU consumption ( Chrono ) Table "
296  << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
297  log << (MSG::Level) m_chronoPrintLevel << stars << endmsg;
298  }
300  { // prepare container for printing
301  typedef std::pair<ChronoEntity*,const ChronoTag*> MPair;
302  typedef std::vector<MPair> MCont;
303  MCont tmpCont;
304  for( ChronoMap::iterator it = m_chronoEntities.begin() ;
305  m_chronoEntities.end() != it ; ++it )
306  { tmpCont.push_back( MPair( &(it->second) , &(it->first) ) ) ; }
307  // sort it
308  if( m_chronoOrderFlag )
309  { std::sort( tmpCont.begin() ,
310  tmpCont.end() ,
312  // print User Time statistics
313  if( m_printUserTime )
314  {
315  for( MCont::iterator iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
316  {
317  //
318  ChronoEntity* entity = iter->first ; if( 0 == entity ) { continue ; }
319  const ChronoTag* tag = iter->second ; if( 0 == tag ) { continue ; }
320  entity->stop();
322  if ( m_chronoCoutFlag )
324  { std::cout << *tag << "\t" << entity->outputUserTime () << std::endl ; }
325  else
326  {
327  MsgStream(msgSvc(), *tag)
328  << m_chronoPrintLevel << entity->outputUserTime () << endmsg ;
329  }
330  //
331  }
332  }
334  if( m_printSystemTime )
335  {
339  { std::cout << stars << std::endl; }
340  else if ( m_printUserTime && !m_chronoCoutFlag )
341  { log << (MSG::Level) m_chronoPrintLevel << stars << endmsg; }
343  for( MCont::iterator iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
344  {
346  ChronoEntity* entity = iter->first ; if( 0 == entity ) { continue ; }
347  const ChronoTag* tag = iter->second ; if( 0 == tag ) { continue ; }
348  entity->stop();
350  if ( m_chronoCoutFlag )
352  { std::cout << *tag << "\t" << entity->outputSystemTime() << std::endl ; }
353  else
354  {
355  MsgStream(msgSvc(), *tag)
356  << m_chronoPrintLevel << entity->outputSystemTime() << endmsg ;
357  }
358  //
359  }
360  }
362  if( m_printEllapsedTime )
363  {
367  { std::cout << stars << std::endl; }
368  else if ( ( m_printUserTime || m_printSystemTime ) && !m_chronoCoutFlag )
369  { log << (MSG::Level) m_chronoPrintLevel << stars << endmsg; }
371  for( MCont::iterator iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
372  {
374  ChronoEntity* entity = iter->first ; if( 0 == entity ) { continue ; }
375  const ChronoTag* tag = iter->second ; if( 0 == tag ) { continue ; }
376  entity->stop();
378  if ( m_chronoCoutFlag )
380  { std::cout << *tag << "\t" << entity->outputElapsedTime() << std::endl ; }
381  else
382  {
383  MsgStream(msgSvc(), *tag)
384  << m_chronoPrintLevel << entity->outputElapsedTime() << endmsg ;
385  }
386  //
387  }
388  }
390  tmpCont.clear();
391  }
393  if( m_chronoCoutFlag ) { std::cout << stars << std::endl; }
394  else { log << m_chronoPrintLevel << stars << endmsg; }
395  }
396 
398 
400  if ( m_statTableFlag ) { printStats () ; }
401 
402  if ( !m_statsOutFileName.value().empty() ) {
403  saveStats();
404  }
405 
406  main_log << MSG::INFO << " Service finalized successfully " << endmsg;
407 
408  return Service::finalize();
409 }
std::string outputElapsedTime() const
print the chrono ;
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool m_chronoOrderFlag
flag for formattion the final statistic table
bool m_printUserTime
flag for printing User quantities
bool m_printEllapsedTime
flag for printing Ellapsed quantities
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
StringProperty m_statsOutFileName
Name of the output file where we'll dump the stats.
std::string outputSystemTime() const
print the chrono ;
bool m_chronoTableFlag
flag for printing the final table
virtual const ChronoEntity * chronoStop(const IChronoStatSvc::ChronoTag &chronoTag)
Implementation of IChronoStatSvc::chronoStop.
void saveStats()
dump the statistics into an ASCII file for offline processing
std::string ChronoTag
the actual type of identifier for Chrono objects
Definition: IChronoSvc.h:40
void clear(STATE_TYPE _i=std::ios_base::failbit)
Definition: MsgStream.h:221
TimeMap m_perEvtTime
std::ofstream m_ofd
bool m_statTableFlag
flag for printing the final table
const TYPE & value() const
explicit conversion
Definition: Property.h:355
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
MSG::Level m_chronoPrintLevel
std::string outputUserTime() const
print the chrono ;
bool m_printSystemTime
flag for printing System quantities
std::string m_perEventFile
bool m_chronoCoutFlag
flag for destination of the the final table
IChronoSvc::ChronoStatus stop()
stop the chrono
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:199
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243
ChronoMap m_chronoEntities
chrono part
void ChronoStatSvc::handle ( const Incident )
virtual

Inform that a new incident has occurred.

Implements IIncidentListener.

Definition at line 688 of file ChronoStatSvc.cpp.

688  {
689 
690  if (! m_ofd.is_open()) return;
691 
692  TimeMap::iterator itm;
693  ChronoMap::const_iterator itr;
694  for (itr=m_chronoEntities.begin(); itr != m_chronoEntities.end(); ++itr) {
695  if (itr->first.find(":Execute") == std::string::npos) continue;
696 
697  itm = m_perEvtTime.find(itr->first);
698  if (itm == m_perEvtTime.end()) {
699  // for when we move past gcc46....
700  // m_perEvtTime[itr->first] =
701  // std::vector<IChronoSvc::ChronoTime> {
702  // itr->second.delta(IChronoSvc::ELAPSED) };
703 
704  m_perEvtTime[itr->first] = std::vector<IChronoSvc::ChronoTime>();
705  m_perEvtTime[itr->first].push_back(itr->second.delta(IChronoSvc::ELAPSED));
706  } else {
707  itm->second.push_back( itr->second.delta(IChronoSvc::ELAPSED) );
708  }
709  }
710 
711 }
tuple itm
Definition: ana.py:57
TimeMap m_perEvtTime
std::ofstream m_ofd
ChronoMap m_chronoEntities
chrono part
StatusCode ChronoStatSvc::initialize ( )
virtual

Implementation of IService::initialize()

redefine some "properties"

start its own chrono

Reimplemented from Service.

Definition at line 181 of file ChronoStatSvc.cpp.

182 {
184  if ( sc.isFailure() ) return sc;
186  MsgStream log( msgSvc() , this->name() );
187 
188  // Set my own properties
189  sc = setProperties();
190 
191  if (sc.isFailure()) {
192  log << MSG::ERROR << "setting my properties" << endmsg;
193  return StatusCode::FAILURE;
194  }
195 
196  // only add an EndEvent listener if per-event output requested
197  if (m_perEventFile != "") {
198  m_ofd.open(m_perEventFile.c_str());
199  if (!m_ofd.is_open()) {
200  log << MSG::ERROR << "unable to open per-event output file \""
201  << m_perEventFile << "\"" << endmsg;
202  return StatusCode::FAILURE;
203  } else {
204  SmartIF<IIncidentSvc> ii(serviceLocator()->service("IncidentSvc"));
205  if (! ii) {
206  log << MSG::ERROR << "Unable to find IncidentSvc" << endmsg;
207  return StatusCode::FAILURE;
208  }
209  ii->addListener(this, IncidentType::EndEvent);
210  }
211  }
212 
213  log << MSG::INFO << " Number of skipped events for MemStat"
215 
229  if( m_chronoTableFlag &&
230  !m_printUserTime &&
232  !m_printEllapsedTime ) { m_printUserTime = true ; }
234  if( m_printUserTime ||
239  chronoStart( name() ) ;
241  return StatusCode::SUCCESS;
242 }
int m_intStatPrintLevel
level of info printing
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool m_printUserTime
flag for printing User quantities
bool m_printEllapsedTime
flag for printing Ellapsed quantities
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
long m_numberOfSkippedEventsForMemStat
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
bool m_chronoTableFlag
flag for printing the final table
int m_intChronoPrintLevel
level of info printing
const std::string EndEvent
Processing of the last event has finished.
Definition: Incident.h:61
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
std::ofstream m_ofd
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
Definition: Service.cpp:371
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
MSG::Level m_chronoPrintLevel
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:74
bool m_printSystemTime
flag for printing System quantities
std::string m_perEventFile
virtual ChronoEntity * chronoStart(const IChronoStatSvc::ChronoTag &chronoTag)
Implementation of IChronoStatSvc::chronoStart.
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.
Definition: Service.h:140
MSG::Level m_statPrintLevel
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
ChronoStatSvc& ChronoStatSvc::operator= ( const ChronoStatSvc )
private
void ChronoStatSvc::printStats ( )
protected

nothing to print?

CONTINUE

CONTINUE

decoration

Definition at line 610 of file ChronoStatSvc.cpp.

611 {
613  if ( m_statEntities.empty() ) { return ; }
614 
615  MsgStream log ( msgSvc() , "******Stat******" ) ;
617  const std::string stars( ( m_statCoutFlag ) ? 126 : 100 , '*' ) ;
619  if ( m_statCoutFlag )
620  {
621  std::cout << stars << std::endl;
622  std::cout << " The Final stat Table "
623  << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
624  std::cout << stars << std::endl;
625  }
626  else
627  {
628  log << m_statPrintLevel << stars << endmsg;
629  log << m_statPrintLevel << " The Final stat Table "
630  << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
631  log << m_statPrintLevel << stars << endmsg;
632  }
633 
634  {
635  // prepare container for printing
636  typedef std::pair<const StatEntity*,const StatTag*> SPair;
637  typedef std::vector<SPair> SCont;
638  SCont tmpCont;
639  for( StatMap::const_iterator it = m_statEntities.begin();
640  it != m_statEntities.end(); it++ )
641  { tmpCont.push_back( SPair( &(it->second) , &(it->first) ) ) ; }
642  // sort it
643  if ( m_statOrderFlag )
644  { std::sort( tmpCont.begin() ,
645  tmpCont.end() ,
647 
648 
649  {
650  // print the table header
651  if ( m_statCoutFlag ) { std::cout << m_header << std::endl ; }
652  else { log << m_statPrintLevel << m_header << endmsg ; }
653  }
654  // loop over counters and print them:
655  for ( SCont::iterator iter = tmpCont.begin() ; tmpCont.end() != iter ; ++iter )
656  {
658  const StatEntity* entity = iter->first ;
659  if ( 0 == entity ) { continue ; }
660  const StatTag* tag = iter->second ;
661  if ( 0 == tag ) { continue ; }
662  if ( m_statCoutFlag )
664  {
665  std::cout
667  ( *tag , *entity , m_useEffFormat , m_format1 , m_format2 )
668  << std::endl;
669  }
670  else
671  {
672  log
675  ( *tag , *entity , m_useEffFormat , m_format1 , m_format2 )
676  << endmsg ;
677  }
678  }
679  tmpCont.clear();
680  }
682  if ( m_statCoutFlag ) { std::cout << stars << std::endl; }
683  else { log << m_statPrintLevel << stars << endmsg; }
684 }
bool m_useEffFormat
flag to use the special "efficiency" format
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatMap m_statEntities
stat part
std::string m_header
the header row
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
std::string m_format2
format for "efficiency" statistical printout rows
GAUDI_API std::string formatAsTableRow(const StatEntity &counter, const bool flag, const std::string &format1=" |%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |", const std::string &format2="*|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |")
print the counter in a form of the table row
Definition: StatEntity.cpp:302
bool m_statOrderFlag
flag for formattion the final statistic table
void clear(STATE_TYPE _i=std::ios_base::failbit)
Definition: MsgStream.h:221
bool m_statCoutFlag
flag for destination of the t he final table
MSG::Level m_statPrintLevel
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:68
std::string StatTag
the actual identificator of Stat
Definition: IStatSvc.h:33
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243
std::string m_format1
format for regular statistical printout rows
void ChronoStatSvc::saveStats ( )
private

dump the statistics into an ASCII file for offline processing

CONTINUE

CONTINUE

Definition at line 532 of file ChronoStatSvc.cpp.

533 {
534  std::ofstream out( m_statsOutFileName.value().c_str(),
535  std::ios_base::out | std::ios_base::trunc );
536  if ( !out.good() ) {
537  MsgStream msg( msgSvc() , name() );
538  msg << MSG::INFO
539  << "Could not open the output file for writing chrono statistics ["
540  << m_statsOutFileName.value() << "]"
541  << endmsg;
542  return;
543  } else {
544  // format it our way
545  out << std::scientific << std::setprecision(8) ;
546  }
547 
548  // ChronoEntity
549  typedef std::pair<ChronoEntity*, const ChronoTag*> MPair;
550  typedef std::vector<MPair> MCont;
551  MCont chronos;
552 
553  for( ChronoMap::iterator it = m_chronoEntities.begin() ;
554  m_chronoEntities.end() != it ; ++it ) {
555  chronos.push_back( MPair( &(it->second) , &(it->first) ) ) ;
556  }
557 
558  // sort it
559  std::sort( chronos.begin() ,
560  chronos.end() ,
562 
563  // print User Time statistics
564  for( MCont::iterator iter = chronos.begin() ;
565  chronos.end() != iter;
566  ++iter ) {
567  //
568  const ChronoEntity* entity = iter->first;
569  if( 0 == entity ) { continue ; }
570 
571  const ChronoTag* tag = iter->second ;
572  if( 0 == tag ) { continue ; }
573 
574  // create an entry in the .INI-like table
575  out << "\n[" << *tag << "]\n";
576 
577  // user
578  out << "cpu_user_total = " << entity->uTotalTime() << "\n";
579  out << "cpu_user_min = " << entity->uMinimalTime() << "\n";
580  out << "cpu_user_mean = " << entity->uMeanTime() << "\n";
581  out << "cpu_user_RMS = " << entity->uRMSTime() << "\n";
582  out << "cpu_user_max = " << entity->uMaximalTime() << "\n";
583  out << "cpu_user_nbr = " << entity->nOfMeasurements() << "\n";
584 
585  // system
586  out << "\n"; // just for clarity
587  out << "cpu_system_total = " << entity->kTotalTime() << "\n";
588  out << "cpu_system_min = " << entity->kMinimalTime() << "\n";
589  out << "cpu_system_mean = " << entity->kMeanTime() << "\n";
590  out << "cpu_system_RMS = " << entity->kRMSTime() << "\n";
591  out << "cpu_system_max = " << entity->kMaximalTime() << "\n";
592  out << "cpu_system_nbr = " << entity->nOfMeasurements() << "\n";
593 
594  // real
595  out << "\n"; // just for clarity
596  out << "cpu_real_total = " << entity->eTotalTime() << "\n";
597  out << "cpu_real_min = " << entity->eMinimalTime() << "\n";
598  out << "cpu_real_mean = " << entity->eMeanTime() << "\n";
599  out << "cpu_real_RMS = " << entity->eRMSTime() << "\n";
600  out << "cpu_real_max = " << entity->eMaximalTime() << "\n";
601  out << "cpu_real_nbr = " << entity->nOfMeasurements() << "\n";
602 
603  }
604 
605  out << std::endl;
606 }
double kMaximalTime() const
maximal measurement for kernel time
Definition: ChronoEntity.h:219
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
double uMinimalTime() const
minimal measurement for user time
Definition: ChronoEntity.h:198
double uTotalTime() const
total user time
Definition: ChronoEntity.h:229
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
double kTotalTime() const
total Kernel time
Definition: ChronoEntity.h:234
StringProperty m_statsOutFileName
Name of the output file where we'll dump the stats.
double uRMSTime() const
r.m.s User Time
Definition: ChronoEntity.h:270
double kMinimalTime() const
minimal measurement for kernel time
Definition: ChronoEntity.h:204
double eMinimalTime() const
minimal measurement for elapsed time
Definition: ChronoEntity.h:209
double kRMSTime() const
r.m.s Kernel Time
Definition: ChronoEntity.h:265
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
double kMeanTime() const
average Kernel Time
Definition: ChronoEntity.h:250
double eMeanTime() const
average Elapsed Time
Definition: ChronoEntity.h:260
std::string ChronoTag
the actual type of identifier for Chrono objects
Definition: IChronoSvc.h:40
double eRMSTime() const
r.m.s Elapsed Time
Definition: ChronoEntity.h:275
const TYPE & value() const
explicit conversion
Definition: Property.h:355
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
double uMeanTime() const
average User Time
Definition: ChronoEntity.h:255
double eMaximalTime() const
maximal measurement for elapsed time
Definition: ChronoEntity.h:224
unsigned long nOfMeasurements() const
number of chrono measurements
Definition: ChronoEntity.h:194
double uMaximalTime() const
maximal measurement for user time
Definition: ChronoEntity.h:214
double eTotalTime() const
total Elapsed time
Definition: ChronoEntity.h:239
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243
ChronoMap m_chronoEntities
chrono part
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

Implements IStatSvc.

Definition at line 471 of file ChronoStatSvc.cpp.

473 {
474  StatMap::iterator theIter=m_statEntities.find(statTag);
475 
476  StatEntity * theStat=0 ;
477  // if new entity, specify the number of events to be skipped
478  if (theIter==m_statEntities.end()){
479  // new stat entity
480  StatEntity& theSe = m_statEntities[ statTag ];
481  theStat=& theSe;
483  }
484  else
485  {
486  //existing stat entity
487  theStat=&((*theIter).second);
488  }
489 
490  theStat->addFlag ( statFlag ) ;
491 }
StatMap m_statEntities
stat part
long m_numberOfSkippedEventsForMemStat
void setnEntriesBeforeReset(unsigned long nEntriesBeforeReset)
DR specify number of entry before reset.
Definition: StatEntity.cpp:222
unsigned long addFlag(const double Flag)
add a flag
Definition: StatEntity.h:416
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:68
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

Implements IStatSvc.

Definition at line 523 of file ChronoStatSvc.cpp.

524 {
525  StatMap::const_iterator it = m_statEntities.find ( t ) ;
526  if ( m_statEntities.end() != it ) { return &(it->second) ; }
527  return 0 ;
528 }
StatMap m_statEntities
stat part
void ChronoStatSvc::statPrint ( const IChronoStatSvc::ChronoTag statTag)
virtual

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

See also
IChronoStatSvc

Implements IStatSvc.

Definition at line 496 of file ChronoStatSvc.cpp.

497 {
498  MsgStream log ( msgSvc() , statTag ) ;
499  log << (MSG::Level) m_statPrintLevel << m_statEntities[ statTag ] << endmsg;
500 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatMap m_statEntities
stat part
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
MSG::Level m_statPrintLevel
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243

Member Data Documentation

bool ChronoStatSvc::m_chronoCoutFlag
private

flag for destination of the the final table

Definition at line 152 of file ChronoStatSvc.h.

ChronoMap ChronoStatSvc::m_chronoEntities
private

chrono part

Definition at line 145 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_chronoOrderFlag
private

flag for formattion the final statistic table

Definition at line 154 of file ChronoStatSvc.h.

MSG::Level ChronoStatSvc::m_chronoPrintLevel
private

Definition at line 148 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_chronoTableFlag
private

flag for printing the final table

Definition at line 150 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_format1
private

format for regular statistical printout rows

Definition at line 185 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_format2
private

format for "efficiency" statistical printout rows

Definition at line 187 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_header
private

the header row

Definition at line 183 of file ChronoStatSvc.h.

int ChronoStatSvc::m_intChronoPrintLevel
private

level of info printing

Definition at line 147 of file ChronoStatSvc.h.

int ChronoStatSvc::m_intStatPrintLevel
private

level of info printing

Definition at line 169 of file ChronoStatSvc.h.

long ChronoStatSvc::m_numberOfSkippedEventsForMemStat
private

Definition at line 163 of file ChronoStatSvc.h.

std::ofstream ChronoStatSvc::m_ofd
private

Definition at line 194 of file ChronoStatSvc.h.

std::string ChronoStatSvc::m_perEventFile
private

Definition at line 193 of file ChronoStatSvc.h.

TimeMap ChronoStatSvc::m_perEvtTime
private

Definition at line 192 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_printEllapsedTime
private

flag for printing Ellapsed quantities

Definition at line 160 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_printSystemTime
private

flag for printing System quantities

Definition at line 158 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_printUserTime
private

flag for printing User quantities

Definition at line 156 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_statCoutFlag
private

flag for destination of the t he final table

Definition at line 174 of file ChronoStatSvc.h.

StatMap ChronoStatSvc::m_statEntities
private

stat part

Definition at line 166 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_statOrderFlag
private

flag for formattion the final statistic table

Definition at line 176 of file ChronoStatSvc.h.

MSG::Level ChronoStatSvc::m_statPrintLevel
private

Definition at line 170 of file ChronoStatSvc.h.

StringProperty ChronoStatSvc::m_statsOutFileName
private

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

Definition at line 180 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_statTableFlag
private

flag for printing the final table

Definition at line 172 of file ChronoStatSvc.h.

bool ChronoStatSvc::m_useEffFormat
private

flag to use the special "efficiency" format

Definition at line 189 of file ChronoStatSvc.h.


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