diff --git a/DQMServices/Core/src/MonitorElement.cc b/DQMServices/Core/src/MonitorElement.cc index cb68f9ad21864..c87769e91c45d 100644 --- a/DQMServices/Core/src/MonitorElement.cc +++ b/DQMServices/Core/src/MonitorElement.cc @@ -765,7 +765,9 @@ namespace dqm::impl { auto access = this->accessMut(); update(); if (getAxis(access, __PRETTY_FUNCTION__, axis)->GetNbins() >= bin) { - getAxis(access, __PRETTY_FUNCTION__, axis)->SetBinLabel(bin, label.c_str()); + if (strcmp(label.c_str(), getAxis(access, __PRETTY_FUNCTION__, axis)->GetBinLabel(bin)) != 0) { + getAxis(access, __PRETTY_FUNCTION__, axis)->SetBinLabel(bin, label.c_str()); + } } else { fail = true; } diff --git a/HLTrigger/Timer/plugins/FastTimerServiceClient.cc b/HLTrigger/Timer/plugins/FastTimerServiceClient.cc index 2c6ad2794ec4e..17d74489a61b4 100644 --- a/HLTrigger/Timer/plugins/FastTimerServiceClient.cc +++ b/HLTrigger/Timer/plugins/FastTimerServiceClient.cc @@ -30,6 +30,17 @@ struct MEPSet { double xmax; }; +namespace { + void setBinLabel(TAxis* axis, int bin, const char* label) { + //TAxis::GetBinLabel currently doesnt have this check + //and changing a label is a slow operation + if (strcmp(axis->GetBinLabel(bin), label) != 0) { + axis->SetBinLabel(bin, label); + } + } + +} // namespace + class FastTimerServiceClient : public DQMEDHarvester { public: explicit FastTimerServiceClient(edm::ParameterSet const&); @@ -165,7 +176,6 @@ void FastTimerServiceClient::fillPathSummaryPlots(DQMStore::IBooker& booker, double events, std::string const& current_path) { // note: the following checks need to be kept separate, as any of these histograms might be missing - booker.setCurrentFolder(current_path); std::vector subsubdirs = getter.getSubdirs(); size_t npaths = subsubdirs.size(); @@ -262,7 +272,7 @@ void FastTimerServiceClient::fillPathSummaryPlots(DQMStore::IBooker& booker, real_average->SetYTitle("average processing (real) time [ms]"); for (uint32_t i = 1; i <= bins; ++i) { const char* module = counter->GetXaxis()->GetBinLabel(i); - real_average->GetXaxis()->SetBinLabel(i, module); + setBinLabel(real_average->GetXaxis(), i, module); } } @@ -278,7 +288,7 @@ void FastTimerServiceClient::fillPathSummaryPlots(DQMStore::IBooker& booker, thread_average->SetYTitle("average processing (thread) time [ms]"); for (uint32_t i = 1; i <= bins; ++i) { const char* module = counter->GetXaxis()->GetBinLabel(i); - thread_average->GetXaxis()->SetBinLabel(i, module); + setBinLabel(thread_average->GetXaxis(), i, module); } } @@ -293,7 +303,7 @@ void FastTimerServiceClient::fillPathSummaryPlots(DQMStore::IBooker& booker, real_running->SetYTitle("running processing (real) time [ms]"); for (uint32_t i = 1; i <= bins; ++i) { const char* module = counter->GetXaxis()->GetBinLabel(i); - real_running->GetXaxis()->SetBinLabel(i, module); + setBinLabel(real_running->GetXaxis(), i, module); } } @@ -309,7 +319,7 @@ void FastTimerServiceClient::fillPathSummaryPlots(DQMStore::IBooker& booker, thread_running->SetYTitle("running processing (thread) time [ms]"); for (uint32_t i = 1; i <= bins; ++i) { const char* module = counter->GetXaxis()->GetBinLabel(i); - thread_running->GetXaxis()->SetBinLabel(i, module); + setBinLabel(thread_running->GetXaxis(), i, module); } } @@ -325,7 +335,7 @@ void FastTimerServiceClient::fillPathSummaryPlots(DQMStore::IBooker& booker, efficiency->SetMaximum(1.05); for (uint32_t i = 1; i <= bins; ++i) { const char* module = counter->GetXaxis()->GetBinLabel(i); - efficiency->GetXaxis()->SetBinLabel(i, module); + setBinLabel(efficiency->GetXaxis(), i, module); } }