2 # pragma warning( disable : 4786 ) 46 template <
typename S,
typename T>
65 const IChronoStatSvc::ChronoTag& key = item.first;
75 const IChronoStatSvc::StatTag& key = item.first;
76 const StatEntity& val = item.second;
110 ii->addListener(
this, IncidentType::EndEvent );
137 m_ofd << itr.first.substr( 0, itr.first.length() - 8 ) <<
" ";
138 for (
const auto& itt : itr.second ) {
m_ofd <<
" " << (
long int)( itt ); }
154 std::cout << local <<
" The Final CPU consumption (Chrono) Table " 173 for (
auto iter = tmpCont.
begin(); tmpCont.
end() != iter; ++iter ) {
176 if ( !entity ) {
continue; }
177 const ChronoTag* tag = iter->second;
178 if ( !tag ) {
continue; }
202 for (
auto iter = tmpCont.
begin(); tmpCont.
end() != iter; ++iter ) {
205 if ( !entity ) {
continue; }
206 const ChronoTag* tag = iter->second;
207 if ( !tag ) {
continue; }
231 for (
const auto& i : tmpCont ) {
234 if ( !entity ) {
continue; }
235 const ChronoTag* tag = i.second;
236 if ( !tag ) {
continue; }
297 IChronoStatSvc::ChronoType theType ) {
317 void ChronoStatSvc::stat(
const IChronoStatSvc::StatTag& statTag,
const IChronoStatSvc::StatFlag& statFlag ) {
320 StatEntity* theStat =
nullptr;
328 theStat = &theIter->second;
331 theStat->addFlag( statFlag );
369 info() <<
"Could not open the output file for writing chrono statistics [" <<
m_statsOutFileName.value() <<
"]" 383 []( ChronoMap::const_reference i ) {
return std::make_pair( &i.second, &i.first ); } );
390 for (
const auto& iter : chronos ) {
393 if ( !entity ) {
continue; }
395 const ChronoTag* tag = iter.second;
396 if ( !tag ) {
continue; }
399 out <<
"\n[" << *tag <<
"]\n";
402 out <<
"cpu_user_total = " << entity->
uTotalTime() <<
"\n";
403 out <<
"cpu_user_min = " << entity->
uMinimalTime() <<
"\n";
404 out <<
"cpu_user_mean = " << entity->
uMeanTime() <<
"\n";
405 out <<
"cpu_user_RMS = " << entity->
uRMSTime() <<
"\n";
406 out <<
"cpu_user_max = " << entity->
uMaximalTime() <<
"\n";
411 out <<
"cpu_system_total = " << entity->
kTotalTime() <<
"\n";
412 out <<
"cpu_system_min = " << entity->
kMinimalTime() <<
"\n";
413 out <<
"cpu_system_mean = " << entity->
kMeanTime() <<
"\n";
414 out <<
"cpu_system_RMS = " << entity->
kRMSTime() <<
"\n";
415 out <<
"cpu_system_max = " << entity->
kMaximalTime() <<
"\n";
420 out <<
"cpu_real_total = " << entity->
eTotalTime() <<
"\n";
421 out <<
"cpu_real_min = " << entity->
eMinimalTime() <<
"\n";
422 out <<
"cpu_real_mean = " << entity->
eMeanTime() <<
"\n";
423 out <<
"cpu_real_RMS = " << entity->
eRMSTime() <<
"\n";
424 out <<
"cpu_real_max = " << entity->
eMaximalTime() <<
"\n";
436 error() <<
"Cannot retrieve HiveWhiteBoardSvc";
440 if ( wb && wb->getNumberOfStores() > 1 ) {
isMT =
true; }
474 []( StatMap::const_reference i ) {
return std::make_pair( &i.second, &i.first ); } );
485 for (
const auto& iter : tmpCont ) {
487 const StatEntity* entity = iter.first;
488 if ( !entity ) {
continue; }
489 const StatTag* tag = iter.second;
490 if ( !tag ) {
continue; }
496 entity->print( ost,
true, *tag,
m_useEffFormat,
"%|-15.15s|%|17t|" );
518 if ( itr.first.find(
":Execute" ) == std::string::npos )
continue;
ChronoEntity & getEntity(const ChronoTag &chronoTag)
Definition of the MsgStream class used to transmit messages.
StatusCode initialize() override
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
double eRMSTime() const
r.m.s Elapsed Time
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
ChronoStatus chronoStatus(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStatus.
Gaudi::Property< std::string > m_header
StatusCode finalize() override
StatMap m_statEntities
stat part
a small helper class for implementation of ChronoStatSvc service, It also could be used as some local...
IChronoSvc::ChronoTime delta(IChronoSvc::ChronoType type) const
return the last delta-time of type "type"
Gaudi::Property< bool > m_statCoutFlag
IChronoStatSvc::ChronoTime chronoDelta(const IChronoStatSvc::ChronoTag &chronoTag, IChronoStatSvc::ChronoType theType) override
Implementation of IchronoStatSvc::chronoDelta.
Gaudi::Property< bool > m_chronoOrderFlag
constexpr static const auto SUCCESS
Gaudi::Property< bool > m_printUserTime
std::mutex m_mutex
Mutex protecting m_chronoEntities.
void stat(const IChronoStatSvc::StatTag &statTag, const IChronoStatSvc::StatFlag &statFlag) override
Implementation of IChronoStatSvc::stat add statistical information to the entity ,...
double uMinimalTime() const
minimal measurement for user time
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
void statPrint(const IChronoStatSvc::ChronoTag &statTag) override
prints (using message service) info about statistical entity, tagged by its name
IChronoSvc::ChronoStatus start()
start the current chrono
#define DECLARE_COMPONENT(type)
double kRMSTime() const
r.m.s Kernel Time
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
const std::string & name() const override
Retrieve name of the service.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
double eMaximalTime() const
maximal measurement for elapsed time
void merge(const ChronoStatSvc &css)
Compound assignment operator.
double uTotalTime() const
total user time
Gaudi::Property< bool > m_useEffFormat
void saveStats()
dump the statistics into an ASCII file for offline processing
constexpr struct CompareFirstOfPointerPair_t CompareFirstOfPointerPair
This class is used for returning status codes from appropriate routines.
unsigned long nOfMeasurements() const
number of chrono measurements
double eMinimalTime() const
minimal measurement for elapsed time
void clear(STATE_TYPE _i=std::ios_base::failbit)
const ChronoEntity * chronoStop(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStop.
StatusCode retrieve() const
Retrieve the Service.
double uMeanTime() const
average User Time
Gaudi::Property< bool > m_statOrderFlag
double kMeanTime() const
average Kernel Time
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
Gaudi::Property< bool > m_chronoTableFlag
double eTotalTime() const
total Elapsed time
ServiceHandle< IInterface > m_hiveWhiteBoardSvc
StatusCode setProperties()
Method for setting declared properties to the values specified for the job.
MSG::Level m_chronoPrintLevel
level of info printing
StatusCode initialize() override
Implementation of IService::initialize()
Gaudi::Property< bool > m_printEllapsedTime
T * get() const
Release the Service.
HepRndm::Engine< TripleRand > e2
double kTotalTime() const
total Kernel time
void handle(const Incident &incident) override
T back_inserter(T... args)
Gaudi::Property< bool > m_statTableFlag
Base class for all Incidents (computing events).
ChronoEntity * chronoStart(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStart.
double uMaximalTime() const
maximal measurement for user time
double kMinimalTime() const
minimal measurement for kernel time
constexpr static const auto FAILURE
Gaudi::Property< std::string > m_statsOutFileName
MSG::Level m_statPrintLevel
level of info printing
Gaudi::Property< bool > m_chronoCoutFlag
double eMeanTime() const
average Elapsed Time
bool operator()(const std::pair< S *, T * > &p1, const std::pair< S *, T * > &p2) const
IChronoSvc::ChronoStatus stop()
stop the chrono
T setprecision(T... args)
double kMaximalTime() const
maximal measurement for kernel time
IChronoSvc::ChronoStatus status() const
return the status of chrono
std::string outputElapsedTime() const
print the chrono ;
double uRMSTime() const
r.m.s User Time
void chronoPrint(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoPrint.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
The interface implemented by the IncidentSvc service.
std::string outputUserTime() const
print the chrono ;
The Chrono & Stat Sservice: service implements the IChronoStatSvc interface and provides the basic ch...
std::string outputSystemTime() const
print the chrono ;
ChronoMap m_chronoEntities
chrono part
T emplace_back(T... args)
Gaudi::Property< bool > m_printSystemTime
StatusCode finalize() override
Implementation of IService::finalize()
Gaudi::Property< std::string > m_perEventFile
const ChronoEntity * chrono(const IChronoStatSvc::ChronoTag &t) const override
extract the chrono entity for the given tag (name)