CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
edm::service::SimpleMemoryCheck Class Reference

#include <Memory.h>

Classes

struct  SignificantEvent
 
struct  SignificantModule
 

Public Member Functions

void postBeginJob ()
 
void postEndJob ()
 
void postEventProcessing (const Event &, const EventSetup &)
 
void postFork (unsigned int, unsigned int)
 
void postModule (const ModuleDescription &)
 
void postModuleBeginJob (const ModuleDescription &)
 
void postModuleConstruction (const ModuleDescription &)
 
void postSource ()
 
void postSourceConstruction (const ModuleDescription &)
 
void preEventProcessing (const edm::EventID &, const edm::Timestamp &)
 
void preModule (const ModuleDescription &)
 
void preSourceConstruction (const ModuleDescription &)
 
 SimpleMemoryCheck (const ParameterSet &, ActivityRegistry &)
 
 ~SimpleMemoryCheck ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

typedef std::map< std::string,
SignificantModule
SignificantModulesMap
 

Private Member Functions

void andPrint (const std::string &type, const std::string &mdlabel, const std::string &mdname) const
 
double averageGrowthRate (double current, double past, int count)
 
std::string eventStatOutput (std::string title, SignificantEvent const &e) const
 
void eventStatOutput (std::string title, SignificantEvent const &e, std::map< std::string, std::string > &m) const
 
ProcInfo fetch ()
 
smapsInfo fetchSmaps ()
 
std::string mallOutput (std::string title, size_t const &n) const
 
void openFiles ()
 
double pageSize () const
 
void update ()
 
void updateAndPrint (const std::string &type, const std::string &mdlabel, const std::string &mdname)
 
void updateEventStats (edm::EventID const &e)
 
void updateMax ()
 
void updateModuleMemoryStats (SignificantModule &m, double dv)
 

Private Attributes

ProcInfo a_
 
ProcInfo b_
 
int count_
 
ProcInfocurrent_
 
edm::EventID currentEventID_
 
smapsInfo currentSmaps_
 
SignificantEvent eventDeltaRssT1_
 
SignificantEvent eventDeltaRssT2_
 
SignificantEvent eventDeltaRssT3_
 
SignificantEvent eventL1_
 
SignificantEvent eventL2_
 
SignificantEvent eventM_
 
SignificantEvent eventR1_
 
SignificantEvent eventR2_
 
SignificantEvent eventRssT1_
 
SignificantEvent eventRssT2_
 
SignificantEvent eventRssT3_
 
SignificantEvent eventT1_
 
SignificantEvent eventT2_
 
SignificantEvent eventT3_
 
double growthRateRss_
 
double growthRateVsize_
 
bool jobReportOutputOnly_
 
ProcInfo max_
 
double moduleEntryVsize_
 
SignificantModulesMap modules_
 
bool moduleSummaryRequested_
 
bool monitorPssAndPrivate_
 
int num_to_skip_
 
bool oncePerEventMode_
 
double pg_size_
 
ProcInfoFetcher piFetcher_
 
ProcInfoprevious_
 
bool showMallocInfo_
 
FILE * smapsFile_
 
char * smapsLineBuffer_
 
size_t smapsLineBufferLen_
 

Friends

std::ostream & operator<< (std::ostream &os, SimpleMemoryCheck::SignificantEvent const &se)
 
std::ostream & operator<< (std::ostream &os, SimpleMemoryCheck::SignificantModule const &se)
 
struct SignificantEvent
 
struct SignificantModule
 

Detailed Description

Definition at line 54 of file Memory.h.

Member Typedef Documentation

Definition at line 226 of file Memory.h.

Constructor & Destructor Documentation

edm::service::SimpleMemoryCheck::SimpleMemoryCheck ( const ParameterSet iPS,
ActivityRegistry iReg 
)

Definition at line 113 of file Memory.cc.

