Skip to content

Commit 86132d2

Browse files
authored
Merge pull request #46161 from Dr15Jones/printPeriodicSimpleMemoryCheck
Option to print periodically from SimpleMemoryCheck
2 parents 707d462 + 253f176 commit 86132d2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

FWCore/Services/plugins/SimpleMemoryCheck.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ namespace edm {
123123
//options
124124
bool showMallocInfo_;
125125
bool oncePerEventMode_;
126+
bool printEachTime_;
126127
bool jobReportOutputOnly_;
127128
bool monitorPssAndPrivate_;
128129
std::atomic<int> count_;
@@ -338,6 +339,7 @@ namespace edm {
338339
num_to_skip_(iPS.getUntrackedParameter<int>("ignoreTotal")),
339340
showMallocInfo_(iPS.getUntrackedParameter<bool>("showMallocInfo")),
340341
oncePerEventMode_(iPS.getUntrackedParameter<bool>("oncePerEventMode")),
342+
printEachTime_(oncePerEventMode_ or iPS.getUntrackedParameter<bool>("printEachSample")),
341343
jobReportOutputOnly_(iPS.getUntrackedParameter<bool>("jobReportOutputOnly")),
342344
monitorPssAndPrivate_(iPS.getUntrackedParameter<bool>("monitorPssAndPrivate")),
343345
count_(),
@@ -422,6 +424,8 @@ namespace edm {
422424
->setComment(
423425
"Use a special thread to sample memory at the set rate. A value of 0 means no sampling. This option "
424426
"cannot be used with 'oncePerEventMode' or 'moduleMemorySummary'.");
427+
desc.addUntracked<bool>("printEachSample", false)
428+
->setComment("If sampling on, print each sample taken else will print only when sample is the largest seen.");
425429
desc.addUntracked<bool>("showMallocInfo", false);
426430
desc.addUntracked<bool>("oncePerEventMode", false)
427431
->setComment(
@@ -897,7 +901,7 @@ namespace edm {
897901
void SimpleMemoryCheck::andPrint(std::string const& type,
898902
std::string const& mdlabel,
899903
std::string const& mdname) const {
900-
if (not jobReportOutputOnly_ && ((*current_ > max_) || oncePerEventMode_)) {
904+
if (not jobReportOutputOnly_ && ((*current_ > max_) || printEachTime_)) {
901905
if (count_ >= num_to_skip_) {
902906
double deltaVSIZE = current_->vsize - max_.vsize;
903907
double deltaRSS = current_->rss - max_.rss;

0 commit comments

Comments
 (0)