![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
#include <SemiDetHelper.h>
|
| SemiDetHelper (const SemiDetHelper &) |
|
SemiDetHelper & | operator= (const SemiDetHelper &) |
|
void | reportToStdout (const std::string &info_full_output_inside, bool showall) |
|
bool | reportToFile (const std::string &file, const std::string &info_full_output_inside) |
|
void | startAudStd (const std::string &compName, int stepidx) |
|
void | stopAudStd (const std::string &compName, int stepidx, unsigned val_nevts) |
|
void | startAudOther (const std::string &compName, const std::string &stepName) |
|
void | stopAudOther (const std::string &compName, const std::string &stepName) |
|
void | startAudFinishUp (CompDataBasic *) |
|
CompDataStdSteps * | findStdData (const std::string &compName, int stepidx) |
|
void | specialAud (int stepidx, unsigned val_nevts) |
|
void | finalise () |
|
template<class Tmap > |
Tmap::mapped_type & | mapLookup (const typename Tmap::key_type &key, Tmap &m, typename Tmap::iterator &cached_iterator) const |
|
void | actualReport (std::ostream &, bool showall, const std::string &info_full_output_inside) |
|
void | format (std::ostream &os, const std::string &stepName, const std::string &compName, const CompDataBasic *, bool normal_as_extended=false) const |
|
void | format (std::ostream &, const std::string &str, bool center=true) const |
|
void | format (std::ostream &, const std::string &stepName, const std::string &infoName, const Meas &) const |
|
void | format (std::ostream &, const std::string &stepName, const std::string &infoName, const PerfMon::LinFitSglPass &fit_vmem, const PerfMon::LinFitSglPass &fit_malloc) const |
|
void | processStep (std::ostream &os, StepWrapper *, bool showall) const |
|
void | field_i (std::ostream &os, unsigned width, int64_t val, bool leftjustify=false) const |
|
void | field_f (std::ostream &os, unsigned width, double val, bool leftjustify=false) const |
|
void | spaces (std::ostream &os, unsigned n) const |
|
void | colheader (std::ostream &os, StepWrapper *sw) const |
|
void | checkForMallocSlowness (int stepidx) |
|
Definition at line 50 of file SemiDetHelper.h.
◆ SemiDetHelper() [1/2]
PMonSD::SemiDetHelper::SemiDetHelper |
( |
const std::string & |
jobStartJiffies = "" | ) |
|
Definition at line 26 of file SemiDetHelper.cxx.
56 {
delete[]
new char[11];
delete[]
new char[117];
delete[]
new char[17];}
59 if (!jobStartJiffies.empty()) {
69 double m0=get_malloc_kb();
char *
volatile c =
new char[1024];
double m1=get_malloc_kb();
delete[]
c;
73 std::cout<<
m_prefix<<
"WARNING Can't retrieve Malloc information in this setup.";
75 std::cout<<
" This is likely because mallinfo is in a different lib than malloc.";
78 #if __GLIBC__<=2 && __GLIBC_MINOR__<=5
86 #if DEBUG_SemiDetHelper
◆ ~SemiDetHelper()
PMonSD::SemiDetHelper::~SemiDetHelper |
( |
| ) |
|
|
inline |
◆ SemiDetHelper() [2/2]
◆ actualReport()
void PMonSD::SemiDetHelper::actualReport |
( |
std::ostream & |
os, |
|
|
bool |
showall, |
|
|
const std::string & |
info_full_output_inside |
|
) |
| |
|
private |
Definition at line 646 of file SemiDetHelper.cxx.
648 boost::io::ios_base_all_saver ssave (
os);
650 #if DEBUG_SemiDetHelper
657 format(
os,showall?
"semi-detailed perfmon info v1.0f / start"
658 :
"semi-detailed perfmon info v1.0c / start");
659 format(
os,
"Documentation: https://twiki.cern.ch/twiki/bin/viewauth/Atlas/PerfMonSD",
false);
660 format(
os,
"Note that documentation includes recipe for easy parsing from python. ",
false);
661 format(
os,
"Units are milliseconds (cpu/wall) and kilobytes (vmem/malloc). ",
false);
662 if (!info_full_output_inside.empty()) {
663 const unsigned cw(71);
664 std::string
s;
s.reserve(cw);
665 s.clear();
s+=
"Full output inside: ";
s+=info_full_output_inside;
666 while (
s.size()<cw)
s+=
" ";
677 std::set<std::string> othersteps;
679 for (;it_other!=it_other_E;++it_other)
680 othersteps.insert((*it_other).first.second);
683 std::set<std::string>::const_iterator it_other_stepname(othersteps.begin()),it_other_stepnameE(othersteps.end());
684 for (;it_other_stepname!=it_other_stepnameE;++it_other_stepname) {
704 unsigned evtloop_n(0), overhead_n(0);
705 double evtloop_cpu(0.),evtloop_wall(0.), overhead_cpu(0.), overhead_wall(0.);
706 double internalcpu_evtloop(0),internalcpu_onceperjob(0);
723 os<<
" ";
field_f(
os,8,evtloop_wall);
os<<
" - - evtloop_time\n";
725 os<<
" ";
field_f(
os,8,overhead_wall);
os<<
" - - overhead_time\n";
740 <<
" release="<<
envvar(
"AtlasVersion",
"unknown_release")<<
"/"<<
envvar(
"CMTCONFIG",
"unknown_cmtconfig")<<
"\n";
743 <<
" pycintex_vmemfix="<<
envvar(
"ATHENA_PYCINTEX_MINVMEM",
"0")<<
"\n";
744 os<<
m_prefix<<
"["<<
s<<
"] pmonsd_cost_onceperjob="<<
int(0.5+internalcpu_onceperjob)
745 <<
" pmonsd_cost_perevt="<<
int(0.5+internalcpu_evtloop)<<
"\n";
747 #if DEBUG_SemiDetHelper
750 os<<
m_prefix<<
"Own resource consumption ["<<m_debug_data.nEntries()
751 <<
" calls]: <cpu> [ms]="<<m_debug_data.meanDeltaCPU()
752 <<
", total memory usage[kb]~="<<m_debug_data.meanDeltaMalloc()*m_debug_data.nEntries()
753 <<
", total memory usage vmem [kb]~="<<m_debug_data.meanDeltaVMEM()*m_debug_data.nEntries()
754 <<
", #map lookups="<<m_debug_nfinds
755 <<
", #map inserts="<<m_debug_ninserts
758 format(
os,
"semi-detailed perfmon info / end");
◆ checkForMallocSlowness()
void PMonSD::SemiDetHelper::checkForMallocSlowness |
( |
int |
stepidx | ) |
|
|
private |
Definition at line 222 of file SemiDetHelper.cxx.
232 std::cout<<
m_prefix<<
"WARNING Malloc information gathering becoming slow. Disabling."<<std::endl;
◆ colheader()
void PMonSD::SemiDetHelper::colheader |
( |
std::ostream & |
os, |
|
|
StepWrapper * |
sw |
|
) |
| const |
|
private |
Definition at line 447 of file SemiDetHelper.cxx.
450 if (sw&&
dynamic_cast<const CompDataExtended*
>(sw->getExampleData())) {
453 os<<
" n cpu max@evt vmem max@evt malloc max@evt component\n";
458 os<<
" cpu wall vmem malloc component";
460 os<<
" cpu vmem malloc component";
◆ field_f()
void PMonSD::SemiDetHelper::field_f |
( |
std::ostream & |
os, |
|
|
unsigned |
width, |
|
|
double |
val, |
|
|
bool |
leftjustify = false |
|
) |
| const |
|
inlineprivate |
◆ field_i()
void PMonSD::SemiDetHelper::field_i |
( |
std::ostream & |
os, |
|
|
unsigned |
width, |
|
|
int64_t |
val, |
|
|
bool |
leftjustify = false |
|
) |
| const |
|
inlineprivate |
Definition at line 167 of file SemiDetHelper.h.
173 boost::io::ios_base_all_saver ssave (
os);
174 os << (leftjustify?std::left:std::right) << std::setw(
width) <<
val;
◆ finalise()
void PMonSD::SemiDetHelper::finalise |
( |
| ) |
|
|
private |
◆ findStdData()
◆ format() [1/4]
void PMonSD::SemiDetHelper::format |
( |
std::ostream & |
os, |
|
|
const std::string & |
stepName, |
|
|
const std::string & |
infoName, |
|
|
const Meas & |
m |
|
) |
| const |
|
private |
◆ format() [2/4]
◆ format() [3/4]
void PMonSD::SemiDetHelper::format |
( |
std::ostream & |
os, |
|
|
const std::string & |
str, |
|
|
bool |
center = true |
|
) |
| const |
|
private |
Definition at line 427 of file SemiDetHelper.cxx.
429 const unsigned width(80);
433 unsigned nright=nleft;
438 if ((nleft+nright+
str.size())<
width)
442 for (
unsigned i=0;
i<nleft;++
i)
os<<
"=";
444 for (
unsigned i=0;
i<nright;++
i)
os<<
"=";
◆ format() [4/4]
void PMonSD::SemiDetHelper::format |
( |
std::ostream & |
os, |
|
|
const std::string & |
stepName, |
|
|
const std::string & |
compName, |
|
|
const CompDataBasic * |
data, |
|
|
bool |
normal_as_extended = false |
|
) |
| const |
|
private |
Definition at line 383 of file SemiDetHelper.cxx.
389 const CompDataExtended* data_e =
dynamic_cast<const CompDataExtended*
>(
data);
393 os<<
" ";
field_f(
os,6,data_e->meanDeltaCPU(),
false);
395 os<<
"@";
field_i(
os,4,data_e->maxDeltaCPU_iEntry(),
true);
396 os<<
" ";
field_f(
os,6,data_e->meanDeltaVMEM(),
false);
397 os<<
" ";
field_f(
os,6,data_e->maxDeltaVMEM(),
false);
398 os<<
"@";
field_i(
os,4,data_e->maxDeltaVMEM_iEntry(),
true);
399 os<<
" ";
field_f(
os,6,data_e->meanDeltaMalloc(),
false);
400 os<<
" ";
field_f(
os,6,data_e->maxDeltaMalloc(),
false);
401 os<<
"@";
field_i(
os,4,data_e->maxDeltaMalloc_iEntry(),
true);
405 if (normal_as_extended) {
os <<
" "; }
407 if (normal_as_extended) {
os <<
" "; }
409 if (normal_as_extended) {
os <<
" "; }
◆ mapLookup()
template<class Tmap >
Tmap::mapped_type& PMonSD::SemiDetHelper::mapLookup |
( |
const typename Tmap::key_type & |
key, |
|
|
Tmap & |
m, |
|
|
typename Tmap::iterator & |
cached_iterator |
|
) |
| const |
|
inlineprivate |
Definition at line 131 of file SemiDetHelper.h.
134 if (cached_iterator==
m.end()||(*cached_iterator).first!=
key) {
135 cached_iterator=
m.find(
key);
136 #if DEBUG_SemiDetHelper
139 if (cached_iterator==
m.end()) {
140 std::pair<typename Tmap::iterator,bool>
r
141 =
m.insert(std::pair<typename Tmap::key_type,typename Tmap::mapped_type>(
key,
typename Tmap::mapped_type()));
143 cached_iterator=
r.first;
144 #if DEBUG_SemiDetHelper
149 return (*cached_iterator).second;
◆ operator=()
◆ processStep()
void PMonSD::SemiDetHelper::processStep |
( |
std::ostream & |
os, |
|
|
StepWrapper * |
sw, |
|
|
bool |
showall |
|
) |
| const |
|
private |
Definition at line 520 of file SemiDetHelper.cxx.
525 unsigned collapse_limit=6;
526 double showfraction=1.0;
528 if (sw->stepName()==
"evt") showfraction=0.99;
529 else if (sw->stepName()==
"dso") showfraction=0.25;
530 else showfraction=0.8;
533 const std::string ignore_name(
"PerfMonSlice");
539 float totals_sortvals[nvals];
544 totals[
ival]=totals_sortvals[
ival]=0.0;
547 const CompDataBasic *
data(0);
549 bool hasentry(
false);
551 if (*
compName==ignore_name)
continue;
552 if (
data->nEntries()==0)
continue;
573 double sum(0.0),
limit(showfraction*totals_sortvals[
ival]);
577 double v=
it->data->sortVal(
ival);
583 if (!
it->displayed())
584 it->setCollapsed(
it->data->nEntries());
591 std::map<unsigned,Count> collapse_count;
595 if (!
it->displayed())
596 mapLookup(
it->data->nEntries(),collapse_count,collapse_count_cache).val += 1;
599 if (!
it->displayed()&&collapse_count[
it->data->nEntries()].val<collapse_limit)
613 std::map<unsigned,CompDataBasic> collapse_map,totals_map;
617 unsigned n(
it->data->nEntries());
618 CompDataBasic& data_total =
mapLookup(
n,totals_map,it_totals_cache);
619 data_total.add(*(
it->data));
620 if (
it->displayed()) {
624 CompDataBasic& data_collapse =
mapLookup(
n,collapse_map,it_collapse_cache);
625 data_collapse.add(*(
it->data));
630 it_summary=collapse_map.begin();it_summaryE=collapse_map.end();
631 for (;it_summary!=it_summaryE;++it_summary) {
633 s<<
"[collapsed_"<<it_summary->second.nEntries()<<
"_comps]";
634 it_summary->second.setEntries(it_summary->first);
635 format(
os,sw->stepName(),
s.str(),&it_summary->second,sw->extended());
637 it_summary=totals_map.begin();it_summaryE=totals_map.end();
638 for (;it_summary!=it_summaryE;++it_summary) {
640 s<<
"[total_for_"<<it_summary->second.nEntries()<<
"_comps]";
641 it_summary->second.setEntries(it_summary->first);
642 format(
os,sw->stepName(),
s.str(),&it_summary->second,sw->extended());
◆ report()
bool PMonSD::SemiDetHelper::report |
( |
const std::string & |
file, |
|
|
const std::string & |
info_full_output_inside, |
|
|
bool |
stdout_uncollapsed |
|
) |
| |
◆ reportToFile()
bool PMonSD::SemiDetHelper::reportToFile |
( |
const std::string & |
file, |
|
|
const std::string & |
info_full_output_inside |
|
) |
| |
|
private |
Definition at line 317 of file SemiDetHelper.cxx.
323 f.open(
file.c_str());
324 if (!
f.fail()&&
f.is_open()) {
331 std::cout<<
m_prefix<<
"WARNING Could not write output to file: "<<
file<<std::endl;
◆ reportToStdout()
void PMonSD::SemiDetHelper::reportToStdout |
( |
const std::string & |
info_full_output_inside, |
|
|
bool |
showall |
|
) |
| |
|
private |
◆ spaces()
void PMonSD::SemiDetHelper::spaces |
( |
std::ostream & |
os, |
|
|
unsigned |
n |
|
) |
| const |
|
inlineprivate |
◆ specialAud()
void PMonSD::SemiDetHelper::specialAud |
( |
int |
stepidx, |
|
|
unsigned |
val_nevts |
|
) |
| |
|
private |
◆ startAud()
void PMonSD::SemiDetHelper::startAud |
( |
const std::string & |
stepName, |
|
|
const std::string & |
compName, |
|
|
unsigned |
val_nevts |
|
) |
| |
Definition at line 93 of file SemiDetHelper.cxx.
95 #if DEBUG_SemiDetHelper
96 m_debug_meas.capture(
false);
97 m_debug_data.addPointStart(m_debug_meas);
117 #if DEBUG_SemiDetHelper
118 m_debug_meas.capture(
true);
119 m_debug_data.addPointStop(m_debug_meas);
◆ startAudFinishUp()
void PMonSD::SemiDetHelper::startAudFinishUp |
( |
CompDataBasic * |
data | ) |
|
|
private |
◆ startAudOther()
void PMonSD::SemiDetHelper::startAudOther |
( |
const std::string & |
compName, |
|
|
const std::string & |
stepName |
|
) |
| |
|
private |
◆ startAudStd()
void PMonSD::SemiDetHelper::startAudStd |
( |
const std::string & |
compName, |
|
|
int |
stepidx |
|
) |
| |
|
private |
Definition at line 167 of file SemiDetHelper.cxx.
170 CompDataBasic *
data;
179 [[maybe_unused]]
static const bool first = [&]() {
183 { std::string
dummy(
"libstringspy_trigger_report"); }
184 {
delete[]
new char[13];
delete[]
new char[117];
delete[]
new char[17]; }
193 data=&(
d->data[stepidx]);
◆ stopAud()
void PMonSD::SemiDetHelper::stopAud |
( |
const std::string & |
stepName, |
|
|
const std::string & |
compName, |
|
|
unsigned |
val_nevts |
|
) |
| |
Definition at line 123 of file SemiDetHelper.cxx.
125 #if DEBUG_SemiDetHelper
126 m_debug_meas.capture(
false);
127 m_debug_data.addPointStart(m_debug_meas);
146 #if DEBUG_SemiDetHelper
147 m_debug_meas.capture(
true);
148 m_debug_data.addPointStop(m_debug_meas);
◆ stopAudOther()
void PMonSD::SemiDetHelper::stopAudOther |
( |
const std::string & |
compName, |
|
|
const std::string & |
stepName |
|
) |
| |
|
private |
◆ stopAudStd()
void PMonSD::SemiDetHelper::stopAudStd |
( |
const std::string & |
compName, |
|
|
int |
stepidx, |
|
|
unsigned |
val_nevts |
|
) |
| |
|
private |
◆ m_cfg_walltime
double PMonSD::SemiDetHelper::m_cfg_walltime |
|
private |
◆ m_data_other
◆ m_data_other_lastlookup
MapOtherSteps::iterator PMonSD::SemiDetHelper::m_data_other_lastlookup |
|
private |
◆ m_data_std
◆ m_data_std_lastlookup
MapStdSteps::iterator PMonSD::SemiDetHelper::m_data_std_lastlookup |
|
private |
◆ m_fit_101plus_malloc
◆ m_fit_101plus_vmem
◆ m_fit_11to100_malloc
◆ m_fit_11to100_vmem
◆ m_last_nevts
unsigned PMonSD::SemiDetHelper::m_last_nevts |
|
private |
◆ m_last_stepidx
int PMonSD::SemiDetHelper::m_last_stepidx |
|
private |
◆ m_malloc_might_get_slow
bool PMonSD::SemiDetHelper::m_malloc_might_get_slow |
|
private |
◆ m_malloc_status
std::string PMonSD::SemiDetHelper::m_malloc_status |
|
private |
◆ m_malloclibname
const std::string PMonSD::SemiDetHelper::m_malloclibname |
|
private |
◆ m_meas
Meas PMonSD::SemiDetHelper::m_meas |
|
private |
◆ m_meas_post_1stevt
Meas PMonSD::SemiDetHelper::m_meas_post_1stevt |
|
private |
◆ m_meas_post_fin
Meas PMonSD::SemiDetHelper::m_meas_post_fin |
|
private |
◆ m_meas_post_ini
Meas PMonSD::SemiDetHelper::m_meas_post_ini |
|
private |
◆ m_meas_post_lastevt
Meas PMonSD::SemiDetHelper::m_meas_post_lastevt |
|
private |
◆ m_meas_pre_ini
Meas PMonSD::SemiDetHelper::m_meas_pre_ini |
|
private |
◆ m_need_finalise
bool PMonSD::SemiDetHelper::m_need_finalise |
|
private |
◆ m_nevts
unsigned PMonSD::SemiDetHelper::m_nevts |
|
private |
◆ m_nevts_sum
unsigned PMonSD::SemiDetHelper::m_nevts_sum |
|
private |
◆ m_overhead_cpu_n
unsigned PMonSD::SemiDetHelper::m_overhead_cpu_n |
|
private |
◆ m_overhead_cpu_snapshot_post_1stevt
double PMonSD::SemiDetHelper::m_overhead_cpu_snapshot_post_1stevt |
|
private |
◆ m_overhead_cpu_snapshot_post_lastevt
double PMonSD::SemiDetHelper::m_overhead_cpu_snapshot_post_lastevt |
|
private |
◆ m_overhead_cpu_tmp
double PMonSD::SemiDetHelper::m_overhead_cpu_tmp |
|
private |
◆ m_overhead_cpu_total
double PMonSD::SemiDetHelper::m_overhead_cpu_total |
|
private |
◆ m_prefix
const std::string PMonSD::SemiDetHelper::m_prefix |
|
private |
◆ m_rss_sum_evtloop
double PMonSD::SemiDetHelper::m_rss_sum_evtloop |
|
private |
◆ m_specialstep
const std::string PMonSD::SemiDetHelper::m_specialstep |
|
private |
◆ m_starttime
std::string PMonSD::SemiDetHelper::m_starttime |
|
private |
◆ m_stepprefix
const std::string PMonSD::SemiDetHelper::m_stepprefix |
|
private |
◆ m_tmp_otherkey
OtherKey PMonSD::SemiDetHelper::m_tmp_otherkey |
|
private |
◆ m_tmpstr
std::string PMonSD::SemiDetHelper::m_tmpstr |
|
private |
◆ m_vmem_sum_evtloop
double PMonSD::SemiDetHelper::m_vmem_sum_evtloop |
|
private |
◆ m_vmpeak
double PMonSD::SemiDetHelper::m_vmpeak |
|
private |
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
unsigned m_overhead_cpu_n
char data[hepevt_bytes_allocation_ATLAS]
double m_overhead_cpu_snapshot_post_1stevt
void specialAud(int stepidx, unsigned val_nevts)
void setUTCTimeString(std::string &s, double offset_ms=0)
void addPoint(const double &, const double &)
double get_absolute_wall_ms()
PerfMon::LinFitSglPass m_fit_101plus_vmem
static constexpr int index_fin
static constexpr int index_evt
static constexpr int index_other
void field_i(std::ostream &os, unsigned width, int64_t val, bool leftjustify=false) const
static constexpr int index_1st
CompDataStdSteps * findStdData(const std::string &compName, int stepidx)
double m_vmem_sum_evtloop
void colheader(std::ostream &os, StepWrapper *sw) const
const std::string m_prefix
void spaces(std::ostream &os, unsigned n) const
const char * envvar(const char *e, const char *def="")
double jobstart_jiffy2unix_ms(const std::string &s)
void incrementOffsets(double pvmem, double pmalloc, double pcpu, double pwall=0)
bool mallocDisabled() const
void processStep(std::ostream &os, StepWrapper *, bool showall) const
Tmap::mapped_type & mapLookup(const typename Tmap::key_type &key, Tmap &m, typename Tmap::iterator &cached_iterator) const
double m_overhead_cpu_snapshot_post_lastevt
void startAudStd(const std::string &compName, int stepidx)
void field_f(std::ostream &os, unsigned width, double val, bool leftjustify=false) const
const char * symb2lib(const char *symbol, const char *failstr="unknown")
void reportToStdout(const std::string &info_full_output_inside, bool showall)
const std::string m_stepprefix
MapOtherSteps m_data_other
bool reportToFile(const std::string &file, const std::string &info_full_output_inside)
const std::string m_specialstep
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
static constexpr unsigned nvals
const std::string m_malloclibname
MapStdSteps::iterator m_data_std_lastlookup
void get_vmem_rss_kb(double &vmem, double &rss, bool vmemonly=false)
void actualReport(std::ostream &, bool showall, const std::string &info_full_output_inside)
void checkForMallocSlowness(int stepidx)
double m_overhead_cpu_total
std::string m_malloc_status
PerfMon::LinFitSglPass m_fit_101plus_malloc
void stopAudStd(const std::string &compName, int stepidx, unsigned val_nevts)
void startAudFinishUp(CompDataBasic *)
PerfMon::LinFitSglPass m_fit_11to100_vmem
void startAudOther(const std::string &compName, const std::string &stepName)
static int index(const std::string &stepName)
void stopAudOther(const std::string &compName, const std::string &stepName)
void format(std::ostream &os, const std::string &stepName, const std::string &compName, const CompDataBasic *, bool normal_as_extended=false) const
static const unsigned specialsort
MapOtherSteps::iterator m_data_other_lastlookup
bool envvar_is_set(const char *e)
bool m_malloc_might_get_slow
PerfMon::LinFitSglPass m_fit_11to100_malloc
double m_overhead_cpu_tmp