References edm::MallocOptionSetter::adjustMallocParams(), edm::MallocOptionSetter::error_message(), edm::MallocOptionSetter::get(), edm::getGlobalOptionSetter(), edm::ParameterSet::getUntrackedParameter(), edm::MallocOptionSetter::hasErrors(), moduleSummaryRequested_, oncePerEventMode_, openFiles(), postBeginJob(), postEndJob(), postEventProcessing(), postFork(), postModule(), postModuleBeginJob(), postModuleConstruction(), postSource(), postSourceConstruction(), preEventProcessing(), preModule(), preSourceConstruction(), edm::MallocOptionSetter::set_mmap_max(), edm::MallocOptionSetter::set_mmap_thr(), edm::MallocOptionSetter::set_top_pad(), edm::MallocOptionSetter::set_trim_thr(), edm::ActivityRegistry::watchPostBeginJob(), edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostForkReacquireResources(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPostModuleBeginJob(), edm::ActivityRegistry::watchPostModuleConstruction(), edm::ActivityRegistry::watchPostProcessEvent(), edm::ActivityRegistry::watchPostSource(), edm::ActivityRegistry::watchPostSourceConstruction(), edm::ActivityRegistry::watchPreModule(), edm::ActivityRegistry::watchPreProcessEvent(), and edm::ActivityRegistry::watchPreSourceConstruction().

115  : a_()
116  , b_()
117  , current_(&a_)
118  , previous_(&b_)
119  , pg_size_(sysconf(_SC_PAGESIZE)) // getpagesize()
120  , num_to_skip_(iPS.getUntrackedParameter<int>("ignoreTotal"))
121  , showMallocInfo_(iPS.getUntrackedParameter<bool>("showMallocInfo"))
122  , oncePerEventMode_(iPS.getUntrackedParameter<bool>("oncePerEventMode"))
123  , jobReportOutputOnly_(iPS.getUntrackedParameter<bool>("jobReportOutputOnly"))
124  , monitorPssAndPrivate_(iPS.getUntrackedParameter<bool>("monitorPssAndPrivate"))
125  , count_()
126  , smapsFile_(0)
129  , growthRateVsize_()
130  , growthRateRss_()
131  , moduleSummaryRequested_(iPS.getUntrackedParameter<bool>("moduleMemorySummary")) {
132  // changelog 2
133  // pg_size = (double)getpagesize();
134  std::ostringstream ost;
135 
136  openFiles();
137  iReg.watchPostForkReacquireResources(this,&SimpleMemoryCheck::postFork);
138 
139  if(!oncePerEventMode_) { // default, prints on increases
140  iReg.watchPreSourceConstruction(this, &SimpleMemoryCheck::preSourceConstruction);
141  iReg.watchPostSourceConstruction(this, &SimpleMemoryCheck::postSourceConstruction);
142  iReg.watchPostSource(this, &SimpleMemoryCheck::postSource);
143  iReg.watchPostModuleConstruction(this, &SimpleMemoryCheck::postModuleConstruction);
144  iReg.watchPostModuleBeginJob(this, &SimpleMemoryCheck::postModuleBeginJob);
145  iReg.watchPostProcessEvent(this, &SimpleMemoryCheck::postEventProcessing);
146  iReg.watchPostModule(this, &SimpleMemoryCheck::postModule);
147  iReg.watchPostBeginJob(this, &SimpleMemoryCheck::postBeginJob);
148  iReg.watchPostEndJob(this, &SimpleMemoryCheck::postEndJob);
149  } else {
150  iReg.watchPostProcessEvent(this, &SimpleMemoryCheck::postEventProcessing);
151  iReg.watchPostEndJob(this, &SimpleMemoryCheck::postEndJob);
152  }
153  if(moduleSummaryRequested_) { // changelog 2
154  iReg.watchPreProcessEvent(this, &SimpleMemoryCheck::preEventProcessing);
155  iReg.watchPreModule(this, &SimpleMemoryCheck::preModule);
156  if(oncePerEventMode_) {
157  iReg.watchPostModule(this, &SimpleMemoryCheck::postModule);
158  }
159  }
160 
161  // The following are not currenty used/implemented below for either
162  // of the print modes (but are left here for reference)
163  // iReg.watchPostBeginJob(this,
164  // &SimpleMemoryCheck::postBeginJob);
165  // iReg.watchPreProcessEvent(this,
166  // &SimpleMemoryCheck::preEventProcessing);
167  // iReg.watchPreModule(this,
168  // &SimpleMemoryCheck::preModule);
169 
170  typedef MallocOpts::opt_type opt_type;
171  MallocOptionSetter& mopts = getGlobalOptionSetter();
172 
173  opt_type
174  p_mmap_max = iPS.getUntrackedParameter<int>("M_MMAP_MAX"),
175  p_trim_thr = iPS.getUntrackedParameter<int>("M_TRIM_THRESHOLD"),
176  p_top_pad = iPS.getUntrackedParameter<int>("M_TOP_PAD"),
177  p_mmap_thr = iPS.getUntrackedParameter<int>("M_MMAP_THRESHOLD");
178 
179  if(p_mmap_max >= 0) mopts.set_mmap_max(p_mmap_max);
180  if(p_trim_thr >= 0) mopts.set_trim_thr(p_trim_thr);
181  if(p_top_pad >= 0) mopts.set_top_pad(p_top_pad);
182  if(p_mmap_thr >= 0) mopts.set_mmap_thr(p_mmap_thr);
183 
184  mopts.adjustMallocParams();
185 
186  if(mopts.hasErrors()) {
187  LogWarning("MemoryCheck")
188  << "ERROR: Problem with setting malloc options\n"
189  << mopts.error_message();
190  }
191 
192  if(iPS.getUntrackedParameter<bool>("dump") == true) {
193  MallocOpts mo = mopts.get();
194  LogWarning("MemoryCheck")
195  << "Malloc options: " << mo << "\n";
196  }
197  }
void postFork(unsigned int, unsigned int)
Definition: Memory.cc:519
void preSourceConstruction(const ModuleDescription &)
Definition: Memory.cc:244
void postModule(const ModuleDescription &)
Definition: Memory.cc:506
#define NULL
Definition: scimark2.h:8
void preModule(const ModuleDescription &)
Definition: Memory.cc:501
void postEventProcessing(const Event &, const EventSetup &)
Definition: Memory.cc:487
void postSourceConstruction(const ModuleDescription &)
Definition: Memory.cc:249
void postModuleBeginJob(const ModuleDescription &)
Definition: Memory.cc:261
void preEventProcessing(const edm::EventID &, const edm::Timestamp &)
Definition: Memory.cc:483
void postModuleConstruction(const ModuleDescription &)
Definition: Memory.cc:257
MallocOptionSetter & getGlobalOptionSetter()
Definition: MallocOpts.cc:217
edm::service::SimpleMemoryCheck::~SimpleMemoryCheck ( )

Definition at line 199 of file Memory.cc.

References smapsFile_, and smapsLineBuffer_.

199  {
200 #ifdef LINUX
201  if(0 != smapsFile_) {
202  fclose(smapsFile_);
203  }
204 #endif
205  if (smapsLineBuffer_) {
206  //getline will create the memory using malloc
207  free(smapsLineBuffer_);
208  }
209  }

Member Function Documentation

void edm::service::SimpleMemoryCheck::andPrint ( const std::string &  type,
const std::string &  mdlabel,
const std::string &  mdname 
) const
private

Definition at line 614 of file Memory.cc.

References count_, current_, jobReportOutputOnly_, max_, num_to_skip_, oncePerEventMode_, edm::service::ProcInfo::rss, showMallocInfo_, and edm::service::ProcInfo::vsize.

Referenced by postEventProcessing(), and updateAndPrint().

615  {
616  if(not jobReportOutputOnly_ && ((*current_ > max_) || oncePerEventMode_)) {
617  if(count_ >= num_to_skip_) {
618  double deltaVSIZE = current_->vsize - max_.vsize;
619  double deltaRSS = current_->rss - max_.rss;
620  if(!showMallocInfo_) { // default
621  LogWarning("MemoryCheck")
622  << "MemoryCheck: " << type << " "
623  << mdname << ":" << mdlabel
624  << " VSIZE " << current_->vsize << " " << deltaVSIZE
625  << " RSS " << current_->rss << " " << deltaRSS
626  << "\n";
627  } else {
628 #ifdef __linux__
629  struct mallinfo minfo = mallinfo();
630 #endif
631  LogWarning("MemoryCheck")
632  << "MemoryCheck: " << type << " "
633  << mdname << ":" << mdlabel
634  << " VSIZE " << current_->vsize << " " << deltaVSIZE
635  << " RSS " << current_->rss << " " << deltaRSS
636 #ifdef __linux__
637  << " HEAP-ARENA [ SIZE-BYTES " << minfo.arena
638  << " N-UNUSED-CHUNKS " << minfo.ordblks
639  << " TOP-FREE-BYTES " << minfo.keepcost << " ]"
640  << " HEAP-MAPPED [ SIZE-BYTES " << minfo.hblkhd
641  << " N-CHUNKS " << minfo.hblks << " ]"
642  << " HEAP-USED-BYTES " << minfo.uordblks
643  << " HEAP-UNUSED-BYTES " << minfo.fordblks
644 #endif
645  << "\n";
646  }
647  }
648  }
649  }
type
Definition: HCALResponse.h:22
double edm::service::SimpleMemoryCheck::averageGrowthRate ( double  current,
double  past,
int  count 
)
private

Definition at line 109 of file Memory.cc.

Referenced by postEndJob().

109  {
110  return(current-past)/(double)count;
111  }
std::string edm::service::SimpleMemoryCheck::eventStatOutput ( std::string  title,
SignificantEvent const &  e 
) const
private

Referenced by postEndJob().

void edm::service::SimpleMemoryCheck::eventStatOutput ( std::string  title,
SignificantEvent const &  e,
std::map< std::string, std::string > &  m 
) const
private

Definition at line 660 of file Memory.cc.

References edm::service::SimpleMemoryCheck::SignificantEvent::count, edm::service::d2str(), edm::service::SimpleMemoryCheck::SignificantEvent::deltaVsize, edm::EventID::event(), edm::service::SimpleMemoryCheck::SignificantEvent::event, edm::service::i2str(), monitorPssAndPrivate_, edm::service::SimpleMemoryCheck::SignificantEvent::privateSize, edm::service::SimpleMemoryCheck::SignificantEvent::pss, edm::service::SimpleMemoryCheck::SignificantEvent::rss, edm::EventID::run(), and edm::service::SimpleMemoryCheck::SignificantEvent::vsize.

662  {
663  { std::ostringstream os;
664  os << title << "-a-COUNT";
665  m.insert(std::make_pair(os.str(), i2str(e.count))); }
666  { std::ostringstream os;
667  os << title << "-b-RUN";
668  m.insert(std::make_pair(os.str(), d2str(static_cast<double>(e.event.run())))); }
669  { std::ostringstream os;
670  os << title << "-c-EVENT";
671  m.insert(std::make_pair(os.str(), d2str(static_cast<double>(e.event.event())))); }
672  { std::ostringstream os;
673  os << title << "-d-VSIZE";
674  m.insert(std::make_pair(os.str(), d2str(e.vsize))); }
675  { std::ostringstream os;
676  os << title << "-e-DELTV";
677  m.insert(std::make_pair(os.str(), d2str(e.deltaVsize))); }
678  { std::ostringstream os;
679  os << title << "-f-RSS";
680  m.insert(std::make_pair(os.str(), d2str(e.rss))); }
681  if (monitorPssAndPrivate_) {
682  { std::ostringstream os;
683  os << title << "-g-PRIVATE";
684  m.insert(std::make_pair(os.str(), d2str(e.privateSize))); }
685  { std::ostringstream os;
686  os << title << "-h-PSS";
687  m.insert(std::make_pair(os.str(), d2str(e.pss))); }
688  }
689  } // eventStatOutput
static std::string i2str(int i)
Definition: Memory.cc:65
static std::string d2str(double d)
Definition: Memory.cc:59
ProcInfo edm::service::SimpleMemoryCheck::fetch ( )
private

Definition at line 71 of file Memory.cc.

References edm::service::ProcInfoFetcher::fetch(), and piFetcher_.

Referenced by update().

71  {
72  return piFetcher_.fetch();
73  }
ProcInfoFetcher piFetcher_
Definition: Memory.h:102
smapsInfo edm::service::SimpleMemoryCheck::fetchSmaps ( )
private

Definition at line 75 of file Memory.cc.

References edm::service::smapsInfo::private_, edm::service::smapsInfo::pss_, SiPixelLorentzAngle_cfi::read, run_regression::ret, smapsFile_, smapsLineBuffer_, smapsLineBufferLen_, and relativeConstraints::value.

Referenced by postEventProcessing().

75  {
76  smapsInfo ret;
77  ret.private_ = 0;
78  ret.pss_ = 0;
79 #ifdef LINUX
80  fseek(smapsFile_, 0, SEEK_SET);
81  ssize_t read;
82 
83  /*
84  The format of the report is
85  Private_Clean: 0 kB
86  Private_Dirty: 72 kB
87  Swap: 0 kB
88  Pss: 72 kB
89  */
90 
91  while ((read = getline(&smapsLineBuffer_, &smapsLineBufferLen_, smapsFile_)) != -1) {
92  if(read > 14) {
93  //Private
94  if(0==strncmp("Private_",smapsLineBuffer_,8)) {
95  unsigned int value = atoi(smapsLineBuffer_+14);
96  //Convert from kB to MB
97  ret.private_ += static_cast<double>(value)/1024.;
98  } else if(0==strncmp("Pss:",smapsLineBuffer_,4)) {
99  unsigned int value = atoi(smapsLineBuffer_+4);
100  //Convert from kB to MB
101  ret.pss_ += static_cast<double>(value)/1024.;
102  }
103  }
104  }
105 #endif
106  return ret;
107  }
void edm::service::SimpleMemoryCheck::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 211 of file Memory.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::addUntracked().

211  {
213  desc.addUntracked<int>("ignoreTotal", 1);
214  desc.addUntracked<bool>("showMallocInfo", false);
215  desc.addUntracked<bool>("oncePerEventMode", false);
216  desc.addUntracked<bool>("jobReportOutputOnly", false);
217  desc.addUntracked<bool>("monitorPssAndPrivate", false);
218  desc.addUntracked<bool>("moduleMemorySummary", false);
219  desc.addUntracked<int>("M_MMAP_MAX", -1);
220  desc.addUntracked<int>("M_TRIM_THRESHOLD", -1);
221  desc.addUntracked<int>("M_TOP_PAD", -1);
222  desc.addUntracked<int>("M_MMAP_THRESHOLD", -1);
223  desc.addUntracked<bool>("dump", false);
224  descriptions.add("SimpleMemoryCheck", desc);
225  }
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::string edm::service::SimpleMemoryCheck::mallOutput ( std::string  title,
size_t const &  n 
) const
private

Referenced by postEndJob().

void edm::service::SimpleMemoryCheck::openFiles ( )
private

Definition at line 227 of file Memory.cc.

References edm::errors::Configuration, edm::hlt::Exception, monitorPssAndPrivate_, and smapsFile_.

Referenced by postFork(), and SimpleMemoryCheck().

227  {
228 #ifdef LINUX
229  if (monitorPssAndPrivate_) {
230  std::ostringstream smapsNameOst;
231  smapsNameOst <<"/proc/"<<getpid()<<"/smaps";
232  if((smapsFile_ =fopen(smapsNameOst.str().c_str(), "r"))==0) {
233  throw Exception(errors::Configuration) <<"Failed to open smaps file "<<smapsNameOst.str()<<std::endl;
234  }
235  }
236 #endif
237  }
double edm::service::SimpleMemoryCheck::pageSize ( ) const
inlineprivate

Definition at line 84 of file Memory.h.

References pg_size_.

84 { return pg_size_; }
void edm::service::SimpleMemoryCheck::postBeginJob ( )
void edm::service::SimpleMemoryCheck::postEndJob ( )

Definition at line 265 of file Memory.cc.

References averageGrowthRate(), python.rootplot.argparse::category, count_, current_, edm::service::d2str(), edm::service::SimpleMemoryCheck::SignificantEvent::deltaRss, eventDeltaRssT1_, eventDeltaRssT2_, eventDeltaRssT3_, eventL1_, eventL2_, eventM_, edm::service::SimpleMemoryCheck::SignificantModule::eventMaxDeltaV, eventR1_, eventR2_, eventRssT1_, eventRssT2_, eventRssT3_, eventStatOutput(), eventT1_, eventT2_, eventT3_, growthRateRss_, growthRateVsize_, edm::service::i2str(), jobReportOutputOnly_, diffTwoXMLs::label, m, mallOutput(), edm::service::SimpleMemoryCheck::SignificantModule::maxDeltaVsize, edm::service::SimpleMemoryCheck::SignificantModule::maxEarlyVsize, modules_, moduleSummaryRequested_, NULL, edm::service::SimpleMemoryCheck::SignificantModule::postEarlyCount, edm::service::ProcInfo::rss, edm::service::SimpleMemoryCheck::SignificantEvent::rss, edm::service::SimpleMemoryCheck::SignificantModule::totalDeltaVsize, edm::service::SimpleMemoryCheck::SignificantModule::totalEarlyVsize, relativeConstraints::value, edm::service::ProcInfo::vsize, and edm::service::SimpleMemoryCheck::SignificantEvent::vsize.

Referenced by SimpleMemoryCheck().

265  {
266  if(not jobReportOutputOnly_) {
267  LogAbsolute("MemoryReport") // changelog 1
268  << "MemoryReport> Peak virtual size " << eventT1_.vsize << " Mbytes"
269  << "\n"
270  << " Key events increasing vsize: \n"
271  << eventL2_ << "\n"
272  << eventL1_ << "\n"
273  << eventM_ << "\n"
274  << eventR1_ << "\n"
275  << eventR2_ << "\n"
276  << eventT3_ << "\n"
277  << eventT2_ << "\n"
278  << eventT1_ ;
279  }
280  if(moduleSummaryRequested_ and not jobReportOutputOnly_) { // changelog 1
281  LogAbsolute mmr("ModuleMemoryReport"); // at end of if block, mmr
282  // is destructed, causing
283  // message to be logged
284  mmr << "ModuleMemoryReport> Each line has module label and: \n";
285  mmr << " (after early ignored events) \n";
286  mmr <<
287  " count of times module executed; average increase in vsize \n";
288  mmr <<
289  " maximum increase in vsize; event on which maximum occurred \n";
290  mmr << " (during early ignored events) \n";
291  mmr << " total and maximum vsize increases \n \n";
292  for(SignificantModulesMap::iterator im = modules_.begin();
293  im != modules_.end(); ++im) {
294  SignificantModule const& m = im->second;
295  if(m.totalDeltaVsize == 0 && m.totalEarlyVsize == 0) continue;
296  mmr << im->first << ": ";
297  mmr << "n = " << m.postEarlyCount;
298  if(m.postEarlyCount > 0) {
299  mmr << " avg = " << m.totalDeltaVsize/m.postEarlyCount;
300  }
301  mmr << " max = " << m.maxDeltaVsize << " " << m.eventMaxDeltaV;
302  if(m.totalEarlyVsize > 0) {
303  mmr << " early total: " << m.totalEarlyVsize;
304  mmr << " max: " << m.maxEarlyVsize;
305  }
306  mmr << "\n";
307  }
308  } // end of if; mmr goes out of scope; log message is queued
309 
310  Service<JobReport> reportSvc;
311  // changelog 1
312 #define SIMPLE_MEMORY_CHECK_ORIGINAL_XML_OUTPUT
313 #ifdef SIMPLE_MEMORY_CHECK_ORIGINAL_XML_OUTPUT
314 // std::map<std::string, double> reportData;
315  std::map<std::string, std::string> reportData;
316 
317  if(eventL2_.vsize > 0)
318  eventStatOutput("LargeVsizeIncreaseEventL2", eventL2_, reportData);
319  if(eventL1_.vsize > 0)
320  eventStatOutput("LargeVsizeIncreaseEventL1", eventL1_, reportData);
321  if(eventM_.vsize > 0)
322  eventStatOutput("LargestVsizeIncreaseEvent", eventM_, reportData);
323  if(eventR1_.vsize > 0)
324  eventStatOutput("LargeVsizeIncreaseEventR1", eventR1_, reportData);
325  if(eventR2_.vsize > 0)
326  eventStatOutput("LargeVsizeIncreaseEventR2", eventR2_, reportData);
327  if(eventT3_.vsize > 0)
328  eventStatOutput("ThirdLargestVsizeEventT3", eventT3_, reportData);
329  if(eventT2_.vsize > 0)
330  eventStatOutput("SecondLargestVsizeEventT2", eventT2_, reportData);
331  if(eventT1_.vsize > 0)
332  eventStatOutput("LargestVsizeEventT1", eventT1_, reportData);
333 
334  if(eventRssT3_.rss > 0)
335  eventStatOutput("ThirdLargestRssEvent", eventRssT3_, reportData);
336  if(eventRssT2_.rss > 0)
337  eventStatOutput("SecondLargestRssEvent", eventRssT2_, reportData);
338  if(eventRssT1_.rss > 0)
339  eventStatOutput("LargestRssEvent", eventRssT1_, reportData);
340  if(eventDeltaRssT3_.deltaRss > 0)
341  eventStatOutput("ThirdLargestIncreaseRssEvent", eventDeltaRssT3_, reportData);
342  if(eventDeltaRssT2_.deltaRss > 0)
343  eventStatOutput("SecondLargestIncreaseRssEvent", eventDeltaRssT2_, reportData);
344  if(eventDeltaRssT1_.deltaRss > 0)
345  eventStatOutput("LargestIncreaseRssEvent", eventDeltaRssT1_, reportData);
346 
347 #ifdef __linux__
348  struct mallinfo minfo = mallinfo();
349  reportData.insert(
350  std::make_pair("HEAP_ARENA_SIZE_BYTES", i2str(minfo.arena)));
351  reportData.insert(
352  std::make_pair("HEAP_ARENA_N_UNUSED_CHUNKS", i2str(minfo.ordblks)));
353  reportData.insert(
354  std::make_pair("HEAP_TOP_FREE_BYTES", i2str(minfo.keepcost)));
355  reportData.insert(
356  std::make_pair("HEAP_MAPPED_SIZE_BYTES", i2str(minfo.hblkhd)));
357  reportData.insert(
358  std::make_pair("HEAP_MAPPED_N_CHUNKS", i2str(minfo.hblks)));
359  reportData.insert(
360  std::make_pair("HEAP_USED_BYTES", i2str(minfo.uordblks)));
361  reportData.insert(
362  std::make_pair("HEAP_UNUSED_BYTES", i2str(minfo.fordblks)));
363 #endif
364 
365  // Report Growth rates for VSize and Rss
366  reportData.insert(
367  std::make_pair("AverageGrowthRateVsize", d2str(averageGrowthRate(current_->vsize, growthRateVsize_, count_))));
368  reportData.insert(
369  std::make_pair("PeakValueVsize", d2str(eventT1_.vsize)));
370  reportData.insert(
371  std::make_pair("AverageGrowthRateRss", d2str(averageGrowthRate(current_->rss, growthRateRss_, count_))));
372  reportData.insert(
373  std::make_pair("PeakValueRss", d2str(eventRssT1_.rss)));
374 
375  if(moduleSummaryRequested_) { // changelog 2
376  for(SignificantModulesMap::iterator im = modules_.begin();
377  im != modules_.end(); ++im) {
378  SignificantModule const& m = im->second;
379  if(m.totalDeltaVsize == 0 && m.totalEarlyVsize == 0) continue;
380  std::string label = im->first+":";
381  reportData.insert(std::make_pair(label+"PostEarlyCount", i2str(m.postEarlyCount)));
382  if(m.postEarlyCount > 0) {
383  reportData.insert(std::make_pair(label+"AverageDeltaVsize",
384  d2str(m.totalDeltaVsize/m.postEarlyCount)));
385  }
386  reportData.insert(std::make_pair(label+"MaxDeltaVsize", d2str(m.maxDeltaVsize)));
387  if(m.totalEarlyVsize > 0) {
388  reportData.insert(std::make_pair(label+"TotalEarlyVsize", d2str(m.totalEarlyVsize)));
389  reportData.insert(std::make_pair(label+"MaxEarlyDeltaVsize", d2str(m.maxEarlyVsize)));
390  }
391  }
392  }
393 
394  std::map<std::string, std::string> reportMemoryProperties;
395 
396  if(FILE* fmeminfo = fopen("/proc/meminfo", "r")) {
397  char buf[128];
398  char space[] = " ";
399  size_t value;
400 
401  while(fgets(buf, sizeof(buf), fmeminfo)) {
402  char* token = NULL;
403  token = strtok(buf, space);
404  if(token != NULL) {
405  value = atol(strtok(NULL, space));
406  std::string category = token;
407  reportMemoryProperties.insert(std::make_pair(category.substr(0, strlen(token)-1), i2str(value)));
408  }
409  }
410 
411  fclose(fmeminfo);
412  }
413 
414 // reportSvc->reportMemoryInfo(reportData, reportMemoryProperties);
415  reportSvc->reportPerformanceSummary("ApplicationMemory", reportData);
416  reportSvc->reportPerformanceSummary("SystemMemory", reportMemoryProperties);
417 #endif
418 
419 #ifdef SIMPLE_MEMORY_CHECK_DIFFERENT_XML_OUTPUT
420  std::vector<std::string> reportData;
421 
422  if(eventL2_.vsize > 0) reportData.push_back(
423  eventStatOutput("LargeVsizeIncreaseEventL2", eventL2_));
424  if(eventL1_.vsize > 0) reportData.push_back(
425  eventStatOutput("LargeVsizeIncreaseEventL1", eventL1_));
426  if(eventM_.vsize > 0) reportData.push_back(
427  eventStatOutput("LargestVsizeIncreaseEvent", eventM_));
428  if(eventR1_.vsize > 0) reportData.push_back(
429  eventStatOutput("LargeVsizeIncreaseEventR1", eventR1_));
430  if(eventR2_.vsize > 0) reportData.push_back(
431  eventStatOutput("LargeVsizeIncreaseEventR2", eventR2_));
432  if(eventT3_.vsize > 0) reportData.push_back(
433  eventStatOutput("ThirdLargestVsizeEventT3", eventT3_));
434  if(eventT2_.vsize > 0) reportData.push_back(
435  eventStatOutput("SecondLargestVsizeEventT2", eventT2_));
436  if(eventT1_.vsize > 0) reportData.push_back(
437  eventStatOutput("LargestVsizeEventT1", eventT1_));
438 
439  if(eventRssT3_.rss > 0)
440  eventStatOutput("ThirdLargestRssEvent", eventRssT3_, reportData);
441  if(eventRssT2_.rss > 0)
442  eventStatOutput("SecondLargestRssEvent", eventRssT2_, reportData);
443  if(eventRssT1_.rss > 0)
444  eventStatOutput("LargestRssEvent", eventRssT1_, reportData);
445  if(eventDeltaRssT3_.deltaRss > 0)
446  eventStatOutput("ThirdLargestIncreaseRssEvent", eventDeltaRssT3_, reportData);
447  if(eventDeltaRssT2_.deltaRss > 0)
448  eventStatOutput("SecondLargestIncreaseRssEvent", eventDeltaRssT2_, reportData);
449  if(eventDeltaRssT1_.deltaRss > 0)
450  eventStatOutput("LargestIncreaseRssEvent", eventDeltaRssT1_, reportData);
451 
452  struct mallinfo minfo = mallinfo();
453  reportData.push_back(
454  mallOutput("HEAP_ARENA_SIZE_BYTES", minfo.arena));
455  reportData.push_back(
456  mallOutput("HEAP_ARENA_N_UNUSED_CHUNKS", minfo.ordblks));
457  reportData.push_back(
458  mallOutput("HEAP_TOP_FREE_BYTES", minfo.keepcost));
459  reportData.push_back(
460  mallOutput("HEAP_MAPPED_SIZE_BYTES", minfo.hblkhd));
461  reportData.push_back(
462  mallOutput("HEAP_MAPPED_N_CHUNKS", minfo.hblks));
463  reportData.push_back(
464  mallOutput("HEAP_USED_BYTES", minfo.uordblks));
465  reportData.push_back(
466  mallOutput("HEAP_UNUSED_BYTES", minfo.fordblks));
467 
468  // Report Growth rates for VSize and Rss
469  reportData.insert(
470  std::make_pair("AverageGrowthRateVsize", d2str(averageGrowthRate(current_->vsize, growthRateVsize_, count_))));
471  reportData.insert(
472  std::make_pair("PeakValueVsize", d2str(eventT1_.vsize)));
473  reportData.insert(
474  std::make_pair("AverageGrowthRateRss", d2str(averageGrowthRate(current_->rss, growthRateRss_, count_))));
475  reportData.insert(
476  std::make_pair("PeakValueRss", d2str(eventRssT1_.rss)));
477 
478  reportSvc->reportMemoryInfo(reportData);
479  // This is a form of reportMemoryInfo taking s vector, not a map
480 #endif
481  } // postEndJob
static std::string i2str(int i)
Definition: Memory.cc:65
std::string eventStatOutput(std::string title, SignificantEvent const &e) const
SignificantEvent eventDeltaRssT1_
Definition: Memory.h:193
SignificantEvent eventM_
Definition: Memory.h:169
SignificantEvent eventT1_
Definition: Memory.h:174
SignificantEvent eventRssT2_
Definition: Memory.h:191
SignificantEvent eventL1_
Definition: Memory.h:170
#define NULL
Definition: scimark2.h:8
SignificantEvent eventT3_
Definition: Memory.h:176
SignificantEvent eventRssT3_
Definition: Memory.h:192
friend struct SignificantModule
Definition: Memory.h:222
SignificantEvent eventR1_
Definition: Memory.h:172
SignificantEvent eventDeltaRssT3_
Definition: Memory.h:195
SignificantEvent eventR2_
Definition: Memory.h:173
static std::string d2str(double d)
Definition: Memory.cc:59
SignificantEvent eventL2_
Definition: Memory.h:171
SignificantEvent eventDeltaRssT2_
Definition: Memory.h:194
std::string mallOutput(std::string title, size_t const &n) const
SignificantEvent eventT2_
Definition: Memory.h:175
double averageGrowthRate(double current, double past, int count)
Definition: Memory.cc:109
SignificantModulesMap modules_
Definition: Memory.h:227
SignificantEvent eventRssT1_
Definition: Memory.h:190
void edm::service::SimpleMemoryCheck::postEventProcessing ( const Event e,
const EventSetup  
)

Definition at line 487 of file Memory.cc.

References andPrint(), count_, currentSmaps_, fetchSmaps(), edm::EventBase::id(), monitorPssAndPrivate_, oncePerEventMode_, update(), updateEventStats(), and updateMax().

Referenced by SimpleMemoryCheck().

487  {
488  ++count_;
489  update();
490  if (monitorPssAndPrivate_) {
492  }
493  updateEventStats(e.id());
494  if(oncePerEventMode_) {
495  // should probably use be Run:Event or count_ for the label and name
496  updateMax();
497  andPrint("event", "", "");
498  }
499  }
void updateEventStats(edm::EventID const &e)
Definition: Memory.cc:541
void andPrint(const std::string &type, const std::string &mdlabel, const std::string &mdname) const
Definition: Memory.cc:614
void edm::service::SimpleMemoryCheck::postFork ( unsigned  int,
unsigned  int 
)

Definition at line 519 of file Memory.cc.

References openFiles(), and smapsFile_.

Referenced by SimpleMemoryCheck().

519  {
520 #ifdef LINUX
521  if(0 != smapsFile_) {
522  fclose(smapsFile_);
523  }
524  openFiles();
525 #endif
526  }
void edm::service::SimpleMemoryCheck::postModule ( const ModuleDescription md)

Definition at line 506 of file Memory.cc.

References current_, diffTwoXMLs::label, moduleEntryVsize_, edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), modules_, moduleSummaryRequested_, oncePerEventMode_, update(), updateAndPrint(), updateModuleMemoryStats(), and edm::service::ProcInfo::vsize.

