From c875f2bdba3b851a8ec076f3f1ca2b4cc93ccebb Mon Sep 17 00:00:00 2001
From: Alaettin Serhan Mete <alaettin.serhan.mete@cern.ch>
Date: Tue, 23 Nov 2021 10:36:39 +0100
Subject: [PATCH] Make the lower limit for the memory fit configurable

---
 .../PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx   | 4 ++--
 Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx
index 4eca37faf47..31739506697 100644
--- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx
+++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.cxx
@@ -509,7 +509,7 @@ void PerfMonMTSvc::report2Log_EventLevel() {
     }
     m_eventLoopMsgCounter++;
     // Add to leak estimate
-    if (it.first >= 25) {
+    if (it.first >= m_memFitLowerLimit) {
       m_fit_vmem.addPoint(it.first, it.second.mem_stats.at("vmem"));
       m_fit_pss.addPoint(it.first, it.second.mem_stats.at("pss"));
     }
@@ -562,7 +562,7 @@ void PerfMonMTSvc::report2Log_Summary() {
     ATH_MSG_INFO(format("%1% %|35t|%2% ") % "Leak estimate per event Pss: " % scaleMem(m_fit_pss.slope()));
     ATH_MSG_INFO("  >> Estimated using the last " << m_fit_vmem.nPoints()
                                                   << " measurements from the Event Level Monitoring");
-    ATH_MSG_INFO("  >> Events prior to the first 25 are omitted...");
+    ATH_MSG_INFO("  >> Events prior to the first " << m_memFitLowerLimit.toString() << " are omitted...");
   }
 
   ATH_MSG_INFO("=======================================================================================");
diff --git a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h
index d3ac4b44d23..292d05ef013 100644
--- a/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h
+++ b/Control/PerformanceMonitoring/PerfMonComps/src/PerfMonMTSvc.h
@@ -138,6 +138,10 @@ class PerfMonMTSvc : virtual public IPerfMonMTSvc, virtual public IIncidentListe
   Gaudi::Property<std::string> m_checkPointType{
       this, "checkPointType", "Arithmetic",
       "Type of the check point sequence: Arithmetic(0, k, 2k...) or Geometric(0,k,k^2...)."};
+  /// Lower limit (in number of events) for the memory fit
+  Gaudi::Property<uint64_t> m_memFitLowerLimit{
+      this, "memFitLowerLimit", 25,
+      "Lower limit (in number of events) for the memory fit."};
   /// Frequency of event level monitoring
   Gaudi::Property<uint64_t> m_checkPointFactor{
       this, "checkPointFactor", 50,
-- 
GitLab