From 7a060713a0d5cb9f074c02c2f627f5c88dc02145 Mon Sep 17 00:00:00 2001 From: Rafal Bielski <rafal.bielski@cern.ch> Date: Mon, 7 Dec 2020 18:15:36 +0100 Subject: [PATCH] TrigOnlineMonitor: Add histograms to monitor number of forks, threads and slots --- .../TrigOnlineMonitor/src/TrigOpMonitor.cxx | 47 ++++++++++++++++++- .../TrigOnlineMonitor/src/TrigOpMonitor.h | 3 ++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigOpMonitor.cxx b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigOpMonitor.cxx index 16ba506264e..8c529f4b1d0 100644 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigOpMonitor.cxx +++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigOpMonitor.cxx @@ -76,6 +76,8 @@ void TrigOpMonitor::handle( const Incident& incident ) { fillMagFieldHist(); fillIOVDbHist(); fillSubDetHist(); + const AthenaInterprocess::UpdateAfterFork& updinc = dynamic_cast<const AthenaInterprocess::UpdateAfterFork&>(incident); + fillProcThreadHist(updinc.workerID()); } } @@ -128,6 +130,14 @@ StatusCode TrigOpMonitor::bookHists() m_releaseHist = new TH1I("GeneralOpInfo", "General operational info;;Applications", 1, 0, 1); + m_mtConfigHist = new TH2I("MTConfig", "Multi-threading configuration", 2, 0, 2, 10, 0, 10); + m_mtConfigHist->SetCanExtend(TH1::kYaxis); + m_mtConfigHist->GetXaxis()->SetBinLabel(1, "N threads"); + m_mtConfigHist->GetXaxis()->SetBinLabel(2, "N slots"); + + m_workersHist = new TH1I("MPWorkers", "Worker IDs;Worker ID;Number of workers", 10, 0, 10); + m_workersHist->SetCanExtend(TH1::kXaxis); + m_subdetHist = new TH2I("Subdetectors", "State of subdetectors", 1, 0, 1, 3, 0, 3); m_subdetHist->SetCanExtend(TH1::kXaxis); m_subdetHist->GetYaxis()->SetBinLabel(1, "# ROB"); @@ -140,7 +150,10 @@ StatusCode TrigOpMonitor::bookHists() m_muHist = new TProfile("Pileup", "Pileup;Lumiblock;Interactions per BX", m_maxLB, 0, m_maxLB); // Register histograms - TH1* hist[] = {m_releaseHist, m_subdetHist, m_iovChangeHist, m_magFieldHist, m_lumiHist, m_muHist}; + TH1* hist[] = { + m_releaseHist, m_mtConfigHist, m_workersHist, m_subdetHist, + m_iovChangeHist, m_magFieldHist, m_lumiHist, m_muHist + }; for (TH1* h : hist) { if (h) ATH_CHECK(m_histSvc->regHist(m_histPath + h->GetName(), h)); } @@ -347,6 +360,38 @@ void TrigOpMonitor::fillReleaseDataHist() } } +void TrigOpMonitor::fillProcThreadHist(const int workerID) +{ + m_workersHist->Fill(workerID, 1); + + auto getIntProp = [this](std::string_view name, const std::string& prop) -> std::optional<int> { + IProperty* svc = serviceLocator()->service(name).as<IProperty>(); + if (svc == nullptr) return std::nullopt; + try { + return std::stoi(svc->getProperty(prop).toString()); + } + catch (...) { + return std::nullopt; + } + }; + + const std::optional<int> numThreads = getIntProp("AvalancheSchedulerSvc","ThreadPoolSize"); + if (numThreads.has_value()) { + m_mtConfigHist->Fill("N threads", numThreads.value(), 1.0); + } + else { + ATH_MSG_WARNING("Could not retrieve the number of threads to fill the monitoring histogram"); + } + + const std::optional<int> numSlots = getIntProp("EventDataSvc","NSlots"); + if (numSlots.has_value()) { + m_mtConfigHist->Fill("N slots", numSlots.value(), 1.0); + } + else { + ATH_MSG_WARNING("Could not retrieve the number of slots to fill the monitoring histogram"); + } +} + void TrigOpMonitor::fillSubDetHist() { // Retrieve the enabled ROBs/SubDets list from DataFlowConfig which is a special object diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigOpMonitor.h b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigOpMonitor.h index de316dcc928..5f4442dd042 100644 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigOpMonitor.h +++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigOpMonitor.h @@ -51,6 +51,7 @@ public: private: void fillMagFieldHist(); void fillReleaseDataHist(); + void fillProcThreadHist(int workerID); void fillSubDetHist(); void fillIOVDbHist(); void fillIOVDbChangeHist(const EventContext& ctx); @@ -75,6 +76,8 @@ private: TH2I* m_magFieldHist{nullptr}; TH2I* m_iovChangeHist{nullptr}; TH1I* m_releaseHist{nullptr}; + TH2I* m_mtConfigHist{nullptr}; + TH1I* m_workersHist{nullptr}; TH2I* m_subdetHist{nullptr}; TProfile* m_lumiHist{nullptr}; TProfile* m_muHist{nullptr}; -- GitLab