Referenced by SimpleMemoryCheck().

506  {
507  if(!oncePerEventMode_) {
508  updateAndPrint("module", md.moduleLabel(), md.moduleName());
509  } else if(moduleSummaryRequested_) { // changelog 2
510  update();
511  }
512  if(moduleSummaryRequested_) { // changelog 2
513  double dv = current_->vsize - moduleEntryVsize_;
514  std::string label = md.moduleLabel();
515  updateModuleMemoryStats (modules_[label], dv);
516  }
517  }
void updateModuleMemoryStats(SignificantModule &m, double dv)
Definition: Memory.cc:717
void updateAndPrint(const std::string &type, const std::string &mdlabel, const std::string &mdname)
Definition: Memory.cc:651
SignificantModulesMap modules_
Definition: Memory.h:227
void edm::service::SimpleMemoryCheck::postModuleBeginJob ( const ModuleDescription md)

Definition at line 261 of file Memory.cc.

References edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), and updateAndPrint().

Referenced by SimpleMemoryCheck().

261  {
262  updateAndPrint("beginJob", md.moduleLabel(), md.moduleName());
263  }
void updateAndPrint(const std::string &type, const std::string &mdlabel, const std::string &mdname)
Definition: Memory.cc:651
void edm::service::SimpleMemoryCheck::postModuleConstruction ( const ModuleDescription md)

