26 void performanceReport() {
27 started_.store(
false, std::memory_order_release);
29 auto finalRequested = requested_.load(std::memory_order_acquire);
30 auto maxActual = maxActual_.load(std::memory_order_acquire);
31 auto present = presentActual_.load(std::memory_order_acquire);
32 auto allocs = nAllocations_.load(std::memory_order_acquire);
33 auto deallocs = nDeallocations_.load(std::memory_order_acquire);
36 <<
"Event Processing Memory Report" 37 <<
"\n total additional memory requested: " << finalRequested
38 <<
"\n max additional memory used: " << maxActual
39 <<
"\n total additional memory not deallocated: " << present <<
"\n # allocations calls: " << allocs
40 <<
"\n # deallocations calls: " << deallocs;
43 void start() { started_.store(
true, std::memory_order_release); }
46 void allocCalled(
size_t iRequested,
size_t iActual,
void const*)
final {
47 if (not started_.load(std::memory_order_acquire)) {
50 nAllocations_.fetch_add(1, std::memory_order_acq_rel);
51 requested_.fetch_add(iRequested, std::memory_order_acq_rel);
54 auto a = presentActual_.fetch_add(iActual, std::memory_order_acq_rel);
57 auto max = maxActual_.load(std::memory_order_relaxed);
59 if (maxActual_.compare_exchange_strong(
max,
a, std::memory_order_acq_rel)) {
65 if (not started_.load(std::memory_order_acquire)) {
68 nDeallocations_.fetch_add(1, std::memory_order_acq_rel);
69 auto present = presentActual_.load(std::memory_order_acquire);
70 if (present >= iActual) {
71 presentActual_.fetch_sub(iActual, std::memory_order_acq_rel);
75 std::atomic<size_t> requested_ = 0;
76 std::atomic<size_t> presentActual_ = 0;
77 std::atomic<size_t> maxActual_ = 0;
78 std::atomic<size_t> nAllocations_ = 0;
79 std::atomic<size_t> nDeallocations_ = 0;
81 std::atomic<bool> started_ =
false;
93 adaptor->performanceReport();
Log< level::System, false > LogSystem
#define DEFINE_FWK_SERVICE(type)
EventProcessingAllocMonitor(edm::ParameterSet const &iPS, edm::ActivityRegistry &iAR)
PostBeginJob postBeginJobSignal_
signal is emitted after all modules have gotten their beginJob called
PreEndJob preEndJobSignal_
signal is emitted before any modules have gotten their endJob called