| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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 <src/ChronoStatSvc.h>`

Inheritance diagram for ChronoStatSvc:
[legend]
Collaboration diagram for ChronoStatSvc:
[legend]

## Public Types
typedef std::map< IChronoStatSvc::ChronoTag, ChronoEntity > | ChronoMap
| some useful typedefs More...
typedef std::map< IChronoStatSvc::StatTag, StatEntity > | StatMap
Public Types inherited from extends< Service, IChronoStatSvc, IIncidentListener >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...

## Public Member Functions
StatusCode | initialize () override
| Implementation of IService::initialize() More...
StatusCode | finalize () override
| Implementation of IService::finalize() More...
virtual ChronoEntity * | chronoStart (const IChronoStatSvc::ChronoTag &chronoTag) override
| Implementation of IChronoStatSvc::chronoStart. More...
virtual const ChronoEntity * | chronoStop (const IChronoStatSvc::ChronoTag &chronoTag) override
| Implementation of IChronoStatSvc::chronoStop. More...
virtual IChronoStatSvc::ChronoTime | chronoDelta (const IChronoStatSvc::ChronoTag &chronoTag, IChronoStatSvc::ChronoType theType) override
| Implementation of IchronoStatSvc::chronoDelta. More...
virtual void | chronoPrint (const IChronoStatSvc::ChronoTag &chronoTag) override
| Implementation of IChronoStatSvc::chronoPrint. More...
virtual ChronoStatus | chronoStatus (const IChronoStatSvc::ChronoTag &chronoTag) override
| Implementation of IChronoStatSvc::chronoStatus. More...
virtual void | stat (const IChronoStatSvc::StatTag &statTag, const IChronoStatSvc::StatFlag &statFlag) override
| Implementation of IChronoStatSvc::stat add statistical information to the entity , tagged by its name. More...
virtual void | statPrint (const IChronoStatSvc::ChronoTag &statTag) override
| prints (using message service) info about statistical entity, tagged by its name More...
virtual const ChronoEntity * | chrono (const IChronoStatSvc::ChronoTag &t) const override
| extract the chrono entity for the given tag (name) More...
virtual const StatEntity * | stat (const IChronoStatSvc::StatTag &t) const override
| extract the stat entity for the given tag (name) More...
| ChronoStatSvc (const std::string &name, ISvcLocator *svcloc)
| Default constructor. More...
void | merge (const ChronoStatSvc &css)
| Compound assignment operator. More...
| ~ChronoStatSvc () override=default
| Destructor. More...
void | handle (const Incident &incident) override
Public Member Functions inherited from extends< Service, IChronoStatSvc, IIncidentListener >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| 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<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, 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 >
StatusCode | declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
| Declare used tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
const SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the cached level (originally extracted from the embedded MsgStream) More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Protected Member Functions
void | printStats ()
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level | setUpMessaging ()
| Set up local caches. More...
MSG::Level | resetMessaging ()
| Reinitialize internal states. More...
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Private Types
typedef std::map< ChronoTag, std::vector< IChronoSvc::ChronoTime > > | TimeMap

## Private Member Functions
| ChronoStatSvc ()=delete
| ChronoStatSvc (const ChronoStatSvc &)=delete
ChronoStatSvc & | operator= (const ChronoStatSvc &)=delete
void | saveStats ()
| dump the statistics into an ASCII file for offline processing More...

## Private Attributes
ChronoMap | m_chronoEntities
| chrono part More...
MSG::Level | m_chronoPrintLevel = MSG::INFO
| level of info printing More...
StatMap | m_statEntities
| stat part More...
MSG::Level | m_statPrintLevel = MSG::INFO
| level of info printing More...
Gaudi::Property< bool > | m_chronoTableFlag
Gaudi::Property< bool > | m_chronoCoutFlag
Gaudi::Property< int > | m_intChronoPrintLevel {this, "ChronoPrintLevel", MSG::INFO, "print level"}
Gaudi::Property< bool > | m_chronoOrderFlag {this, "ChronoTableToBeOrdered", true, "should the printout be ordered"}
Gaudi::Property< bool > | m_printUserTime {this, "PrintUserTime", true}
Gaudi::Property< bool > | m_printSystemTime {this, "PrintSystemTime", false}
Gaudi::Property< bool > | m_printEllapsedTime {this, "PrintEllapsedTime", false}
Gaudi::Property< bool > | m_statTableFlag
Gaudi::Property< bool > | m_statCoutFlag
Gaudi::Property< int > | m_intStatPrintLevel {this, "StatPrintLevel", MSG::INFO, "print level"}
Gaudi::Property< bool > | m_statOrderFlag {this, "StatTableToBeOrdered", true, "should the printout be ordered"}
Gaudi::Property< long > | m_numberOfSkippedEventsForMemStat
Gaudi::Property< std::string > | m_statsOutFileName
Gaudi::Property< std::string > | m_header
Gaudi::Property< std::string > | m_format1
Gaudi::Property< std::string > | m_format2
Gaudi::Property< bool > | m_useEffFormat
Gaudi::Property< std::string > | m_perEventFile {this, "PerEventFile", "", "File name for per-event deltas"}
TimeMap | m_perEvtTime
std::ofstream | m_ofd

## Additional Inherited Members
Protected Attributes inherited from Service
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::Property< int > | m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
Gaudi::Property< bool > | m_auditInit {this, "AuditServices", false, "[[deprecated]] unused"}
Gaudi::Property< bool > | m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
Gaudi::Property< bool > | m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
Gaudi::Property< bool > | m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
Gaudi::Property< bool > | m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
Gaudi::Property< bool > | m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
Gaudi::Property< bool > | m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor 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

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

some useful typedefs

Definition at line 38 of file ChronoStatSvc.h.

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

Definition at line 39 of file ChronoStatSvc.h.

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

Definition at line 183 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

Definition at line 81 of file ChronoStatSvc.cpp.

81 : base_class( name, svcloc )
82 {
83 // basically limit the integer to MSG::Level range
84 auto int2level = []( int l ) -> MSG::Level {
85 return static_cast<MSG::Level>(
86 std::max( std::min( l, static_cast<int>( MSG::FATAL ) ), static_cast<int>( MSG::NIL ) ) );
87 };
88
89 m_intStatPrintLevel.declareUpdateHandler(
90 [this, int2level]( Gaudi::Details::PropertyBase& ) { m_statPrintLevel = int2level( m_intStatPrintLevel ); } );
91 m_intChronoPrintLevel.declareUpdateHandler(
92 [this, int2level]( Gaudi::Details::PropertyBase& ) { m_chronoPrintLevel = int2level( m_intChronoPrintLevel ); } );
93 }
ChronoStatSvc::m_intStatPrintLevel
Gaudi::Property< int > m_intStatPrintLevel
Definition: ChronoStatSvc.h:156
extends< Service, IChronoStatSvc, IIncidentListener >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:15
std::min
T min(T...args)
MSG::FATAL
Definition: IMessageSvc.h:16
MSG::Level
Level
Definition: IMessageSvc.h:16
ChronoStatSvc::m_intChronoPrintLevel
Gaudi::Property< int > m_intChronoPrintLevel
Definition: ChronoStatSvc.h:147
MSG::NIL
Definition: IMessageSvc.h:16
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
std::max
T max(T...args)
ChronoStatSvc::m_chronoPrintLevel
MSG::Level m_chronoPrintLevel
level of info printing
Definition: ChronoStatSvc.h:136
gaudirun.l
dictionary l
Definition: gaudirun.py:440
ChronoStatSvc::m_statPrintLevel
MSG::Level m_statPrintLevel
level of info printing
Definition: ChronoStatSvc.h:141

ChronoStatSvc::~ChronoStatSvc | ( |  | ) |
| override default

Destructor.

ChronoStatSvc::ChronoStatSvc | ( |  | ) |
| private delete

ChronoStatSvc::ChronoStatSvc | ( | const ChronoStatSvc & |  | ) |
| private delete

## Member Function Documentation

const ChronoEntity * ChronoStatSvc::chrono | ( | const IChronoStatSvc::ChronoTag & | t | ) | const
| override 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 391 of file ChronoStatSvc.cpp.

392 {
393 auto it = m_chronoEntities.find( t );
394 return m_chronoEntities.end() != it ? &( it->second ) : nullptr;
395 }
std::map::end
T end(T...args)
std::map::find
T find(T...args)
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134

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

Implementation of IchronoStatSvc::chronoDelta.

See also
  IChronoStatSvc

Definition at line 330 of file ChronoStatSvc.cpp.

332 {
333 return m_chronoEntities[chronoTag].delta( theType );
334 }
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134

void ChronoStatSvc::chronoPrint | ( | const IChronoStatSvc::ChronoTag & | chronoTag | ) |
| override virtual

Implementation of IChronoStatSvc::chronoPrint.

See also
  IChronoStatSvc

Definition at line 338 of file ChronoStatSvc.cpp.

339 {
340 MsgStream log( msgSvc(), chronoTag );
341 if ( m_printUserTime ) {
342 log << (MSG::Level)m_chronoPrintLevel << m_chronoEntities[chronoTag].outputUserTime() << endmsg;
343 }
344 if ( m_printSystemTime ) {
345 log << (MSG::Level)m_chronoPrintLevel << m_chronoEntities[chronoTag].outputSystemTime() << endmsg;
346 }
347 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
ChronoStatSvc::m_printUserTime
Gaudi::Property< bool > m_printUserTime
Definition: ChronoStatSvc.h:149
MSG::Level
Level
Definition: IMessageSvc.h:16
CommonMessagingBase::msgSvc
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:75
ChronoStatSvc::m_chronoPrintLevel
MSG::Level m_chronoPrintLevel
level of info printing
Definition: ChronoStatSvc.h:136
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
Gaudi.Configuration.log
log
Definition: Configuration.py:13
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134
ChronoStatSvc::m_printSystemTime
Gaudi::Property< bool > m_printSystemTime
Definition: ChronoStatSvc.h:150

ChronoEntity * ChronoStatSvc::chronoStart | ( | const IChronoStatSvc::ChronoTag & | chronoTag | ) |
| override virtual

Implementation of IChronoStatSvc::chronoStart.

See also
  IChronoStatSvc

Definition at line 312 of file ChronoStatSvc.cpp.

313 {
314 ChronoEntity& entity = m_chronoEntities[chronoTag];
315 entity.start();
316 return &entity;
317 }
ChronoEntity
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
ChronoEntity::start
IChronoSvc::ChronoStatus start()
start the current chrono
Definition: ChronoEntity.cpp:47
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134

IChronoStatSvc::ChronoStatus ChronoStatSvc::chronoStatus | ( | const IChronoStatSvc::ChronoTag & | chronoTag | ) |
| override virtual

Implementation of IChronoStatSvc::chronoStatus.

See also
  IChronoStatSvc

Definition at line 351 of file ChronoStatSvc.cpp.

352 {
353 return m_chronoEntities[chronoTag].status();
354 }
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134

const ChronoEntity * ChronoStatSvc::chronoStop | ( | const IChronoStatSvc::ChronoTag & | chronoTag | ) |
| override virtual

Implementation of IChronoStatSvc::chronoStop.

See also
  IChronoStatSvc

Definition at line 321 of file ChronoStatSvc.cpp.

322 {
323 ChronoEntity& entity = m_chronoEntities[chronoTag];
324 entity.stop();
325 return &entity;
326 }
ChronoEntity
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
ChronoEntity::stop
IChronoSvc::ChronoStatus stop()
stop the chrono
Definition: ChronoEntity.cpp:65
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134

StatusCode ChronoStatSvc::finalize | ( |  | ) |
| override

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

Definition at line 144 of file ChronoStatSvc.cpp.

145 {
146 std::string local = name() + ".finalize()";
148 MsgStream main_log( msgSvc(), local );
151 chronoStop( name() );
152
153 if ( m_ofd.is_open() ) {
154 debug() << "writing per-event timing data to '" << m_perEventFile << "'" << endmsg;
155 for ( const auto& itr : m_perEvtTime ) {
156 m_ofd << itr.first.substr( 0, itr.first.length() - 8 ) << " ";
157 for ( const auto& itt : itr.second ) {
158 m_ofd << " " << (long int)( itt );
159 }
160 m_ofd << std::endl;
161 }
162
163 m_ofd.close();
164 }
165
168 if ( m_chronoTableFlag && !m_chronoEntities.empty() && ( m_printUserTime || m_printSystemTime ) ) {
170 MsgStream log( msgSvc(), "*****Chrono*****" );
171 const std::string stars( ( m_chronoCoutFlag ) ? 126 : 100, '*' );
172 if ( m_chronoCoutFlag ) {
173 std::cout << stars << std::endl;
174 std::cout << local << " The Final CPU consumption (Chrono) Table "
175 << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
176 std::cout << stars << std::endl;
177 } else {
178 log << (MSG::Level)m_chronoPrintLevel << stars << endmsg;
179 log << (MSG::Level)m_chronoPrintLevel << " The Final CPU consumption ( Chrono ) Table "
180 << ( m_chronoOrderFlag ? "(ordered)" : "(not ordered)" ) << endmsg;
181 log << (MSG::Level)m_chronoPrintLevel << stars << endmsg;
182 }
184 { // prepare container for printing
185 std::vector<std::pair<ChronoEntity*, const ChronoTag*>> tmpCont;
186 tmpCont.reserve( m_chronoEntities.size() );
187 for ( auto& it : m_chronoEntities ) {
188 tmpCont.emplace_back( &it.second, &it.first );
189 }
190 // sort it
191 if ( m_chronoOrderFlag ) std::sort( tmpCont.begin(), tmpCont.end(), CompareFirstOfPointerPair );
192 // print User Time statistics
193 if ( m_printUserTime ) {
194 for ( auto iter = tmpCont.begin(); tmpCont.end() != iter; ++iter ) {
195 //
196 ChronoEntity* entity = iter->first;
197 if ( !entity ) {
198 continue;
199 }
200 const ChronoTag* tag = iter->second;
201 if ( !tag ) {
202 continue;
203 }
204 entity->stop();
206 if ( m_chronoCoutFlag )
208 {
209 std::cout << *tag << "\t" << entity->outputUserTime() << std::endl;
210 } else
211 {
212 MsgStream( msgSvc(), *tag ) << m_chronoPrintLevel << entity->outputUserTime() << endmsg;
213 }
214 //
215 }
216 }
218 if ( m_printSystemTime ) {
221 if ( m_printUserTime && m_chronoCoutFlag ) {
222 std::cout << stars << std::endl;
223 } else if ( m_printUserTime && !m_chronoCoutFlag ) {
224 log << (MSG::Level)m_chronoPrintLevel << stars << endmsg;
225 }
227 for ( auto iter = tmpCont.begin(); tmpCont.end() != iter; ++iter ) {
229 ChronoEntity* entity = iter->first;
230 if ( !entity ) {
231 continue;
232 }
233 const ChronoTag* tag = iter->second;
234 if ( !tag ) {
235 continue;
236 }
237 entity->stop();
239 if ( m_chronoCoutFlag )
241 {
242 std::cout << *tag << "\t" << entity->outputSystemTime() << std::endl;
243 } else
244 {
245 MsgStream( msgSvc(), *tag ) << m_chronoPrintLevel << entity->outputSystemTime() << endmsg;
246 }
247 //
248 }
249 }
251 if ( m_printEllapsedTime ) {
254 if ( ( m_printUserTime || m_printSystemTime ) && m_chronoCoutFlag ) {
255 std::cout << stars << std::endl;
256 } else if ( ( m_printUserTime || m_printSystemTime ) && !m_chronoCoutFlag ) {
257 log << (MSG::Level)m_chronoPrintLevel << stars << endmsg;
258 }
260 for ( const auto& i : tmpCont ) {
262 ChronoEntity* entity = i.first;
263 if ( !entity ) {
264 continue;
265 }
266 const ChronoTag* tag = i.second;
267 if ( !tag ) {
268 continue;
269 }
270 entity->stop();
272 if ( m_chronoCoutFlag )
274 {
275 std::cout << *tag << "\t" << entity->outputElapsedTime() << std::endl;
276 } else
277 {
278 MsgStream( msgSvc(), *tag ) << m_chronoPrintLevel << entity->outputElapsedTime() << endmsg;
279 }
280 //
281 }
282 }
284 tmpCont.clear();
285 }
287 if ( m_chronoCoutFlag ) {
288 std::cout << stars << std::endl;
289 } else {
290 log << m_chronoPrintLevel << stars << endmsg;
291 }
292 }
293
295
297 if ( m_statTableFlag ) {
298 printStats();
299 }
300
301 if ( !m_statsOutFileName.value().empty() ) {
302 saveStats();
303 }
304
305 main_log << MSG::INFO << " Service finalized successfully " << endmsg;
306
307 return Service::finalize();
308 }
ChronoEntity::outputElapsedTime
std::string outputElapsedTime() const
print the chrono ;
Definition: ChronoEntity.cpp:104
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::map::empty
T empty(T...args)
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:174
ChronoEntity
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
std::endl
T endl(T...args)
ChronoStatSvc::m_chronoOrderFlag
Gaudi::Property< bool > m_chronoOrderFlag
Definition: ChronoStatSvc.h:148
ChronoStatSvc::m_printUserTime
Gaudi::Property< bool > m_printUserTime
Definition: ChronoStatSvc.h:149
std::vector::end
T end(T...args)
ChronoEntity::outputSystemTime
std::string outputSystemTime() const
print the chrono ;
Definition: ChronoEntity.cpp:97
std::string
STL class.
ChronoStatSvc::printStats
void printStats()
Definition: ChronoStatSvc.cpp:480
MSG::Level
Level
Definition: IMessageSvc.h:16
ChronoStatSvc::saveStats
void saveStats()
dump the statistics into an ASCII file for offline processing
Definition: ChronoStatSvc.cpp:411
CompareFirstOfPointerPair
constexpr struct CompareFirstOfPointerPair_t CompareFirstOfPointerPair
MsgStream::clear
void clear(STATE_TYPE _i=std::ios_base::failbit)
Definition: MsgStream.h:187
ChronoStatSvc::m_perEvtTime
TimeMap m_perEvtTime
Definition: ChronoStatSvc.h:184
std::ofstream::close
T close(T...args)
ChronoStatSvc::chronoStop
virtual const ChronoEntity * chronoStop(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStop.
Definition: ChronoStatSvc.cpp:321
ChronoStatSvc::m_chronoTableFlag
Gaudi::Property< bool > m_chronoTableFlag
Definition: ChronoStatSvc.h:143
CommonMessagingBase::msgSvc
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:75
ChronoStatSvc::m_ofd
std::ofstream m_ofd
Definition: ChronoStatSvc.h:185
ChronoStatSvc::m_chronoPrintLevel
MSG::Level m_chronoPrintLevel
level of info printing
Definition: ChronoStatSvc.h:136
ChronoStatSvc::m_printEllapsedTime
Gaudi::Property< bool > m_printEllapsedTime
Definition: ChronoStatSvc.h:151
ChronoEntity::outputUserTime
std::string outputUserTime() const
print the chrono ;
Definition: ChronoEntity.cpp:89
std::map::size
T size(T...args)
std::vector
STL class.
CommonMessagingBase::debug
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Definition: CommonMessaging.h:115
std::vector::begin
T begin(T...args)
ChronoStatSvc::m_statTableFlag
Gaudi::Property< bool > m_statTableFlag
Definition: ChronoStatSvc.h:152
ChronoStatSvc::m_statsOutFileName
Gaudi::Property< std::string > m_statsOutFileName
Definition: ChronoStatSvc.h:163
ChronoStatSvc::m_chronoCoutFlag
Gaudi::Property< bool > m_chronoCoutFlag
Definition: ChronoStatSvc.h:145
std::sort
T sort(T...args)
std::ofstream::is_open
T is_open(T...args)
MSG::INFO
Definition: IMessageSvc.h:16
ChronoEntity::stop
IChronoSvc::ChronoStatus stop()
stop the chrono
Definition: ChronoEntity.cpp:65
std::cout
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
std::vector::reserve
T reserve(T...args)
Gaudi.Configuration.log
log
Definition: Configuration.py:13
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134
std::vector::emplace_back
T emplace_back(T...args)
ChronoStatSvc::m_printSystemTime
Gaudi::Property< bool > m_printSystemTime
Definition: ChronoStatSvc.h:150
ChronoStatSvc::m_perEventFile
Gaudi::Property< std::string > m_perEventFile
Definition: ChronoStatSvc.h:181

void ChronoStatSvc::handle | ( | const Incident & | incident | ) |
| override

Definition at line 549 of file ChronoStatSvc.cpp.

550 {
551
552 if ( !m_ofd.is_open() ) return;
553
554 for ( const auto& itr : m_chronoEntities ) {
555 if ( itr.first.find( ":Execute" ) == std::string::npos ) continue;
556
557 auto itm = m_perEvtTime.find( itr.first );
558 if ( itm == m_perEvtTime.end() ) {
559 m_perEvtTime[itr.first] = {itr.second.delta( IChronoSvc::ELAPSED )};
560 } else {
561 itm->second.push_back( itr.second.delta( IChronoSvc::ELAPSED ) );
562 }
563 }
564 }
std::map::end
T end(T...args)
ChronoStatSvc::m_perEvtTime
TimeMap m_perEvtTime
Definition: ChronoStatSvc.h:184
ChronoStatSvc::m_ofd
std::ofstream m_ofd
Definition: ChronoStatSvc.h:185
IChronoSvc::ELAPSED
Definition: IChronoSvc.h:48
std::map::find
T find(T...args)
std::ofstream::is_open
T is_open(T...args)
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134

StatusCode ChronoStatSvc::initialize | ( |  | ) |
| override

Implementation of IService::initialize()

start its own chrono

Definition at line 97 of file ChronoStatSvc.cpp.

98 {
99 StatusCode sc = Service::initialize();
100 if ( sc.isFailure() ) return sc;
102 // Set my own properties
103 sc = setProperties();
104
105 if ( sc.isFailure() ) {
106 error() << "setting my properties" << endmsg;
107 return StatusCode::FAILURE;
108 }
109
110 // only add an EndEvent listener if per-event output requested
111 if ( !m_perEventFile.empty() ) {
112 m_ofd.open( m_perEventFile );
113 if ( !m_ofd.is_open() ) {
114 error() << "unable to open per-event output file \"" << m_perEventFile << "\"" << endmsg;
115 return StatusCode::FAILURE;
116 } else {
117 auto ii = serviceLocator()->service<IIncidentSvc>( "IncidentSvc" );
118 if ( !ii ) {
119 error() << "Unable to find IncidentSvc" << endmsg;
120 return StatusCode::FAILURE;
121 }
122 ii->addListener( this, IncidentType::EndEvent );
123 }
124 }
125
126 info() << " Number of skipped events for MemStat" << m_numberOfSkippedEventsForMemStat.value() << endmsg;
127
128 if ( m_chronoTableFlag && !m_printUserTime && !m_printSystemTime && !m_printEllapsedTime ) {
129 m_printUserTime = true;
130 }
132 if ( m_printUserTime || m_printSystemTime || m_printEllapsedTime ) {
133 m_chronoTableFlag = true;
134 }
137 chronoStart( name() );
139 return StatusCode::SUCCESS;
140 }
StatusCode::SUCCESS
Definition: StatusCode.h:29
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
std::ofstream::open
T open(T...args)
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:112
ChronoStatSvc::m_numberOfSkippedEventsForMemStat
Gaudi::Property< long > m_numberOfSkippedEventsForMemStat
Definition: ChronoStatSvc.h:159
ChronoStatSvc::m_printUserTime
Gaudi::Property< bool > m_printUserTime
Definition: ChronoStatSvc.h:149
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
ISvcLocator::service
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:106
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
ChronoStatSvc::m_chronoTableFlag
Gaudi::Property< bool > m_chronoTableFlag
Definition: ChronoStatSvc.h:143
ChronoStatSvc::m_ofd
std::ofstream m_ofd
Definition: ChronoStatSvc.h:185
Service::setProperties
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
Definition: Service.cpp:295
ChronoStatSvc::m_printEllapsedTime
Gaudi::Property< bool > m_printEllapsedTime
Definition: ChronoStatSvc.h:151
ChronoStatSvc::chronoStart
virtual ChronoEntity * chronoStart(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStart.
Definition: ChronoStatSvc.cpp:312
StatusCode::FAILURE
Definition: StatusCode.h:29
std::ofstream::is_open
T is_open(T...args)
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
IIncidentSvc
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:23
ChronoStatSvc::m_printSystemTime
Gaudi::Property< bool > m_printSystemTime
Definition: ChronoStatSvc.h:150
ChronoStatSvc::m_perEventFile
Gaudi::Property< std::string > m_perEventFile
Definition: ChronoStatSvc.h:181

void ChronoStatSvc::merge | ( | const ChronoStatSvc & | css | ) |

Compound assignment operator.

Definition at line 56 of file ChronoStatSvc.cpp.

57 {
58
59 // Add the content of the maps, leave the rest unchanged
60
61 // Merge Chronomaps
62 for ( auto& item : css.m_chronoEntities ) {
63 const IChronoStatSvc::ChronoTag& key = item.first;
64 const ChronoEntity& val = item.second;
65 if ( m_chronoEntities.count( key ) )
66 m_chronoEntities[key] += val;
67 else
68 m_chronoEntities.insert( std::pair<IChronoStatSvc::ChronoTag, ChronoEntity>( key, val ) );
69 }
70
71 // Merge StatMaps
72 for ( auto& item : css.m_statEntities ) {
73 const IChronoStatSvc::StatTag& key = item.first;
74 const StatEntity& val = item.second;
75 if ( m_statEntities.count( key ) )
76 m_statEntities[key] += val;
77 else
78 m_statEntities.insert( std::pair<IChronoStatSvc::StatTag, StatEntity>( key, val ) );
79 }
80 }
ChronoStatSvc::m_statEntities
StatMap m_statEntities
stat part
Definition: ChronoStatSvc.h:139
ChronoEntity
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
std::map::count
T count(T...args)
std::pair
std::map::insert
T insert(T...args)
StatEntity
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:65
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134

ChronoStatSvc& ChronoStatSvc::operator= | ( | const ChronoStatSvc & |  | ) |
| private delete

void ChronoStatSvc::printStats | ( |  | ) |
| protected

nothing to print?

CONTINUE

CONTINUE

decoration

Definition at line 480 of file ChronoStatSvc.cpp.

481 {
483 if ( m_statEntities.empty() ) {
484 return;
485 }
486
487 MsgStream log( msgSvc(), "******Stat******" );
489 const std::string stars( ( m_statCoutFlag ) ? 126 : 100, '*' );
491 if ( m_statCoutFlag ) {
492 std::cout << stars << std::endl;
493 std::cout << " The Final stat Table " << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" ) << std::endl;
494 std::cout << stars << std::endl;
495 } else {
496 log << m_statPrintLevel << stars << endmsg;
497 log << m_statPrintLevel << " The Final stat Table " << ( m_statOrderFlag ? "(ordered)" : "(not ordered)" )
498 << endmsg;
499 log << m_statPrintLevel << stars << endmsg;
500 }
501
502 {
503 // prepare container for printing
504 typedef std::pair<const StatEntity*, const StatTag*> SPair;
505 typedef std::vector<SPair> SCont;
506 SCont tmpCont;
507 std::transform( std::begin( m_statEntities ), std::end( m_statEntities ), std::back_inserter( tmpCont ),
508 []( StatMap::const_reference i ) { return std::make_pair( &i.second, &i.first ); } );
509 // sort it
510 if ( m_statOrderFlag ) std::sort( tmpCont.begin(), tmpCont.end(), CompareFirstOfPointerPair );
511 // print the table header
512 if ( m_statCoutFlag ) {
513 std::cout << m_header.value() << std::endl;
514 } else {
515 log << m_statPrintLevel << m_header.value() << endmsg;
516 }
517
518 // loop over counters and print them:
519 for ( const auto& iter : tmpCont ) {
521 const StatEntity* entity = iter.first;
522 if ( !entity ) {
523 continue;
524 }
525 const StatTag* tag = iter.second;
526 if ( !tag ) {
527 continue;
528 }
529 if ( m_statCoutFlag ) {
531 std::cout << Gaudi::Utils::formatAsTableRow( *tag, *entity, m_useEffFormat, m_format1, m_format2 ) << std::endl;
532 } else {
533 log << m_statPrintLevel << Gaudi::Utils::formatAsTableRow( *tag, *entity, m_useEffFormat, m_format1, m_format2 )
534 << endmsg;
535 }
536 }
537 tmpCont.clear();
538 }
540 if ( m_statCoutFlag ) {
541 std::cout << stars << std::endl;
542 } else {
543 log << m_statPrintLevel << stars << endmsg;
544 }
545 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
std::map::empty
T empty(T...args)
ChronoStatSvc::m_header
Gaudi::Property< std::string > m_header
Definition: ChronoStatSvc.h:167
ChronoStatSvc::m_statEntities
StatMap m_statEntities
stat part
Definition: ChronoStatSvc.h:139
ChronoStatSvc::m_statCoutFlag
Gaudi::Property< bool > m_statCoutFlag
Definition: ChronoStatSvc.h:154
std::endl
T endl(T...args)
std::end
T end(T...args)
Gaudi::Utils::formatAsTableRow
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:305
std::string
STL class.
ChronoStatSvc::m_useEffFormat
Gaudi::Property< bool > m_useEffFormat
Definition: ChronoStatSvc.h:178
CompareFirstOfPointerPair
constexpr struct CompareFirstOfPointerPair_t CompareFirstOfPointerPair
MsgStream::clear
void clear(STATE_TYPE _i=std::ios_base::failbit)
Definition: MsgStream.h:187
ChronoStatSvc::m_format2
Gaudi::Property< std::string > m_format2
Definition: ChronoStatSvc.h:174
ChronoStatSvc::m_statOrderFlag
Gaudi::Property< bool > m_statOrderFlag
Definition: ChronoStatSvc.h:157
std::make_pair
T make_pair(T...args)
CommonMessagingBase::msgSvc
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:75
ChronoStatSvc::m_format1
Gaudi::Property< std::string > m_format1
Definition: ChronoStatSvc.h:171
std::pair
std::vector
STL class.
std::begin
T begin(T...args)
std::back_inserter
T back_inserter(T...args)
ChronoStatSvc::m_statPrintLevel
MSG::Level m_statPrintLevel
level of info printing
Definition: ChronoStatSvc.h:141
std::sort
T sort(T...args)
std::transform
T transform(T...args)
StatEntity
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:65
std::cout
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
Gaudi.Configuration.log
log
Definition: Configuration.py:13

void ChronoStatSvc::saveStats | ( |  | ) |
| private

dump the statistics into an ASCII file for offline processing

CONTINUE

CONTINUE

Definition at line 411 of file ChronoStatSvc.cpp.

412 {
413 std::ofstream out( m_statsOutFileName.value(), std::ios_base::out | std::ios_base::trunc );
414 if ( !out.good() ) {
415 info() << "Could not open the output file for writing chrono statistics [" << m_statsOutFileName.value() << "]"
416 << endmsg;
417 return;
418 } else {
419 // format it our way
420 out << std::scientific << std::setprecision( 8 );
421 }
422
423 // ChronoEntity
424 std::vector<std::pair<const ChronoEntity*, const ChronoTag*>> chronos;
425 chronos.reserve( m_chronoEntities.size() );
426 std::transform( std::begin( m_chronoEntities ), std::end( m_chronoEntities ), std::back_inserter( chronos ),
427 []( ChronoMap::const_reference i ) { return std::make_pair( &i.second, &i.first ); } );
428
429 // sort it
430 std::sort( std::begin( chronos ), std::end( chronos ), CompareFirstOfPointerPair );
431
432 // print User Time statistics
433 for ( const auto& iter : chronos ) {
434 //
435 const ChronoEntity* entity = iter.first;
436 if ( !entity ) {
437 continue;
438 }
439
440 const ChronoTag* tag = iter.second;
441 if ( !tag ) {
442 continue;
443 }
444
445 // create an entry in the .INI-like table
446 out << "\n[" << *tag << "]\n";
447
448 // user
449 out << "cpu_user_total = " << entity->uTotalTime() << "\n";
450 out << "cpu_user_min = " << entity->uMinimalTime() << "\n";
451 out << "cpu_user_mean = " << entity->uMeanTime() << "\n";
452 out << "cpu_user_RMS = " << entity->uRMSTime() << "\n";
453 out << "cpu_user_max = " << entity->uMaximalTime() << "\n";
454 out << "cpu_user_nbr = " << entity->nOfMeasurements() << "\n";
455
456 // system
457 out << "\n"; // just for clarity
458 out << "cpu_system_total = " << entity->kTotalTime() << "\n";
459 out << "cpu_system_min = " << entity->kMinimalTime() << "\n";
460 out << "cpu_system_mean = " << entity->kMeanTime() << "\n";
461 out << "cpu_system_RMS = " << entity->kRMSTime() << "\n";
462 out << "cpu_system_max = " << entity->kMaximalTime() << "\n";
463 out << "cpu_system_nbr = " << entity->nOfMeasurements() << "\n";
464
465 // real
466 out << "\n"; // just for clarity
467 out << "cpu_real_total = " << entity->eTotalTime() << "\n";
468 out << "cpu_real_min = " << entity->eMinimalTime() << "\n";
469 out << "cpu_real_mean = " << entity->eMeanTime() << "\n";
470 out << "cpu_real_RMS = " << entity->eRMSTime() << "\n";
471 out << "cpu_real_max = " << entity->eMaximalTime() << "\n";
472 out << "cpu_real_nbr = " << entity->nOfMeasurements() << "\n";
473 }
474
475 out << std::endl;
476 }
ChronoEntity::kMaximalTime
double kMaximalTime() const
maximal measurement for kernel time
Definition: ChronoEntity.h:199
ChronoEntity::uMinimalTime
double uMinimalTime() const
minimal measurement for user time
Definition: ChronoEntity.h:183
ChronoEntity::uTotalTime
double uTotalTime() const
total user time
Definition: ChronoEntity.h:207
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:112
ChronoEntity
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
Definition: ChronoEntity.h:21
ChronoEntity::kTotalTime
double kTotalTime() const
total Kernel time
Definition: ChronoEntity.h:211
std::endl
T endl(T...args)
ChronoEntity::uRMSTime
double uRMSTime() const
r.m.s User Time
Definition: ChronoEntity.h:239
std::end
T end(T...args)
ChronoEntity::kMinimalTime
double kMinimalTime() const
minimal measurement for kernel time
Definition: ChronoEntity.h:187
ChronoEntity::eMinimalTime
double eMinimalTime() const
minimal measurement for elapsed time
Definition: ChronoEntity.h:191
ChronoEntity::kRMSTime
double kRMSTime() const
r.m.s Kernel Time
Definition: ChronoEntity.h:235
ChronoEntity::kMeanTime
double kMeanTime() const
average Kernel Time
Definition: ChronoEntity.h:223
std::ofstream
STL class.
ChronoEntity::eMeanTime
double eMeanTime() const
average Elapsed Time
Definition: ChronoEntity.h:231
CompareFirstOfPointerPair
constexpr struct CompareFirstOfPointerPair_t CompareFirstOfPointerPair
std::make_pair
T make_pair(T...args)
ChronoEntity::eRMSTime
double eRMSTime() const
r.m.s Elapsed Time
Definition: ChronoEntity.h:243
std::scientific
T scientific(T...args)
ChronoEntity::uMeanTime
double uMeanTime() const
average User Time
Definition: ChronoEntity.h:227
std::map::size
T size(T...args)
std::vector
STL class.
std::begin
T begin(T...args)
std::back_inserter
T back_inserter(T...args)
ChronoEntity::eMaximalTime
double eMaximalTime() const
maximal measurement for elapsed time
Definition: ChronoEntity.h:203
ChronoEntity::nOfMeasurements
unsigned long nOfMeasurements() const
number of chrono measurements
Definition: ChronoEntity.h:179
ChronoStatSvc::m_statsOutFileName
Gaudi::Property< std::string > m_statsOutFileName
Definition: ChronoStatSvc.h:163
std::sort
T sort(T...args)
std::transform
T transform(T...args)
ChronoEntity::uMaximalTime
double uMaximalTime() const
maximal measurement for user time
Definition: ChronoEntity.h:195
std::setprecision
T setprecision(T...args)
ChronoEntity::eTotalTime
double eTotalTime() const
total Elapsed time
Definition: ChronoEntity.h:215
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
std::vector::reserve
T reserve(T...args)
ChronoStatSvc::m_chronoEntities
ChronoMap m_chronoEntities
chrono part
Definition: ChronoStatSvc.h:134

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

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

See also
  IChronoStatSvc

Definition at line 358 of file ChronoStatSvc.cpp.

359 {
360 auto theIter = m_statEntities.find( statTag );
361
362 StatEntity* theStat = nullptr;
363 // if new entity, specify the number of events to be skipped
364 if ( theIter == m_statEntities.end() ) {
365 // new stat entity
366 StatEntity& theSe = m_statEntities[statTag];
367 theStat = &theSe;
368 theStat->setnEntriesBeforeReset( m_numberOfSkippedEventsForMemStat );
369 } else {
370 // existing stat entity
371 theStat = &theIter->second;
372 }
373
374 theStat->addFlag( statFlag );
375 }
ChronoStatSvc::m_statEntities
StatMap m_statEntities
stat part
Definition: ChronoStatSvc.h:139
ChronoStatSvc::m_numberOfSkippedEventsForMemStat
Gaudi::Property< long > m_numberOfSkippedEventsForMemStat
Definition: ChronoStatSvc.h:159
std::map::end
T end(T...args)
StatEntity::setnEntriesBeforeReset
void setnEntriesBeforeReset(unsigned long nEntriesBeforeReset)
DR specify number of entry before reset.
Definition: StatEntity.cpp:215
StatEntity::addFlag
unsigned long addFlag(const double Flag)
add a flag
Definition: StatEntity.h:413
std::map::find
T find(T...args)
StatEntity
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:65

const StatEntity * ChronoStatSvc::stat | ( | const IChronoStatSvc::StatTag & | t | ) | const
| override 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 403 of file ChronoStatSvc.cpp.

404 {
405 auto it = m_statEntities.find( t );
406 return m_statEntities.end() != it ? &( it->second ) : nullptr;
407 }
ChronoStatSvc::m_statEntities
StatMap m_statEntities
stat part
Definition: ChronoStatSvc.h:139
std::map::end
T end(T...args)
std::map::find
T find(T...args)

void ChronoStatSvc::statPrint | ( | const IChronoStatSvc::ChronoTag & | statTag | ) |
| override virtual

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

See also
  IChronoStatSvc

Definition at line 379 of file ChronoStatSvc.cpp.

380 {
381 MsgStream log( msgSvc(), statTag );
382 log << (MSG::Level)m_statPrintLevel << m_statEntities[statTag] << endmsg;
383 }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
ChronoStatSvc::m_statEntities
StatMap m_statEntities
stat part
Definition: ChronoStatSvc.h:139
MSG::Level
Level
Definition: IMessageSvc.h:16
CommonMessagingBase::msgSvc
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:75
ChronoStatSvc::m_statPrintLevel
MSG::Level m_statPrintLevel
level of info printing
Definition: ChronoStatSvc.h:141
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
Gaudi.Configuration.log
log
Definition: Configuration.py:13

## Member Data Documentation

Gaudi::Property<bool> ChronoStatSvc::m_chronoCoutFlag
| private

Initial value:
{this, "ChronoDestinationCout", false,
"define the destination of the table to be printed"}

Definition at line 145 of file ChronoStatSvc.h.

ChronoMap ChronoStatSvc::m_chronoEntities
| private

chrono part

Definition at line 134 of file ChronoStatSvc.h.

Gaudi::Property<bool> ChronoStatSvc::m_chronoOrderFlag {this, "ChronoTableToBeOrdered", true, "should the printout be ordered"}
| private

Definition at line 148 of file ChronoStatSvc.h.

MSG::Level ChronoStatSvc::m_chronoPrintLevel = MSG::INFO
| private

level of info printing

Definition at line 136 of file ChronoStatSvc.h.

Gaudi::Property<bool> ChronoStatSvc::m_chronoTableFlag
| private

Initial value:
{this, "ChronoPrintOutTable", true,
"decide if the final printout should be performed"}

Definition at line 143 of file ChronoStatSvc.h.

Gaudi::Property<std::string> ChronoStatSvc::m_format1
| private

Initial value:
{
this, "RegularRowFormat", " %|-15.15s|%|17t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |",
"The format for the regular row in the output Stat-table"}

Definition at line 171 of file ChronoStatSvc.h.

Gaudi::Property<std::string> ChronoStatSvc::m_format2
| private

Initial value:
{
this, "EfficiencyRowFormat",
"*%|-15.15s|%|17t||%|10d| |%|11.5g| |(%|#9.7g| +- %|-#9.7g|)%%| ------- | ------- |",
"The format for the regular row in the output Stat-table"}

Definition at line 174 of file ChronoStatSvc.h.

Gaudi::Property<std::string> ChronoStatSvc::m_header
| private

Initial value:
{
this, "StatTableHeader",
" Counter | # | sum | mean/eff^* | rms/err^* | min | max |",
"The header row for the output Stat-table"}

Definition at line 167 of file ChronoStatSvc.h.

Gaudi::Property<int> ChronoStatSvc::m_intChronoPrintLevel {this, "ChronoPrintLevel", MSG::INFO, "print level"}
| private

Definition at line 147 of file ChronoStatSvc.h.

Gaudi::Property<int> ChronoStatSvc::m_intStatPrintLevel {this, "StatPrintLevel", MSG::INFO, "print level"}
| private

Definition at line 156 of file ChronoStatSvc.h.

Gaudi::Property<long> ChronoStatSvc::m_numberOfSkippedEventsForMemStat
| private

Initial value:
{
this, "NumberOfSkippedEventsForMemStat", -1,
"specify the number of events to be skipped by the memory auditor in order to better spot memory leak"}

Definition at line 159 of file ChronoStatSvc.h.

std::ofstream ChronoStatSvc::m_ofd
| private

Definition at line 185 of file ChronoStatSvc.h.

Gaudi::Property<std::string> ChronoStatSvc::m_perEventFile {this, "PerEventFile", "", "File name for per-event deltas"}
| private

Definition at line 181 of file ChronoStatSvc.h.

TimeMap ChronoStatSvc::m_perEvtTime
| private

Definition at line 184 of file ChronoStatSvc.h.

Gaudi::Property<bool> ChronoStatSvc::m_printEllapsedTime {this, "PrintEllapsedTime", false}
| private

Definition at line 151 of file ChronoStatSvc.h.

Gaudi::Property<bool> ChronoStatSvc::m_printSystemTime {this, "PrintSystemTime", false}
| private

Definition at line 150 of file ChronoStatSvc.h.

Gaudi::Property<bool> ChronoStatSvc::m_printUserTime {this, "PrintUserTime", true}
| private

Definition at line 149 of file ChronoStatSvc.h.

Gaudi::Property<bool> ChronoStatSvc::m_statCoutFlag
| private

Initial value:
{this, "StatDestinationCout", false,
"define the destination of the table to be printed"}

Definition at line 154 of file ChronoStatSvc.h.

StatMap ChronoStatSvc::m_statEntities
| private

stat part

Definition at line 139 of file ChronoStatSvc.h.

Gaudi::Property<bool> ChronoStatSvc::m_statOrderFlag {this, "StatTableToBeOrdered", true, "should the printout be ordered"}
| private

Definition at line 157 of file ChronoStatSvc.h.

MSG::Level ChronoStatSvc::m_statPrintLevel = MSG::INFO
| private

level of info printing

Definition at line 141 of file ChronoStatSvc.h.

Gaudi::Property<std::string> ChronoStatSvc::m_statsOutFileName
| private

Initial value:
{
this, "AsciiStatsOutputFile", "",
"Name of the output file storing the stats. If empty, no statistics will be saved (default)"}

Definition at line 163 of file ChronoStatSvc.h.

Gaudi::Property<bool> ChronoStatSvc::m_statTableFlag
| private

Initial value:
{this, "StatPrintOutTable", true,
"decide if the final printout should be performed"}

Definition at line 152 of file ChronoStatSvc.h.

Gaudi::Property<bool> ChronoStatSvc::m_useEffFormat
| private

Initial value:
{this, "UseEfficiencyRowFormat", true,
"Use the special format for printout of efficiency counters"}

Definition at line 178 of file ChronoStatSvc.h.

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

- GaudiCommonSvc/src/ChronoStatSvc.h
- GaudiCommonSvc/src/ChronoStatSvc.cpp