Definition at line 257 of file Memory.cc.

References edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), and updateAndPrint().

Referenced by SimpleMemoryCheck().

257  {
258  updateAndPrint("ctor", md.moduleLabel(), md.moduleName());
259  }
void updateAndPrint(const std::string &type, const std::string &mdlabel, const std::string &mdname)
Definition: Memory.cc:651
void edm::service::SimpleMemoryCheck::postSource ( )

Definition at line 253 of file Memory.cc.

References updateAndPrint().

Referenced by SimpleMemoryCheck().

253  {
254  updateAndPrint("module", "source", "source");
255  }
void updateAndPrint(const std::string &type, const std::string &mdlabel, const std::string &mdname)
Definition: Memory.cc:651
void edm::service::SimpleMemoryCheck::postSourceConstruction ( const ModuleDescription md)

Definition at line 249 of file Memory.cc.

References edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), and updateAndPrint().

Referenced by SimpleMemoryCheck().

249  {
250  updateAndPrint("ctor", md.moduleLabel(), md.moduleName());
251  }
void updateAndPrint(const std::string &type, const std::string &mdlabel, const std::string &mdname)
Definition: Memory.cc:651
void edm::service::SimpleMemoryCheck::preEventProcessing ( const edm::EventID iID,
const edm::Timestamp  
)

