Go to the documentation of this file.
12 # pragma warning( disable : 4786 )
56 template <
typename S,
typename T>
73 const IChronoStatSvc::ChronoTag&
key = item.first;
83 const IChronoStatSvc::StatTag&
key = item.first;
107 error() <<
"Unable to find IncidentSvc" <<
endmsg;
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 ) {
328 theStat = &theIter->second;
348 auto lock = std::scoped_lock{
m_mutex };
369 info() <<
"Could not open the output file for writing chrono statistics [" <<
m_statsOutFileName.
value() <<
"]"
380 auto lock = std::scoped_lock{
m_mutex };
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";
404 out <<
"cpu_user_mean = " << entity->
uMeanTime() <<
"\n";
405 out <<
"cpu_user_RMS = " << entity->
uRMSTime() <<
"\n";
411 out <<
"cpu_system_total = " << entity->
kTotalTime() <<
"\n";
413 out <<
"cpu_system_mean = " << entity->
kMeanTime() <<
"\n";
414 out <<
"cpu_system_RMS = " << entity->
kRMSTime() <<
"\n";
422 out <<
"cpu_real_mean = " << entity->
eMeanTime() <<
"\n";
423 out <<
"cpu_real_RMS = " << entity->
eRMSTime() <<
"\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 ) {
488 if ( !entity ) {
continue; }
489 const StatTag* tag = iter.second;
490 if ( !tag ) {
continue; }
516 auto lock = std::scoped_lock{
m_mutex };
518 if ( itr.first.find(
":Execute" ) == std::string::npos )
continue;
Gaudi::Property< std::string > m_header
T setprecision(T... args)
Gaudi::Property< bool > m_printSystemTime
Gaudi::Property< bool > m_chronoOrderFlag
StatusCode initialize() override
double eMinimalTime() const
minimal measurement for elapsed time
double uMinimalTime() const
minimal measurement for user time
IChronoSvc::ChronoStatus stop()
stop the chrono
double eRMSTime() const
r.m.s Elapsed Time
ChronoEntity & getEntity(const ChronoTag &chronoTag)
ChronoMap m_chronoEntities
chrono part
StatusCode finalize() override
Implementation of IService::finalize()
backward compatible StatEntity class.
T back_inserter(T... args)
Gaudi::Property< bool > m_statCoutFlag
double eMeanTime() const
average Elapsed Time
ChronoStatus chronoStatus(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStatus.
IChronoSvc::ChronoTime delta(IChronoSvc::ChronoType type) const
return the last delta-time of type "type"
StatMap m_statEntities
stat part
double eTotalTime() const
total Elapsed time
double kMinimalTime() const
minimal measurement for kernel time
void merge(const ChronoStatSvc &css)
Compound assignment operator.
StatusCode finalize() override
void stat(const IChronoStatSvc::StatTag &statTag, const IChronoStatSvc::StatFlag &statFlag) override
Implementation of IChronoStatSvc::stat add statistical information to the entity ,...
IChronoSvc::ChronoStatus start()
start the current chrono
IChronoStatSvc::ChronoTime chronoDelta(const IChronoStatSvc::ChronoTag &chronoTag, IChronoStatSvc::ChronoType theType) override
Implementation of IchronoStatSvc::chronoDelta.
unsigned long nOfMeasurements() const
number of chrono measurements
const ChronoEntity * chronoStop(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStop.
double uMeanTime() const
average User Time
std::string outputSystemTime() const
print the chrono ;
void statPrint(const IChronoStatSvc::ChronoTag &statTag) override
prints (using message service) info about statistical entity, tagged by its name
void saveStats()
dump the statistics into an ASCII file for offline processing
Gaudi::Property< bool > m_printUserTime
std::mutex m_mutex
Mutex protecting m_chronoEntities.
T * get() const
Allow non const access to the service, even from a const handle...
const std::string & name() const override
Retrieve name of the service
std::ostream & print(std::ostream &o, bool tableFormat, std::string_view name, bool flag=true, std::string_view fmtHead="%|-48.48s|%|27t|") const
double kRMSTime() const
r.m.s Kernel Time
double kTotalTime() const
total Kernel time
std::string outputElapsedTime() const
print the chrono ;
std::string outputUserTime() const
print the chrono ;
Gaudi::Property< bool > m_printEllapsedTime
Gaudi::Property< bool > m_chronoTableFlag
const ValueType & value() const
Gaudi::Property< bool > m_useEffFormat
void clear(STATE_TYPE _i=std::ios_base::failbit)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
IChronoSvc::ChronoStatus status() const
return the status of chrono
MSG::Level m_chronoPrintLevel
level of info printing
StatusCode retrieve(T *&service) const override
Do the real retrieval of the Service.
HepRndm::Engine< TripleRand > e2
double kMaximalTime() const
maximal measurement for kernel time
double uRMSTime() const
r.m.s User Time
unsigned long addFlag(const double v)
ServiceHandle< IInterface > m_hiveWhiteBoardSvc
bool operator()(const std::pair< S *, T * > &p1, const std::pair< S *, T * > &p2) const
Gaudi::Property< bool > m_statTableFlag
T emplace_back(T... args)
ChronoEntity * chronoStart(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoStart.
constexpr static const auto SUCCESS
Gaudi::Property< bool > m_statOrderFlag
#define DECLARE_COMPONENT(type)
Gaudi::Property< bool > m_chronoCoutFlag
MSG::Level m_statPrintLevel
level of info printing
void handle(const Incident &incident) override
StatusCode initialize() override
Implementation of IService::initialize()
double kMeanTime() const
average Kernel Time
Gaudi::Property< std::string > m_perEventFile
void chronoPrint(const IChronoStatSvc::ChronoTag &chronoTag) override
Implementation of IChronoStatSvc::chronoPrint.
double uMaximalTime() const
maximal measurement for user time
constexpr static const auto FAILURE
Gaudi::Property< std::string > m_statsOutFileName
double eMaximalTime() const
maximal measurement for elapsed time
const ChronoEntity * chrono(const IChronoStatSvc::ChronoTag &t) const override
extract the chrono entity for the given tag (name)
double uTotalTime() const
total user time
constexpr struct CompareFirstOfPointerPair_t CompareFirstOfPointerPair
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator