|
ATLAS Offline Software
|
#include <PerfMonSvc.h>
|
| PerfMonSvc (const std::string &name, ISvcLocator *pSvcLocator) |
| Constructor with parameters: More...
|
|
virtual | ~PerfMonSvc () |
| Destructor: More...
|
|
virtual StatusCode | initialize () override |
| Gaudi Service Implementation. More...
|
|
virtual StatusCode | finalize () override |
|
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) override |
|
virtual StatusCode | io_reinit () override final |
| IIoComponent interface More...
|
|
virtual StatusCode | io_finalize () override final |
| IIoComponent interface More...
|
|
virtual std::vector< std::string > | components (const std::string &stepName) const override |
| return the list of components' names for a given step More...
|
|
virtual std::vector< std::string > | io_components () const override |
| return the list of io-components' names More...
|
|
virtual const PerfMon::Component * | component (const std::string &stepName, const std::string &compName) const override |
| retrieve the monitored value for the component compName and for the step stepName (ini,evt,fin,cbk,...) More...
|
|
virtual const PerfMon::IoContainer * | io_component (const std::string &compName) const override |
| retrieve the I/O monitored value for the I/O component compName More...
|
|
virtual void | domain (const std::string &compName, std::string &domain) const override |
| retrieve the domain name for a given component compName More...
|
|
virtual void | handle (const Incident &incident) override |
| incident service handle for EndEvent More...
|
|
virtual void | declareInfo (const std::string &name, const bool &var, const std::string &desc, const IInterface *owner) override |
| Declare monitoring information. More...
|
|
virtual void | declareInfo (const std::string &name, const int &var, const std::string &desc, const IInterface *owner) override |
|
virtual void | declareInfo (const std::string &name, const long &var, const std::string &desc, const IInterface *owner) override |
|
virtual void | declareInfo (const std::string &name, const double &var, const std::string &desc, const IInterface *owner) override |
|
virtual void | declareInfo (const std::string &name, const std::string &var, const std::string &desc, const IInterface *owner) override |
|
virtual void | declareInfo (const std::string &name, const std::pair< double, double > &var, const std::string &desc, const IInterface *owner) override |
|
virtual void | declareInfo (const std::string &name, const AIDA::IBaseHistogram *var, const std::string &desc, const IInterface *owner) override |
|
virtual void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc, const IInterface *owner) override |
|
virtual void | declareInfo (const std::string &name, const StatEntity &var, const std::string &desc, const IInterface *owner) override |
|
virtual void | undeclareInfo (const std::string &name, const IInterface *owner) override |
| Undeclare monitoring information. More...
|
|
virtual void | undeclareAll (const IInterface *owner) override |
| Undeclare monitoring information. More...
|
|
virtual std::set< std::string > * | getInfos (const IInterface *owner) override |
| Get the names for all declared monitoring informations for a given owener. More...
|
|
void | startAud (const std::string &stepName, const std::string &compName) override |
| Start collecting monitoring data for a given component, for a given step of the Gaudi FSM. More...
|
|
void | stopAud (const std::string &stepName, const std::string &compName) override |
| Stop collecting monitoring data for a given component, for a given step of the Gaudi FSM. More...
|
|
PerfMon::State::Type | monState () const |
| Retrieve the current state of Gaudi's finite state machine. More...
|
|
const std::string & | monStateName () const |
| Retrieve the name of the current state of Gaudi's FSM. More...
|
|
std::vector< std::string > | components (PerfMon::State::Type step) const |
| return the list of components' names for a given step More...
|
|
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,evt,fin,cbk,...) More...
|
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
Definition at line 63 of file PerfMonSvc.h.
◆ StatStore_t
◆ PerfMonSvc() [1/2]
PerfMonSvc::PerfMonSvc |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
Constructor with parameters:
Definition at line 176 of file PerfMonSvc.cxx.
199 "Maximum allowed variation of virtual memory (in bytes) "
200 "between last print-out and current vmem value, before "
201 "triggering a new print-out" );
205 "Name of the output file to hold performance data" );
209 "List of algorithms to be profiled. If empty list "
210 "(default), all the algorithms known to the ApplicationMgr "
217 "List of <CppType>#<SgKey> containers for which one wants "
218 "to gather I/O data" );
224 "switch to enable or not the on-the-fly double-counting "
229 "monitoring level for monitoring granularity.\n" \
236 "name of the shelve file containing jobo metadata (domain "\
237 "flags, components' list, ...)");
241 "Whether or not to enable semi-detailed monitoring.\n" \
244 " 2: Enabled with full output in logfile");
248 "Needed internally to time configuration step. Do not modify this property." );
252 "Trigger print of perf metrics before and after each auditing." );
◆ ~PerfMonSvc()
PerfMonSvc::~PerfMonSvc |
( |
| ) |
|
|
virtual |
◆ PerfMonSvc() [2/2]
PerfMonSvc::PerfMonSvc |
( |
| ) |
|
|
private |
◆ comp_startAud()
void PerfMonSvc::comp_startAud |
( |
const std::string & |
stepName, |
|
|
const std::string & |
compName |
|
) |
| |
|
private |
start collection monitoring cpu+mem data for a given component
Definition at line 1223 of file PerfMonSvc.cxx.
1242 int buf_sz = asprintf
1245 stepName.c_str(),
compName.c_str(),
1247 c.cpu.user,
c.cpu.sys,
c.cpu.real,
c.cpu.rt_cpu,
1248 c.mem.vmem[0],
c.mem.rss[0],
c.mem.mall[0],
1249 ((
unsigned long)
c.mem.nmall[0]),
1250 ((
unsigned long)
c.mem.nfree[0])
1257 const std::string stream_name =
m_outFileName.value()+
".pmon.stream";
1259 PMON_INFO(
"re-opening pmon-stream file [" << stream_name <<
"]...");
1261 O_WRONLY | O_APPEND,
1262 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
1265 PMON_ERROR(
"could not re-open pmon-stream file ["
1266 << stream_name <<
"] !");
◆ comp_stopAud()
void PerfMonSvc::comp_stopAud |
( |
const std::string & |
stepName, |
|
|
const std::string & |
compName |
|
) |
| |
|
private |
stop collection monitoring cpu+mem data for a given component
Definition at line 1276 of file PerfMonSvc.cxx.
1282 bool alertVmem =
false;
1297 stats.cpu +=
c.cpu.user +
c.cpu.sys;
1298 stats.cpu_user +=
c.cpu.user;
1299 stats.cpu_sys +=
c.cpu.sys;
1300 stats.real +=
c.cpu.real;
1301 stats.rt +=
c.cpu.rt_cpu;
1302 stats.vmem +=
c.mem.vmem[1];
1303 stats.malloc +=
c.mem.mall[1] -
c.mem.mall[0];
1304 stats.nalloc +=
c.mem.nmall[1]-
c.mem.nmall[0];
1335 asprintf(&hdr,
"[%s] ", stepName.c_str());
1355 "alloc= +%lu -%lu %8.3f kb " \
1358 c.cpu.user+
c.cpu.sys,
1359 c.mem.vmem[1]/1024.,
1360 c.mem.dVmem()/1024.,
1361 ((
unsigned long)
c.mem.dNMall()),
1362 ((
unsigned long)
c.mem.dNFree()),
1363 (
float)
c.mem.dMall(),
1391 int buf_sz = asprintf
1394 stepName.c_str(),
compName.c_str(),
1396 c.cpu.user,
c.cpu.sys,
c.cpu.real,
c.cpu.rt_cpu,
1397 c.mem.vmem[1],
c.mem.rss[1],
c.mem.mall[1],
1398 ((
unsigned long)
c.mem.nmall[1]),
1399 ((
unsigned long)
c.mem.nfree[1])
◆ component() [1/2]
retrieve the monitored value for the component compName
and for the step stepName
(ini,evt,fin,cbk,...)
retrieve the monitored value for the component compName
and for the step step
(ini,evt,fin,cbk,...)
Implements IPerfMonSvc.
Definition at line 761 of file PerfMonSvc.cxx.
764 CompTuple_t::const_iterator itr =
m_ntuple.
comp.find(stepName);
771 if (jtr ==
store.end()) {
774 return &(jtr->second);
◆ component() [2/2]
retrieve the monitored value for the component compName
and for the step step
(ini,evt,fin,cbk,...)
Definition at line 78 of file IPerfMonSvc.h.
◆ components() [1/2]
std::vector< std::string > PerfMonSvc::components |
( |
const std::string & |
stepName | ) |
const |
|
overridevirtual |
return the list of components' names for a given step
Implements IPerfMonSvc.
Definition at line 714 of file PerfMonSvc.cxx.
716 CompTuple_t::const_iterator itr =
m_ntuple.
comp.find(stepName);
718 return std::vector<std::string>();
723 std::vector<std::string> comps;
724 comps.reserve(
store.size());
725 for (CompStore_t::const_iterator
730 comps.push_back(jtr->first);
◆ components() [2/2]
return the list of components' names for a given step
Definition at line 62 of file IPerfMonSvc.h.
◆ declareInfo() [1/9]
void PerfMonSvc::declareInfo |
( |
const std::string & |
name, |
|
|
const AIDA::IBaseHistogram * |
var, |
|
|
const std::string & |
desc, |
|
|
const IInterface * |
owner |
|
) |
| |
|
overridevirtual |
Implements IPerfMonSvc.
Definition at line 980 of file PerfMonSvc.cxx.
985 std::ostringstream
err;
986 err <<
"PerfMonSvc::declareInfo( "
987 <<
"name = [" <<
name <<
"], "
988 <<
"hist = [" <<
var <<
"], "
989 <<
"descr = [" <<
desc <<
"], "
990 <<
"owner = [" << owner <<
"] )\n"
991 <<
"Not implemented !"
994 throw std::runtime_error(
err.str() );
◆ declareInfo() [2/9]
void PerfMonSvc::declareInfo |
( |
const std::string & |
name, |
|
|
const bool & |
var, |
|
|
const std::string & |
desc, |
|
|
const IInterface * |
owner |
|
) |
| |
|
overridevirtual |
Declare monitoring information.
- Parameters
-
name | Monitoring information name knwon to the external system |
var | Monitoring Listener address |
desc | Textual description |
owner | Owner identifier of the monitoring information (needed to peform clean up |
Implements IPerfMonSvc.
Definition at line 877 of file PerfMonSvc.cxx.
882 const INamedInterface* owner =
dynamic_cast<const INamedInterface*
>(iowner);
883 if ( !owner ) {
throw std::bad_cast();
◆ declareInfo() [3/9]
void PerfMonSvc::declareInfo |
( |
const std::string & |
name, |
|
|
const double & |
var, |
|
|
const std::string & |
desc, |
|
|
const IInterface * |
owner |
|
) |
| |
|
overridevirtual |
Implements IPerfMonSvc.
Definition at line 928 of file PerfMonSvc.cxx.
933 const INamedInterface* owner =
dynamic_cast<const INamedInterface*
>(iowner);
934 if ( !owner ) {
throw std::bad_cast();
◆ declareInfo() [4/9]
void PerfMonSvc::declareInfo |
( |
const std::string & |
name, |
|
|
const int & |
var, |
|
|
const std::string & |
desc, |
|
|
const IInterface * |
owner |
|
) |
| |
|
overridevirtual |
Implements IPerfMonSvc.
Definition at line 894 of file PerfMonSvc.cxx.
899 const INamedInterface* owner =
dynamic_cast<const INamedInterface*
>(iowner);
900 if ( !owner ) {
throw std::bad_cast();
◆ declareInfo() [5/9]
void PerfMonSvc::declareInfo |
( |
const std::string & |
name, |
|
|
const long & |
var, |
|
|
const std::string & |
desc, |
|
|
const IInterface * |
owner |
|
) |
| |
|
overridevirtual |
Implements IPerfMonSvc.
Definition at line 911 of file PerfMonSvc.cxx.
916 const INamedInterface* owner =
dynamic_cast<const INamedInterface*
>(iowner);
917 if ( !owner ) {
throw std::bad_cast();
◆ declareInfo() [6/9]
void PerfMonSvc::declareInfo |
( |
const std::string & |
name, |
|
|
const StatEntity & |
var, |
|
|
const std::string & |
desc, |
|
|
const IInterface * |
owner |
|
) |
| |
|
overridevirtual |
Implements IPerfMonSvc.
Definition at line 1018 of file PerfMonSvc.cxx.
1023 std::ostringstream
err;
1024 err <<
"PerfMonSvc::declareInfo( "
1025 <<
"name = [" <<
name <<
"], "
1026 <<
"var = [" <<
var <<
"], "
1027 <<
"descr = [" <<
desc <<
"], "
1028 <<
"owner = [" << owner <<
"] )\n"
1029 <<
"Not implemented !"
1032 throw std::runtime_error(
err.str() );
◆ declareInfo() [7/9]
void PerfMonSvc::declareInfo |
( |
const std::string & |
name, |
|
|
const std::pair< double, double > & |
var, |
|
|
const std::string & |
desc, |
|
|
const IInterface * |
owner |
|
) |
| |
|
overridevirtual |
Implements IPerfMonSvc.
Definition at line 962 of file PerfMonSvc.cxx.
967 const INamedInterface* owner =
dynamic_cast<const INamedInterface*
>(iowner);
968 if ( !owner ) {
throw std::bad_cast();
◆ declareInfo() [8/9]
void PerfMonSvc::declareInfo |
( |
const std::string & |
name, |
|
|
const std::string & |
format, |
|
|
const void * |
var, |
|
|
int |
size, |
|
|
const std::string & |
desc, |
|
|
const IInterface * |
owner |
|
) |
| |
|
overridevirtual |
Implements IPerfMonSvc.
Definition at line 997 of file PerfMonSvc.cxx.
1003 std::ostringstream
err;
1004 err <<
"PerfMonSvc::declareInfo( "
1005 <<
"name = [" <<
name <<
"], "
1006 <<
"fmt = [" <<
format <<
"], "
1007 <<
"var = [" <<
var <<
"], "
1008 <<
"size= [" <<
size <<
"], "
1009 <<
"descr = [" <<
desc <<
"], "
1010 <<
"owner = [" << owner <<
"] )\n"
1011 <<
"Not implemented !"
1014 throw std::runtime_error(
err.str() );
◆ declareInfo() [9/9]
void PerfMonSvc::declareInfo |
( |
const std::string & |
name, |
|
|
const std::string & |
var, |
|
|
const std::string & |
desc, |
|
|
const IInterface * |
owner |
|
) |
| |
|
overridevirtual |
Implements IPerfMonSvc.
Definition at line 945 of file PerfMonSvc.cxx.
950 const INamedInterface* owner =
dynamic_cast<const INamedInterface*
>(iowner);
951 if ( !owner ) {
throw std::bad_cast();
◆ do_io_mon()
void PerfMonSvc::do_io_mon |
( |
| ) |
|
|
private |
collect I/O monitoring data
Definition at line 1413 of file PerfMonSvc.cxx.
1416 for (std::size_t
i = 0,
imax = ionames.size();
1419 const std::string& ioname = ionames[
i];
1420 const std::string p2t = std::string(
"cObj_")+ioname;
1421 const std::string p2tr= std::string(
"cObjR_")+ioname;
1422 const std::string t2p = std::string(
"cRep_")+ioname;
1427 c.r.user = (
float)
m_chrono->chronoDelta(p2t, IChronoStatSvc::USER);
1428 c.r.sys = (
float)
m_chrono->chronoDelta(p2t, IChronoStatSvc::KERNEL);
1429 c.r.real = (
float)
m_chrono->chronoDelta(p2t, IChronoStatSvc::ELAPSED);
1433 c.rr.user = (
float)
m_chrono->chronoDelta(p2tr, IChronoStatSvc::USER);
1434 c.rr.sys = (
float)
m_chrono->chronoDelta(p2tr, IChronoStatSvc::KERNEL);
1435 c.rr.real = (
float)
m_chrono->chronoDelta(p2tr, IChronoStatSvc::ELAPSED);
1439 c.w.user = (
float)
m_chrono->chronoDelta(t2p, IChronoStatSvc::USER);
1440 c.w.sys = (
float)
m_chrono->chronoDelta(t2p, IChronoStatSvc::KERNEL);
1441 c.w.real = (
float)
m_chrono->chronoDelta(t2p, IChronoStatSvc::ELAPSED);
1445 int buf_sz = asprintf
1448 "io", ioname.c_str(),
1449 c.r.user,
c.r.sys,
c.r.real,
c.r.rt_cpu,
1450 c.rr.user,
c.rr.sys,
c.rr.real,
c.rr.rt_cpu,
1451 c.w.user,
c.w.sys,
c.w.real,
c.w.rt_cpu
1458 const std::string ioname =
"commitOutput";
1459 c.w.user = (
float)
m_chrono->chronoDelta(ioname, IChronoStatSvc::USER);
1460 c.w.sys = (
float)
m_chrono->chronoDelta(ioname, IChronoStatSvc::KERNEL);
1461 c.w.real = (
float)
m_chrono->chronoDelta(ioname, IChronoStatSvc::ELAPSED);
1465 int buf_sz = asprintf
1468 "io",
"PerfMonSliceIo",
1469 c.r.user,
c.r.sys,
c.r.real,
c.r.rt_cpu,
1470 c.rr.user,
c.rr.sys,
c.rr.real,
c.rr.rt_cpu,
1471 c.w.user,
c.w.sys,
c.w.real,
c.w.rt_cpu
◆ domain()
void PerfMonSvc::domain |
( |
const std::string & |
compName, |
|
|
std::string & |
domain |
|
) |
| const |
|
overridevirtual |
retrieve the domain name for a given component compName
Implements IPerfMonSvc.
Definition at line 796 of file PerfMonSvc.cxx.
804 const_cast<char*
>(
"domains_db"),
807 PMON_WARNING(
"Problem on python side for domains_db() !!");
811 if (!PyDict_Check(
db)) {
817 PyObject *py_domain = PyDict_GetItemString
819 const_cast<char*
>(
compName.c_str()));
826 #if PY_MAJOR_VERSION < 3
827 if (!PyString_Check(py_domain)) {
828 PMON_WARNING(
"domains_db() returned a non-string for component ["
834 domain = std::string(PyString_AS_STRING(py_domain));
837 if (!PyUnicode_Check(py_domain)) {
838 PMON_WARNING(
"domains_db() returned a non-unicode for component ["
844 domain = std::string(PyUnicode_AsUTF8(py_domain));
◆ finalize()
StatusCode PerfMonSvc::finalize |
( |
| ) |
|
|
overridevirtual |
loop over the perf-tools and harvest 'finalize' perf-data
Definition at line 680 of file PerfMonSvc.cxx.
687 return StatusCode::SUCCESS;
◆ getInfos()
std::set< std::string > * PerfMonSvc::getInfos |
( |
const IInterface * |
owner | ) |
|
|
overridevirtual |
Get the names for all declared monitoring informations for a given owener.
If the owner is NULL, then it returns for all owners informationUndeclare monitoring information
Implements IPerfMonSvc.
Definition at line 1071 of file PerfMonSvc.cxx.
◆ handle()
void PerfMonSvc::handle |
( |
const Incident & |
incident | ) |
|
|
overridevirtual |
incident service handle for EndEvent
Definition at line 856 of file PerfMonSvc.cxx.
860 <<
"Entering handle(): "
862 <<
" Incidence type: " << inc.type() <<
endmsg
863 <<
" from: " << inc.source() <<
endmsg;
866 if ( inc.type() == IncidentType::SvcPostFinalize ) {
◆ initialize()
StatusCode PerfMonSvc::initialize |
( |
| ) |
|
|
overridevirtual |
Gaudi Service Implementation.
Definition at line 487 of file PerfMonSvc.cxx.
497 const std::string stream_name =
m_outFileName.value()+
".pmon.stream";
499 PMON_INFO(
"opening pmon-stream file [" << stream_name <<
"]...");
502 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
505 PMON_ERROR(
"could not open pmon-stream file ["
506 << stream_name <<
"] !");
507 return StatusCode::FAILURE;
511 const char* hdr =
"#data format: comp-id idx cpu-fields(4) mem-fields(4)\n";
518 for (std::size_t istep=0,
imax=PerfMon::Steps.
size();
521 const std::string&
step = PerfMon::Steps[istep];
526 const std::string
step =
"io";
531 const std::string
step =
"usr";
537 PMON_INFO(
"Retrieving PyPerfMonSvc object...");
538 const std::string moduleName =
"PerfMonComps.PyPerfMon";
539 PyObject*
module = PyImport_ImportModule(
const_cast<char*
>(moduleName.c_str()) );
541 PMON_ERROR(
"Could not import [" << moduleName <<
"] !!");
546 PMON_INFO(
"Retrieving PyPerfMonSvc object...");
548 const std::string fctName =
"retrieve_pmon_svc";
550 py_fct = PyDict_GetItemString(PyModule_GetDict(
module),
551 const_cast<char*
>(fctName.c_str()));
553 PMON_ERROR(
"could not retrieve function [" << fctName <<
"] from "
554 "module [" << moduleName <<
"] !!");
557 const std::string pickle_name =
m_outFileName.value()+
".props.pkl";
558 m_pySvc = PyObject_CallFunction(py_fct,
560 (
char*)pickle_name.c_str());
562 PMON_ERROR(
"problem calling function [" << fctName <<
"] from "
563 "module [" << moduleName <<
"] !!");
566 PMON_INFO(
"Retrieving PyPerfMonSvc object... [OK]");
574 const_cast<char*
>(
"initialize"),
575 const_cast<char*
>(
"") );
577 PMON_WARNING(
"Problem on python side during initialize() !!");
589 std::ostringstream
out;
593 std::ostream_iterator<std::string>(
out,
" " ) );
601 std::ostringstream
out;
605 std::ostream_iterator<std::string>(
out,
" " ) );
612 if ( !incSvc.retrieve().isSuccess() ) {
614 return StatusCode::FAILURE;
616 incSvc->addListener(
this, IncidentType::SvcPostFinalize );
621 msg() ).isSuccess() ) {
622 PMON_ERROR(
"Could not register auditor [Athena::PerfMonAuditor] !!");
623 return StatusCode::FAILURE;
630 if ( !iomgr.retrieve().isSuccess() ) {
631 ATH_MSG_ERROR (
"could not retrieve I/O component manager !");
632 return StatusCode::FAILURE;
634 if ( !iomgr->io_register(
this).isSuccess() ) {
635 ATH_MSG_ERROR (
"could not register with the I/O component manager !");
636 return StatusCode::FAILURE;
640 if ( !iomgr->io_register(
this,
642 stream_name).isSuccess() ) {
644 << stream_name <<
"] with the I/O component manager...");
645 return StatusCode::FAILURE;
653 const_cast<char*
>(
"install_pmon_dso_logger"),
654 const_cast<char*
>(
""),
655 const_cast<char*
>(
""));
657 PMON_WARNING(
"Problem during pmon-dso-logger installation");
660 #if PY_MAJOR_VERSION < 3
661 long do_dso = PyInt_AS_LONG(
res);
663 long do_dso = PyLong_AS_LONG(
res);
677 return StatusCode::SUCCESS;
◆ interfaceID()
const InterfaceID & PerfMonSvc::interfaceID |
( |
| ) |
|
|
inlinestatic |
◆ io_component()
retrieve the I/O monitored value for the I/O component compName
Implements IPerfMonSvc.
Definition at line 779 of file PerfMonSvc.cxx.
788 if (jtr ==
store.end()) {
791 return &(jtr->second);
◆ io_components()
std::vector< std::string > PerfMonSvc::io_components |
( |
| ) |
const |
|
overridevirtual |
return the list of io-components' names
Implements IPerfMonSvc.
Definition at line 737 of file PerfMonSvc.cxx.
741 return std::vector<std::string>();
746 std::vector<std::string> comps;
747 comps.reserve(
store.size());
748 for (IoCompStore_t::const_iterator
753 comps.push_back(jtr->first);
◆ io_finalize()
StatusCode PerfMonSvc::io_finalize |
( |
| ) |
|
|
finaloverridevirtual |
IIoComponent
interface
callback method to finalize the internal state of the component for I/O purposes (e.g. upon fork(2)
)
Definition at line 468 of file PerfMonSvc.cxx.
475 strerror_r(errno, errbuf,
sizeof(errbuf));
478 return StatusCode::FAILURE;
481 return StatusCode::SUCCESS;
◆ io_reinit()
StatusCode PerfMonSvc::io_reinit |
( |
| ) |
|
|
finaloverridevirtual |
IIoComponent
interface
callback methods to reinitialize/finalize the internal state of the component for I/O purposes (e.g. upon fork(2)
)
callback method to reinitialize the internal state of the component for I/O purposes (e.g. upon fork(2)
)
Definition at line 389 of file PerfMonSvc.cxx.
392 if (!iomgr.retrieve().isSuccess()) {
394 return StatusCode::FAILURE;
397 if (!iomgr->io_hasitem(
this)) {
398 ATH_MSG_ERROR(
"IoComponentMgr does not know about myself !");
399 return StatusCode::FAILURE;
402 std::string stream_name =
m_outFileName.value()+
".pmon.stream";
403 std::string orig_stream_name = stream_name;
405 if (!iomgr->io_contains(
this, stream_name)) {
406 ATH_MSG_ERROR(
"IoComponentMgr does not know about [" << stream_name <<
"] !");
407 return StatusCode::FAILURE;
409 if (!iomgr->io_retrieve(
this, stream_name).isSuccess()) {
410 ATH_MSG_ERROR(
"Could not retrieve new value for [" << stream_name <<
"] !");
411 return StatusCode::FAILURE;
413 if (stream_name.empty()) {
414 ATH_MSG_DEBUG(
"io_reinit called in parent process. No actions required.");
415 return StatusCode::SUCCESS;
423 stream_name =
m_workerDir +
"/" + my_basename(orig_stream_name);
428 int old_stream =
open(orig_stream_name.c_str(), O_RDONLY);
429 if (old_stream < 0) {
431 << orig_stream_name <<
"] !");
432 return StatusCode::FAILURE;
436 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
439 strerror_r(errno, errbuf,
sizeof(errbuf));
443 return StatusCode::FAILURE;
449 while((bytes =
read(old_stream,
line,
sizeof(
line))) > 0)
453 int close_sc = close(old_stream);
455 ATH_MSG_INFO(
"could not close the re-open old pmon.stream file");
457 ATH_MSG_INFO(
"reopening [" << stream_name <<
"]... [ok]");
458 return StatusCode::SUCCESS;
◆ monState()
Retrieve the current state of Gaudi's finite state machine.
Definition at line 53 of file IPerfMonSvc.h.
◆ monStateName()
const std::string& IPerfMonSvc::monStateName |
( |
| ) |
const |
|
inlineinherited |
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ poll()
void PerfMonSvc::poll |
( |
| ) |
|
|
private |
loop over user-declared variables (via the IMonitorSvc
interface) and poll the data
Definition at line 1209 of file PerfMonSvc.cxx.
◆ postFinalize()
void PerfMonSvc::postFinalize |
( |
| ) |
|
|
private |
loop over the perf-tools and harvest 'finalize' perf-data
Definition at line 269 of file PerfMonSvc.cxx.
283 auto cwd = std::filesystem::current_path();
292 stopAud(
"fin",
"PerfMonSlice" );
304 std::string pmonsd_out(
m_outFileName);pmonsd_out+=
".pmon.pmonsd.txt";
305 std::string pmon_tarball(
m_outFileName);pmon_tarball+=
".pmon.gz";
312 for (StatStore_t::const_iterator
317 const Stats_t&
stats = istat->second;
320 const_cast<char*
>(
"_set_stats"),
321 const_cast<char*
>(
"sIffffffffffffffffIfffififif"),
322 (
char*)istat->first.c_str(),
323 stats.cpu.nEntries(),
324 stats.cpu.flagMean(),
325 stats.cpu.flagMeanErr(),
326 stats.cpu_user.flagMean(),
327 stats.cpu_user.flagMeanErr(),
328 stats.cpu_sys.flagMean(),
329 stats.cpu_sys.flagMeanErr(),
330 stats.real.flagMean(),
331 stats.real.flagMeanErr(),
332 stats.vmem.flagMean(),
333 stats.vmem.flagMeanErr(),
334 stats.malloc.flagMean(),
335 stats.malloc.flagMeanErr(),
336 stats.nalloc.flagMean(),
337 stats.nalloc.flagMeanErr(),
339 stats.rt.flagMeanErr(),
352 PMON_WARNING(
"Problem on python side during finalize() !!");
362 const_cast<char*
>(
"finalize"),
363 const_cast<char*
>(
"") );
365 PMON_WARNING(
"Problem on python side during finalize() !!");
376 std::filesystem::current_path(
cwd);
◆ queryInterface()
StatusCode PerfMonSvc::queryInterface |
( |
const InterfaceID & |
riid, |
|
|
void ** |
ppvInterface |
|
) |
| |
|
overridevirtual |
Definition at line 696 of file PerfMonSvc.cxx.
702 return Service::queryInterface(riid, ppvInterface);
705 return StatusCode::SUCCESS;
◆ setMonState()
◆ setupIoContainerList()
void PerfMonSvc::setupIoContainerList |
( |
Gaudi::Details::PropertyBase & |
ioContainerNames | ) |
|
|
private |
callback to synchronize the list of I/O containers to be monitored
Definition at line 1084 of file PerfMonSvc.cxx.
◆ setupProfiledAlgList()
void PerfMonSvc::setupProfiledAlgList |
( |
Gaudi::Details::PropertyBase & |
profiledAlgNames | ) |
|
|
private |
callback to synchronize the list of algorithms to be profiled
Definition at line 1079 of file PerfMonSvc.cxx.
◆ startAud()
void PerfMonSvc::startAud |
( |
const std::string & |
stepName, |
|
|
const std::string & |
compName |
|
) |
| |
|
overridevirtual |
Start collecting monitoring data for a given component, for a given step of the Gaudi FSM.
Implements IPerfMonSvc.
Definition at line 1126 of file PerfMonSvc.cxx.
1132 stopAud(
"ini",
"PerfMonSlice" );
1153 <<
" [vmem="<<vmem/1024.0<<
"mb, rss="
1154 <<rss/1024.0<<
"mb, malloc="<<PMonSD::get_malloc_kb()/1024.0
◆ stopAud()
void PerfMonSvc::stopAud |
( |
const std::string & |
stepName, |
|
|
const std::string & |
compName |
|
) |
| |
|
overridevirtual |
Stop collecting monitoring data for a given component, for a given step of the Gaudi FSM.
Implements IPerfMonSvc.
Definition at line 1172 of file PerfMonSvc.cxx.
1179 stopAud(
"evt",
"PerfMonSlice" );
1201 <<
" [vmem="<<vmem/1024.0<<
"mb, rss="
1202 <<rss/1024.0<<
"mb, malloc="<<PMonSD::get_malloc_kb()/1024.0
◆ undeclareAll()
void PerfMonSvc::undeclareAll |
( |
const IInterface * |
owner | ) |
|
|
overridevirtual |
Undeclare monitoring information.
- Parameters
-
owner | Owner identifier of the monitoring information |
Implements IPerfMonSvc.
Definition at line 1054 of file PerfMonSvc.cxx.
1056 const INamedInterface* owner =
dynamic_cast<const INamedInterface*
>(iowner);
1059 <<
"Requested to undeclare info from un-registered owner ["
1062 throw std::bad_cast();
1066 <<
"Could not undeclare all infos "
1067 <<
"registered with owner [" << owner <<
" (" << owner->name() <<
")] !"
◆ undeclareInfo()
void PerfMonSvc::undeclareInfo |
( |
const std::string & |
name, |
|
|
const IInterface * |
owner |
|
) |
| |
|
overridevirtual |
Undeclare monitoring information.
- Parameters
-
name | Monitoring information name knwon to the external system |
owner | Owner identifier of the monitoring information |
Implements IPerfMonSvc.
Definition at line 1035 of file PerfMonSvc.cxx.
1038 const INamedInterface* owner =
dynamic_cast<const INamedInterface*
>(iowner);
1041 <<
"Requested to undeclare info from un-registered owner ["
1044 throw std::bad_cast();
1048 <<
"Could not find nor erase MonInfo of name [" <<
name <<
"] "
1049 <<
"registered with owner [" << owner <<
" (" << owner->name() <<
")] !"
◆ SvcFactory< PerfMonSvc >
◆ m_10evtVmem
float PerfMonSvc::m_10evtVmem |
|
private |
◆ m_chrono
handle to the chronostat service
Definition at line 262 of file PerfMonSvc.h.
◆ m_compBeginEvent
Gaudi::Property<std::string> PerfMonSvc::m_compBeginEvent |
|
private |
Initial value:{
this, "compBeginEvent", "AthMasterSeq", "Component name that'll trigger begin event" }
Definition at line 368 of file PerfMonSvc.h.
◆ m_compEndEvent
Gaudi::Property<std::string> PerfMonSvc::m_compEndEvent |
|
private |
Initial value:{
this, "compEndEvent", "AthMasterSeq", "Component name that'll trigger end event" }
Definition at line 372 of file PerfMonSvc.h.
◆ m_corrector
◆ m_deltaVMemAlert
DoubleProperty PerfMonSvc::m_deltaVMemAlert |
|
private |
Maximum allowed variation of virtual memory (in bytes) between last print-out and current vmem value, before triggering a new print-out.
Definition at line 266 of file PerfMonSvc.h.
◆ m_enableDblCountingCorrection
BooleanProperty PerfMonSvc::m_enableDblCountingCorrection |
|
private |
switch to enable or not the on-the-fly double-counting correction
Definition at line 281 of file PerfMonSvc.h.
◆ m_extraPrintouts
bool PerfMonSvc::m_extraPrintouts |
|
private |
◆ m_firstVmem
float PerfMonSvc::m_firstVmem |
|
private |
◆ m_ioContainerNames
StringArrayProperty PerfMonSvc::m_ioContainerNames |
|
private |
List of containers for which one wants to gather I/O data.
If empty list, no I/O data will be collected (except the overall 'commitOutput' timing)
Definition at line 275 of file PerfMonSvc.h.
◆ m_jobStartJiffies
std::string PerfMonSvc::m_jobStartJiffies |
|
private |
◆ m_lastVmem
float PerfMonSvc::m_lastVmem |
|
private |
◆ m_monLvl
level of granularity for monitoring
Definition at line 284 of file PerfMonSvc.h.
◆ m_monState
◆ m_nalgs
std::size_t PerfMonSvc::m_nalgs |
|
private |
number of algorithms the monitored job ran
Definition at line 324 of file PerfMonSvc.h.
◆ m_nevts
number of events processed during the monitored job
Definition at line 321 of file PerfMonSvc.h.
◆ m_ntuple
tuple of data (step->component[name->perf-data])
Definition at line 299 of file PerfMonSvc.h.
◆ m_outFileName
StringProperty PerfMonSvc::m_outFileName |
|
private |
Name of the output file to hold performance data.
Definition at line 278 of file PerfMonSvc.h.
◆ m_pf
◆ m_pmonsd
◆ m_profiledAlgNames
StringArrayProperty PerfMonSvc::m_profiledAlgNames |
|
private |
List of algorithms to be profiled.
If empty list, all the algorithms known to the ApplicationMgr are taken.
Definition at line 270 of file PerfMonSvc.h.
◆ m_pySvc
Pointer to the PyObject
doing the real work.
Definition at line 259 of file PerfMonSvc.h.
◆ m_semiDetMonLvl
int PerfMonSvc::m_semiDetMonLvl |
|
private |
Level of semi-detailed monitoring.
Definition at line 290 of file PerfMonSvc.h.
◆ m_shelveFileName
StringProperty PerfMonSvc::m_shelveFileName |
|
private |
Name of the shelve file containing jobo metadata.
Definition at line 287 of file PerfMonSvc.h.
◆ m_stats
◆ m_stream
pmon-stream data file descriptor
Definition at line 315 of file PerfMonSvc.h.
◆ m_vmemfit_evt101plus
◆ m_vmemfit_evt21to100
◆ m_vmemfit_evt2to20
◆ m_workerDir
std::string PerfMonSvc::m_workerDir |
|
private |
The documentation for this class was generated from the following files:
StringProperty m_shelveFileName
Name of the shelve file containing jobo metadata.
DoubleProperty m_deltaVMemAlert
Maximum allowed variation of virtual memory (in bytes) between last print-out and current vmem value,...
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
std::string m_jobStartJiffies
(needed as a property to survive athena.py –drop-and-reload
void setMonState(PerfMon::State::Type step)
set the current state of the Gaudi's FSM
std::unordered_map< std::string, IoCompStore_t > IoCompTuple_t
BooleanProperty m_enableDblCountingCorrection
switch to enable or not the on-the-fly double-counting correction
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,...
void throw_py_exception(bool display=true)
helper function to capture the boilerplate code for user friendly stack trace display
void addPoint(const double &, const double &)
StatusCode makeAuditor(const std::string &audName, IAuditorSvc *audSvc, MsgStream &msg)
simple function to factorize boring things such as asking the AuditorSvc if an auditor is there (and ...
Gaudi::Property< std::string > m_compBeginEvent
void stopAud(const std::string &stepName, const std::string &compName) override
Stop collecting monitoring data for a given component, for a given step of the Gaudi FSM.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
PMonSD::SemiDetHelper * m_pmonsd
void comp_startAud(const std::string &stepName, const std::string &compName)
start collection monitoring cpu+mem data for a given component
bool msgLvl(const MSG::Level lvl) const
int m_semiDetMonLvl
Level of semi-detailed monitoring.
PerfMon::State::Type m_monState
current state of the Gaudi's FSM
long m_nevts
number of events processed during the monitored job
void startAud(const std::string &stepName, const std::string &compName) override
Start collecting monitoring data for a given component, for a given step of the Gaudi FSM.
void poll()
loop over user-declared variables (via the IMonitorSvc interface) and poll the data
ServiceHandle< IChronoStatSvc > m_chrono
handle to the chronostat service
virtual void domain(const std::string &compName, std::string &domain) const override
retrieve the domain name for a given component compName
void startAud(const std::string &stepName, const std::string &compName, unsigned val_nevts)
std::unordered_map< std::string, CompStore_t > CompTuple_t
PyObject * m_pySvc
Pointer to the PyObject doing the real work.
float m_firstVmem
first event vmem
int ath_dso_cbk_register(ath_dso_event_cbk_t cbk, void *userdata)
std::pair< std::vector< unsigned int >, bool > res
StringProperty m_outFileName
Name of the output file to hold performance data.
PerfMon::LinFitSglPass m_vmemfit_evt101plus
void setupIoContainerList(Gaudi::Details::PropertyBase &ioContainerNames)
callback to synchronize the list of I/O containers to be monitored
StringArrayProperty m_ioContainerNames
List of containers for which one wants to gather I/O data.
StringArrayProperty m_profiledAlgNames
List of algorithms to be profiled.
PerfMon::LinFitSglPass m_vmemfit_evt21to100
int m_stream
pmon-stream data file descriptor
void setupProfiledAlgList(Gaudi::Details::PropertyBase &profiledAlgNames)
callback to synchronize the list of algorithms to be profiled
float m_10evtVmem
10th-event vmem
float m_lastVmem
last event vmem
void comp_stopAud(const std::string &stepName, const std::string &compName)
stop collection monitoring cpu+mem data for a given component
std::string m_workerDir
Worker directory in athenaMP.
#define ATH_MSG_WARNING(x)
PerfMon::LinFitSglPass m_vmemfit_evt2to20
void get_vmem_rss_kb(double &vmem, double &rss, bool vmemonly=false)
Gaudi::Property< std::string > m_compEndEvent
void do_io_mon()
collect I/O monitoring data
PerfMon::Tuple::CompStore_t CompStore_t
void stopAud(const std::string &stepName, const std::string &compName, unsigned val_nevts)
PerfMon::Tuple::IoCompStore_t IoCompStore_t
bool report(const std::string &file, const std::string &info_full_output_inside, bool stdout_uncollapsed)
int m_monLvl
level of granularity for monitoring
std::size_t m_nalgs
number of algorithms the monitored job ran
std::vector< std::string > components(PerfMon::State::Type step) const
return the list of components' names for a given step
static const InterfaceID & interfaceID()
PerfMon::Tuple m_ntuple
tuple of data (step->component[name->perf-data])