Definition at line 483 of file Memory.cc.

References currentEventID_.

Referenced by SimpleMemoryCheck().

483  {
484  currentEventID_ = iID; // changelog 2
485  }
edm::EventID currentEventID_
Definition: Memory.h:229
void edm::service::SimpleMemoryCheck::preModule ( const ModuleDescription )

Definition at line 501 of file Memory.cc.

References current_, moduleEntryVsize_, update(), and edm::service::ProcInfo::vsize.

Referenced by SimpleMemoryCheck().

501  {
502  update(); // changelog 2
504  }
void edm::service::SimpleMemoryCheck::preSourceConstruction ( const ModuleDescription md)

Definition at line 244 of file Memory.cc.

References edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), and updateAndPrint().

Referenced by SimpleMemoryCheck().

244  {
245  updateAndPrint("pre-ctor", md.moduleLabel(), md.moduleName());
246  }
void updateAndPrint(const std::string &type, const std::string &mdlabel, const std::string &mdname)
Definition: Memory.cc:651
void edm::service::SimpleMemoryCheck::update ( void  )
private

Definition at line 528 of file Memory.cc.

References current_, fetch(), previous_, and std::swap().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), postEventProcessing(), postModule(), preModule(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), updateAndPrint(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

528  {
530  *current_ = fetch();
531  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void edm::service::SimpleMemoryCheck::updateAndPrint ( const std::string &  type,
const std::string &  mdlabel,
const std::string &  mdname 
)
private

Definition at line 651 of file Memory.cc.

References andPrint(), update(), and updateMax().

Referenced by postModule(), postModuleBeginJob(), postModuleConstruction(), postSource(), postSourceConstruction(), and preSourceConstruction().

652  {
653  update();
654  andPrint(type, mdlabel, mdname);
655  updateMax();
656  }
type
Definition: HCALResponse.h:22
void andPrint(const std::string &type, const std::string &mdlabel, const std::string &mdname) const
Definition: Memory.cc:614
void edm::service::SimpleMemoryCheck::updateEventStats ( edm::EventID const &  e)
private

Definition at line 541 of file Memory.cc.

References count_, current_, edm::service::SimpleMemoryCheck::SignificantEvent::deltaRss, edm::service::SimpleMemoryCheck::SignificantEvent::deltaVsize, eventDeltaRssT1_, eventDeltaRssT2_, eventDeltaRssT3_, eventL1_, eventL2_, eventM_, eventR1_, eventR2_, eventRssT1_, eventRssT2_, eventRssT3_, eventT1_, eventT2_, eventT3_, num_to_skip_, edm::service::ProcInfo::rss, evf::utils::rss, edm::service::SimpleMemoryCheck::SignificantEvent::rss, edm::service::SimpleMemoryCheck::SignificantEvent::set(), SignificantEvent, edm::service::ProcInfo::vsize, evf::utils::vsize, and edm::service::SimpleMemoryCheck::SignificantEvent::vsize.

Referenced by postEventProcessing().

541  {
542  if(count_ < num_to_skip_) return;
543  if(count_ == num_to_skip_) {
544  eventT1_.set(0, 0, e, this);
545  eventM_.set (0, 0, e, this);
546  eventRssT1_.set(0, 0, e, this);
547  eventDeltaRssT1_.set(0, 0, e, this);
548  return;
549  }
550  double vsize = current_->vsize;
551  double deltaVsize = vsize - eventT1_.vsize;
552 
553  // Update significative events for Vsize
554  if(vsize > eventT1_.vsize) {
555  double deltaRss = current_->rss - eventT1_.rss;
556  eventT3_ = eventT2_;
557  eventT2_ = eventT1_;
558  eventT1_.set(deltaVsize, deltaRss, e, this);
559  } else if(vsize > eventT2_.vsize) {
560  double deltaRss = current_->rss - eventT1_.rss;
561  eventT3_ = eventT2_;
562  eventT2_.set(deltaVsize, deltaRss, e, this);
563  } else if(vsize > eventT3_.vsize) {
564  double deltaRss = current_->rss - eventT1_.rss;
565  eventT3_.set(deltaVsize, deltaRss, e, this);
566  }
567 
568  if(deltaVsize > eventM_.deltaVsize) {
569  double deltaRss = current_->rss - eventM_.rss;
571  eventL2_ = eventL1_;
572  } else {
573  eventL2_ = eventR1_;
574  }
575  eventL1_ = eventM_;
576  eventM_.set(deltaVsize, deltaRss, e, this);
579  } else if(deltaVsize > eventR1_.deltaVsize) {
580  double deltaRss = current_->rss - eventM_.rss;
581  eventR2_ = eventR1_;
582  eventR1_.set(deltaVsize, deltaRss, e, this);
583  } else if(deltaVsize > eventR2_.deltaVsize) {
584  double deltaRss = current_->rss - eventR1_.rss;
585  eventR2_.set(deltaVsize, deltaRss, e, this);
586  }
587 
588  // Update significative events for Rss
589  double rss = current_->rss;
590  double deltaRss = rss - eventRssT1_.rss;
591 
592  if(rss > eventRssT1_.rss) {
595  eventRssT1_.set(deltaVsize, deltaRss, e, this);
596  } else if(rss > eventRssT2_.rss) {
598  eventRssT2_.set(deltaVsize, deltaRss, e, this);
599  } else if(rss > eventRssT3_.rss) {
600  eventRssT3_.set(deltaVsize, deltaRss, e, this);
601  }
602  if(deltaRss > eventDeltaRssT1_.deltaRss) {
605  eventDeltaRssT1_.set(deltaVsize, deltaRss, e, this);
606  } else if(deltaRss > eventDeltaRssT2_.deltaRss) {
608  eventDeltaRssT2_.set(deltaVsize, deltaRss, e, this);
609  } else if(deltaRss > eventDeltaRssT3_.deltaRss) {
610  eventDeltaRssT3_.set(deltaVsize, deltaRss, e, this);
611  }
612  } // updateEventStats
SignificantEvent eventDeltaRssT1_
Definition: Memory.h:193
SignificantEvent eventM_
Definition: Memory.h:169
SignificantEvent eventT1_
Definition: Memory.h:174
SignificantEvent eventRssT2_
Definition: Memory.h:191
SignificantEvent eventL1_
Definition: Memory.h:170
SignificantEvent eventT3_
Definition: Memory.h:176
SignificantEvent eventRssT3_
Definition: Memory.h:192
friend struct SignificantEvent
Definition: Memory.h:150
void set(double deltaV, double deltaR, edm::EventID const &e, SimpleMemoryCheck *t)
Definition: Memory.h:135
SignificantEvent eventR1_
Definition: Memory.h:172
SignificantEvent eventDeltaRssT3_
Definition: Memory.h:195
SignificantEvent eventR2_
Definition: Memory.h:173
SignificantEvent eventL2_
Definition: Memory.h:171
SignificantEvent eventDeltaRssT2_
Definition: Memory.h:194
SignificantEvent eventT2_
Definition: Memory.h:175
SignificantEvent eventRssT1_
Definition: Memory.h:190
void edm::service::SimpleMemoryCheck::updateMax ( )
private

Definition at line 533 of file Memory.cc.

References count_, current_, max_, num_to_skip_, and oncePerEventMode_.

Referenced by postEventProcessing(), and updateAndPrint().

533  {
534  if((*current_ > max_) || oncePerEventMode_) {
535  if(count_ >= num_to_skip_) {
536  }
537  max_ = *current_;
538  }
539  }
void edm::service::SimpleMemoryCheck::updateModuleMemoryStats ( SignificantModule m,
double  dv 
)
private

Definition at line 717 of file Memory.cc.

References count_, currentEventID_, edm::service::SimpleMemoryCheck::SignificantModule::eventMaxDeltaV, edm::service::SimpleMemoryCheck::SignificantModule::maxDeltaVsize, edm::service::SimpleMemoryCheck::SignificantModule::maxEarlyVsize, num_to_skip_, edm::service::SimpleMemoryCheck::SignificantModule::postEarlyCount, edm::service::SimpleMemoryCheck::SignificantModule::totalDeltaVsize, and edm::service::SimpleMemoryCheck::SignificantModule::totalEarlyVsize.

Referenced by postModule().

718  {
719  if(count_ < num_to_skip_) {
720  m.totalEarlyVsize += dv;
721  if(dv > m.maxEarlyVsize) m.maxEarlyVsize = dv;
722  } else {
723  ++m.postEarlyCount;
724  m.totalDeltaVsize += dv;
725  if(dv > m.maxDeltaVsize) {
726  m.maxDeltaVsize = dv;
727  m.eventMaxDeltaV = currentEventID_;
728  }
729  }
730  } //updateModuleMemoryStats
edm::EventID currentEventID_
Definition: Memory.h:229

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
SimpleMemoryCheck::SignificantEvent const &  se 
)
friend

