|
ATLAS Offline Software
|
#include <AthenaSummarySvc.h>
Definition at line 35 of file AthenaSummarySvc.h.
◆ AthenaSummarySvc()
AthenaSummarySvc::AthenaSummarySvc |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
svc |
|
) |
| |
◆ addListener()
void AthenaSummarySvc::addListener |
( |
const std::string & |
incident_name | ) |
|
|
overridevirtual |
◆ addSummary()
void AthenaSummarySvc::addSummary |
( |
const std::string & |
dict_key, |
|
|
const std::string & |
data |
|
) |
| |
|
overridevirtual |
◆ createASCII()
void AthenaSummarySvc::createASCII |
( |
std::ofstream & |
ofs | ) |
|
|
private |
Definition at line 369 of file AthenaSummarySvc.cxx.
373 list<string>::const_iterator itr;
377 ofs <<
" " << *itr << endl;
380 ofs <<
"Files written: " <<
m_outputFiles.size() << std::endl;
382 ofs <<
" " << *itr << endl;
387 ofs <<
" " << *itr << endl;
394 ofs <<
"Runs: " <<
m_runs << endl;
397 ofs <<
"Message Count: " << endl;
399 ofs <<
" ERROR: " <<
msgSvc()->messageCount( MSG::ERROR ) << endl;
400 ofs <<
" WARNING: " <<
msgSvc()->messageCount( MSG::WARNING ) << endl;
401 ofs <<
" INFO: " <<
msgSvc()->messageCount( MSG::INFO ) << endl;
406 IProperty *
ip =
dynamic_cast<IProperty*
>(
p_logMsg );
408 if (
ip->getProperty(&
thresh).isFailure()) {
409 ATH_MSG_ERROR(
"could not get loggingLevel property of LoggedMessageSvc");
412 ATH_MSG_ERROR(
"could not dcast LoggedMessageSvc to IProperty");
417 ofs <<
"Message Log: " << endl;
418 vector<pair<string,string> > msgs;
419 vector<pair<string,string> >::const_iterator mitr;
421 ofs <<
" " << levelNames[
l];
423 ofs <<
" " << msgs.size() << endl;
424 for (mitr=msgs.begin(); mitr != msgs.end(); ++mitr) {
425 ofs <<
" " << mitr->first <<
" : " << mitr->second << endl;
429 ofs <<
"Keyword tracked messages: " << endl;
432 ofs <<
" " << levelNames[ilm->level] <<
" " << ilm->source <<
" " << ilm->message
439 ofs <<
"Extra Summary Info:" << endl;
440 vector<pair<string,string> >::const_iterator itr (
m_extraInfo.begin() );
442 ofs <<
" " << itr->first <<
" : " << itr->second << endl;
447 ofs <<
"Extra Incident Counts:" << endl;
448 map<string, map<string,int> >::const_iterator itr(
m_extraIncidents.begin());
450 ofs <<
" " << itr->first;
451 if (itr->second.begin() == itr->second.end()) {
452 ofs <<
" : 0" << endl;
454 for (map<string,int>::const_iterator
it=itr->second.begin();
455 it != itr->second.end(); ++
it) {
456 ofs <<
" :: " <<
it->first <<
":" <<
it->second;
465 if (service(
"PerfMonSvc",ipms,
false).isFailure()) {
466 ATH_MSG_DEBUG(
"unable to get the PerfMonSvc: not printing perf summaries");
469 ofs <<
"Monitored Components:" << endl;
470 vector<string>::const_iterator itr;
472 vector<string> cmp_i = ipms->
components(
"ini");
473 vector<string> cmp_e = ipms->
components(
"exe");
474 vector<string> cmp_f = ipms->
components(
"fin");
476 for (itr=cmp_i.begin(); itr!=cmp_i.end(); ++itr) {
477 ofs <<
" " << *itr << endl;
482 ofs <<
"std::bad_alloc caught: out of memory condition detected"
486 ofs <<
"Exit Status: " <<
m_status << endl;
◆ createDict()
void AthenaSummarySvc::createDict |
( |
std::ofstream & |
ofd | ) |
|
|
private |
Definition at line 493 of file AthenaSummarySvc.cxx.
497 list<string>::const_iterator itr;
504 if (
f.length() > 0) {
f +=
","; }
511 if (
f.length() > 0) {
f +=
","; }
518 if (
f.length() > 0) {
f +=
","; }
521 files.add(
"write error",
f);
536 msg.add(
"ERROR",
msgSvc()->messageCount( MSG::ERROR ));
537 msg.add(
"WARNING",
msgSvc()->messageCount( MSG::WARNING ));
538 msg.add(
"INFO",
msgSvc()->messageCount( MSG::INFO ));
540 p.add(
"message count",
msg);
545 IProperty *
ip =
dynamic_cast<IProperty*
>(
p_logMsg );
547 if (
ip->getProperty(&
thresh).isFailure()) {
548 ATH_MSG_ERROR(
"could not get loggingLevel property of LoggedMessageSvc");
551 ATH_MSG_ERROR(
"could not dcast LoggedMessageSvc to IProperty");
555 vector<pair<string,string> > msgs;
556 vector<pair<string,string> >::const_iterator mitr;
560 for (mitr=msgs.begin(); mitr != msgs.end(); ++mitr) {
561 slog.
add(mitr->first, mitr->second);
563 mlog.add(levelNames[
l],slog);
566 p.add(
"messages",
mlog);
572 vector<pair<string,string> >::const_iterator itr (
m_extraInfo.begin() );
574 string dat = itr->second;
575 while( dat.find(
"\n") != string::npos) {
576 dat.erase(dat.find(
"\n"),1);
578 user.add(itr->first, dat);
580 p.add(
"user data",
user);
585 map<string, map<string,int> >::const_iterator itr(
m_extraIncidents.begin());
587 if (itr->second.begin() == itr->second.end()) {
588 inc.
add(itr->first,0);
591 for (map<string,int>::const_iterator
it=itr->second.begin();
592 it != itr->second.end(); ++
it) {
593 inc2.
add(
it->first,
it->second);
595 inc.
add(itr->first, inc2);
605 p.add(
"extra incidents",inc);
610 if (service(
"PerfMonSvc",ipms,
false).isFailure()) {
611 ATH_MSG_DEBUG(
"unable to get the PerfMonSvc: not printing perf summaries");
615 vector<string>::const_iterator itr;
617 vector<string> cmp_i = ipms->
components(
"ini");
618 vector<string> cmp_e = ipms->
components(
"exe");
619 vector<string> cmp_f = ipms->
components(
"fin");
621 for (itr=cmp_i.begin(); itr!=cmp_i.end(); ++itr) {
624 prf.
add(
"cpu",
cmp->cpu.user);
625 prf.
add(
"cpu",
cmp->cpu.sys);
626 prf.
add(
"cpu",
cmp->cpu.real);
627 prf.
add(
"mem",
cmp->mem.dVmem());
628 prf.
add(
"mem",
cmp->mem.dRss());
631 for (itr=cmp_e.begin(); itr!=cmp_e.end(); ++itr) {
634 prf.
add(
"cpu",
cmp->cpu.user);
635 prf.
add(
"cpu",
cmp->cpu.sys);
636 prf.
add(
"cpu",
cmp->cpu.real);
637 prf.
add(
"mem",
cmp->mem.dVmem());
638 prf.
add(
"mem",
cmp->mem.dRss());
641 for (itr=cmp_f.begin(); itr!=cmp_f.end(); ++itr) {
644 prf.
add(
"cpu",
cmp->cpu.user);
645 prf.
add(
"cpu",
cmp->cpu.sys);
646 prf.
add(
"cpu",
cmp->cpu.real);
647 prf.
add(
"mem",
cmp->mem.dVmem());
648 prf.
add(
"mem",
cmp->mem.dRss());
655 p.add(
"monitored components",
mon);
660 p.add(
"bad_alloc",s_badalloc);
662 ofd <<
p.dump() << endl;
◆ createSummary()
StatusCode AthenaSummarySvc::createSummary |
( |
| ) |
|
|
overridevirtual |
Definition at line 338 of file AthenaSummarySvc.cxx.
346 return StatusCode::FAILURE;
361 return StatusCode::SUCCESS;
◆ finalize()
StatusCode AthenaSummarySvc::finalize |
( |
| ) |
|
|
overridevirtual |
Definition at line 205 of file AthenaSummarySvc.cxx.
210 delete[] s_block; s_block =
nullptr;
211 std::set_new_handler(
m_new );
213 return StatusCode::SUCCESS;
◆ getOutputFile()
virtual const std::string& AthenaSummarySvc::getOutputFile |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ handle()
void AthenaSummarySvc::handle |
( |
const Incident & |
inc | ) |
|
|
overrideprivatevirtual |
Definition at line 288 of file AthenaSummarySvc.cxx.
290 ATH_MSG_DEBUG(
"handle incident: " << inc.type() <<
" " << inc.source());
294 const FileIncident *
fi =
dynamic_cast<const FileIncident*
>( &inc );
297 ATH_MSG_INFO(
" -> file incident: " <<
fi->fileName() <<
" [GUID: " <<
fi->fileGuid() <<
"]");
303 if (inc.type() ==
"BeginInputFile" ) {
305 }
else if (inc.type() ==
"BeginOutputFile") {
307 }
else if (inc.type() ==
"FailOutputFile") {
309 }
else if (inc.type() ==
"BeginEvent") {
311 }
else if (inc.type() ==
"SkipEvent") {
313 }
else if (inc.type() ==
"WriteEvent") {
315 }
else if (inc.type() ==
"BeginRun") {
317 }
else if (inc.type() ==
"EndRun") {
320 map<std::string, map<string,int> >
::iterator itr
325 if (
it != itr->second.end()) {
◆ initialize()
StatusCode AthenaSummarySvc::initialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 133 of file AthenaSummarySvc.cxx.
138 p_incSvc->addListener(
this,
"BeginInputFile", pri,
true);
139 p_incSvc->addListener(
this,
"EndInputFile", pri,
true);
140 p_incSvc->addListener(
this,
"BeginOutputFile", pri,
true);
141 p_incSvc->addListener(
this,
"FailOutputFile", pri,
true);
142 p_incSvc->addListener(
this,
"WroteToOutputFile", pri,
true);
143 p_incSvc->addListener(
this,
"EndOutputFile", pri,
true);
145 p_incSvc->addListener(
this,
"AbortEvent", pri,
true);
147 p_incSvc->addListener(
this,
"BeginEvent", pri,
true);
148 p_incSvc->addListener(
this,
"EndEvent", pri,
true);
149 p_incSvc->addListener(
this,
"BeginRun", pri,
true);
150 p_incSvc->addListener(
this,
"EndRun", pri,
true);
152 p_incSvc->addListener(
this,
"FirstInputFile", pri,
true );
154 vector<string>::const_iterator itr;
162 ATH_MSG_INFO(
"unable dcast IMessageSvc to ILoggedMessageSvc: "
163 "not scanning for keywords in logs, or printing logged messages");
167 IProperty *
ip =
dynamic_cast<IProperty*
>(
p_logMsg );
170 ATH_MSG_ERROR(
"could not set keywords property of LoggedMessageSvc");
173 <<
"\". CAVEAT EMPTOR - THIS IS VERY SLOW!!");
176 ATH_MSG_ERROR(
"could not dcast LoggedMessageSvc to IProperty");
187 s_block =
new char[ sysconf( _SC_PAGESIZE ) * 100 ];
◆ newHandler()
void AthenaSummarySvc::newHandler |
( |
| ) |
|
|
staticprivate |
Definition at line 247 of file AthenaSummarySvc.cxx.
252 throw std::bad_alloc();
255 delete[] s_block; s_block =
nullptr;
258 std::cerr <<
"AthenaSummarySvc FATAL out of memory: saving summary ..."
262 Gaudi::svcLocator()->service(
"AthenaSummarySvc",ipa).ignore();
264 if (ipa !=
nullptr) {
266 if ( System::backTrace(btrace,5,3) ) {
267 ipa->addSummary(
"badalloc backtrace",btrace);
271 ipa->createSummary().ignore();
273 std::cerr <<
"AthenaSummarySvc ERROR unable to get hold of myself and print summary"
281 throw std::bad_alloc();
◆ reinitialize()
StatusCode AthenaSummarySvc::reinitialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 196 of file AthenaSummarySvc.cxx.
198 delete[] s_block; s_block =
nullptr;
199 s_block =
new char[ sysconf( _SC_PAGESIZE ) * 100 ];
200 return s_block ? StatusCode::SUCCESS : StatusCode::FAILURE;
◆ setStatus()
virtual void AthenaSummarySvc::setStatus |
( |
int |
s | ) |
|
|
inlineoverridevirtual |
◆ ATLAS_THREAD_SAFE [1/2]
char* s_block AthenaSummarySvc::ATLAS_THREAD_SAFE |
|
staticprivate |
◆ ATLAS_THREAD_SAFE [2/2]
bool s_badalloc AthenaSummarySvc::ATLAS_THREAD_SAFE |
|
staticprivate |
◆ m_eventsRead
unsigned int AthenaSummarySvc::m_eventsRead {0} |
|
private |
◆ m_eventsSkipped
unsigned int AthenaSummarySvc::m_eventsSkipped {0} |
|
private |
◆ m_eventsWritten
unsigned int AthenaSummarySvc::m_eventsWritten {0} |
|
private |
◆ m_extraInc
StringArrayProperty AthenaSummarySvc::m_extraInc |
|
private |
Initial value:{this, "ExtraIncidents", {},
"user incidets to monitor"}
Definition at line 73 of file AthenaSummarySvc.h.
◆ m_extraIncidents
std::map< std::string, std::map<std::string, int> > AthenaSummarySvc::m_extraIncidents |
|
private |
◆ m_extraInfo
std::vector< std::pair<std::string, std::string> > AthenaSummarySvc::m_extraInfo |
|
private |
◆ m_inputFilesRead
std::list<std::string> AthenaSummarySvc::m_inputFilesRead |
|
private |
◆ m_keywords
StringArrayProperty AthenaSummarySvc::m_keywords |
|
private |
Initial value:{this, "keywords", {},
"kewords to scan for in MessageSvc. WARNING: THIS IS VERY SLOW!!!"}
Definition at line 75 of file AthenaSummarySvc.h.
◆ m_new
std::new_handler AthenaSummarySvc::m_new {nullptr} |
|
private |
◆ m_outputFiles
std::list<std::string> AthenaSummarySvc::m_outputFiles |
|
private |
◆ m_outputFilesError
std::list<std::string> AthenaSummarySvc::m_outputFilesError |
|
private |
◆ m_runs
unsigned int AthenaSummarySvc::m_runs {0} |
|
private |
◆ m_status
int AthenaSummarySvc::m_status {0} |
|
private |
◆ m_summaryFile
StringProperty AthenaSummarySvc::m_summaryFile |
|
private |
Initial value:{this, "SummaryFile", "AthSummary.txt",
"Output File"}
Definition at line 69 of file AthenaSummarySvc.h.
◆ m_summaryFormat
StringProperty AthenaSummarySvc::m_summaryFormat |
|
private |
Initial value:{this, "SummaryFileFormat", "both",
"output format: one of 'ascii', 'python', 'both'"}
Definition at line 71 of file AthenaSummarySvc.h.
◆ p_incSvc
◆ p_logMsg
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
virtual const std::vector< LoggedMessage > & getKeyMessages() const =0
const PerfMon::Component * component(PerfMon::State::Type step, const std::string &compName) const
retrieve the monitored value for the component compName and for the step step (ini,...
StringProperty m_summaryFile
Abstract produces summary of Athena stuff.
void createASCII(std::ofstream &)
StringArrayProperty m_extraInc
std::vector< std::pair< std::string, std::string > > m_extraInfo
StringProperty m_summaryFormat
unsigned int m_eventsRead
unsigned int m_eventsSkipped
msgSvc
Provide convenience handles for various services.
::StatusCode StatusCode
StatusCode definition for legacy code.
void tolower(std::string &s)
AthROOTErrorHandlerSvc * svc
ServiceHandle< IIncidentSvc > p_incSvc
virtual StatusCode createSummary() override
std::list< std::string > m_outputFiles
std::map< std::string, std::map< std::string, int > > m_extraIncidents
std::list< std::string > m_outputFilesError
std::list< std::string > m_inputFilesRead
StringArrayProperty m_keywords
void add(const string &a, const char *b)
void createDict(std::ofstream &)
virtual const std::vector< std::pair< std::string, std::string > > & getMessages(MSG::Level) const =0
ILoggedMessageSvc * p_logMsg
virtual void addListener(const std::string &incident_name) override
unsigned int m_eventsWritten
std::vector< std::string > components(PerfMon::State::Type step) const
return the list of components' names for a given step