diff --git a/algo/base/SubChain.h b/algo/base/SubChain.h index b23538e09ecc6bc59021d5c52f9e8dc8cf5b3753..0b0c19744ddbf5984123c285381f2486f68359a6 100644 --- a/algo/base/SubChain.h +++ b/algo/base/SubChain.h @@ -23,6 +23,7 @@ namespace cbm::algo Monitor& GetMonitor() const { // Need Get-prefix to avoid conflict with Monitor-class name + if (!HasMonitor()) throw std::runtime_error("No monitor available"); return *gsl::make_not_null(fContext)->monitor; } diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx index e0ddaee20e8b3f27a15f347b147a3485ff087d65..490967f7531f9716636dadab6bc2a7463e386fd5 100644 --- a/algo/global/Reco.cxx +++ b/algo/global/Reco.cxx @@ -85,8 +85,10 @@ void Reco::Run(const fles::Timeslice& ts) xpu::timings ts_times = xpu::pop_timer(); - GetMonitor().QueueMetric("cbm_reco", {{"hostname", fles::system::current_hostname()}}, - {{"tsProcessed", 1}, {"bytesProcessed", ts_utils::SizeBytes(ts)}}); + if (HasMonitor()) + GetMonitor().QueueMetric("cbm_reco", {{"hostname", fles::system::current_hostname()}}, + {{"tsProcessed", 1}, {"bytesProcessed", ts_utils::SizeBytes(ts)}}); + PrintTimings(ts_times); }