Definition at line 733 of file Memory.cc.

734  {
735  os << "[" << se.count << "] "
736  << se.event << " vsize = " << se.vsize
737  << " deltaVsize = " << se.deltaVsize
738  << " rss = " << se.rss << " delta = " << se.deltaRss;
739 
740  if (se.monitorPssAndPrivate) {
741  os <<" private = "<<se.privateSize<<" pss = "<<se.pss;
742  }
743  return os;
744  }
std::ostream& operator<< ( std::ostream &  os,
SimpleMemoryCheck::SignificantModule const &  se 
)
friend

Definition at line 747 of file Memory.cc.

748  {
749  if(sm.postEarlyCount > 0) {
750  os << "\nPost Early Events: TotalDeltaVsize: " << sm.totalDeltaVsize
751  << " (avg: " << sm.totalDeltaVsize/sm.postEarlyCount
752  << "; max: " << sm.maxDeltaVsize
753  << " during " << sm.eventMaxDeltaV << ")";
754  }
755  if(sm.totalEarlyVsize > 0) {
756  os << "\n Early Events: TotalDeltaVsize: " << sm.totalEarlyVsize
757  << " (max: " << sm.maxEarlyVsize << ")";
758  }
759 
760  return os;
761  }
friend struct SignificantEvent
friend

Definition at line 150 of file Memory.h.

Referenced by updateEventStats().

friend struct SignificantModule
friend

Definition at line 222 of file Memory.h.

Member Data Documentation

ProcInfo edm::service::SimpleMemoryCheck::a_
private

Definition at line 94 of file Memory.h.

ProcInfo edm::service::SimpleMemoryCheck::b_
private

Definition at line 95 of file Memory.h.

int edm::service::SimpleMemoryCheck::count_
private
ProcInfo* edm::service::SimpleMemoryCheck::current_
private
edm::EventID edm::service::SimpleMemoryCheck::currentEventID_
private

Definition at line 229 of file Memory.h.

Referenced by preEventProcessing(), and updateModuleMemoryStats().

smapsInfo edm::service::SimpleMemoryCheck::currentSmaps_
private
SignificantEvent edm::service::SimpleMemoryCheck::eventDeltaRssT1_
private

Definition at line 193 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventDeltaRssT2_
private

Definition at line 194 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventDeltaRssT3_
private

Definition at line 195 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventL1_
private

Definition at line 170 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventL2_
private

Definition at line 171 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventM_
private

Definition at line 169 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventR1_
private

Definition at line 172 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventR2_
private

Definition at line 173 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventRssT1_
private

Definition at line 190 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventRssT2_
private

Definition at line 191 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventRssT3_
private

Definition at line 192 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventT1_
private

Definition at line 174 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventT2_
private

Definition at line 175 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

SignificantEvent edm::service::SimpleMemoryCheck::eventT3_
private

Definition at line 176 of file Memory.h.

Referenced by postEndJob(), and updateEventStats().

double edm::service::SimpleMemoryCheck::growthRateRss_
private

Definition at line 120 of file Memory.h.

Referenced by postBeginJob(), and postEndJob().

double edm::service::SimpleMemoryCheck::growthRateVsize_
private

Definition at line 119 of file Memory.h.

Referenced by postBeginJob(), and postEndJob().

bool edm::service::SimpleMemoryCheck::jobReportOutputOnly_
private

Definition at line 108 of file Memory.h.

Referenced by andPrint(), and postEndJob().

ProcInfo edm::service::SimpleMemoryCheck::max_
private

Definition at line 96 of file Memory.h.

Referenced by andPrint(), and updateMax().

double edm::service::SimpleMemoryCheck::moduleEntryVsize_
private

Definition at line 228 of file Memory.h.

Referenced by postModule(), and preModule().

SignificantModulesMap edm::service::SimpleMemoryCheck::modules_
private

Definition at line 227 of file Memory.h.

Referenced by postEndJob(), and postModule().

bool edm::service::SimpleMemoryCheck::moduleSummaryRequested_
private

Definition at line 225 of file Memory.h.

Referenced by postEndJob(), postModule(), and SimpleMemoryCheck().

bool edm::service::SimpleMemoryCheck::monitorPssAndPrivate_
private
int edm::service::SimpleMemoryCheck::num_to_skip_
private

Definition at line 104 of file Memory.h.

Referenced by andPrint(), updateEventStats(), updateMax(), and updateModuleMemoryStats().

bool edm::service::SimpleMemoryCheck::oncePerEventMode_
private

Definition at line 107 of file Memory.h.

Referenced by andPrint(), postEventProcessing(), postModule(), SimpleMemoryCheck(), and updateMax().

double edm::service::SimpleMemoryCheck::pg_size_
private

Definition at line 103 of file Memory.h.

Referenced by pageSize().

ProcInfoFetcher edm::service::SimpleMemoryCheck::piFetcher_
private

Definition at line 102 of file Memory.h.

Referenced by fetch().

ProcInfo* edm::service::SimpleMemoryCheck::previous_
private

Definition at line 98 of file Memory.h.

Referenced by update().

bool edm::service::SimpleMemoryCheck::showMallocInfo_
private

Definition at line 106 of file Memory.h.

Referenced by andPrint().

FILE* edm::service::SimpleMemoryCheck::smapsFile_
private

Definition at line 113 of file Memory.h.

Referenced by fetchSmaps(), openFiles(), postFork(), and ~SimpleMemoryCheck().

char* edm::service::SimpleMemoryCheck::smapsLineBuffer_
private

Definition at line 114 of file Memory.h.

Referenced by fetchSmaps(), and ~SimpleMemoryCheck().

size_t edm::service::SimpleMemoryCheck::smapsLineBufferLen_
private

Definition at line 115 of file Memory.h.

Referenced by fetchSmaps().