From cdc6c061f819fdbf579d5d885ec1ad60860b8245 Mon Sep 17 00:00:00 2001 From: Felix Weiglhofer <weiglhofer@fias.uni-frankfurt.de> Date: Tue, 27 Jun 2023 14:42:46 +0000 Subject: [PATCH] algo::Unpack: Add timers. --- algo/unpack/Unpack.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/algo/unpack/Unpack.cxx b/algo/unpack/Unpack.cxx index 67fb08580d..b0b1c2aa95 100644 --- a/algo/unpack/Unpack.cxx +++ b/algo/unpack/Unpack.cxx @@ -7,6 +7,8 @@ #include <chrono> +#include <xpu/host.h> + #include "compat/Algorithm.h" #include "log.hpp" @@ -17,6 +19,8 @@ namespace cbm::algo // ----- Execution ------------------------------------------------------- Unpack::resultType Unpack::operator()(const fles::Timeslice* timeslice) { + xpu::scoped_timer t0("Unpack"); + // --- Output data resultType result = {}; CbmDigiTimeslice& digiTs = result.first; @@ -25,6 +29,7 @@ namespace cbm::algo ParallelInit(*timeslice); if (DetectorEnabled(fles::SubsystemIdentifier::STS)) { + xpu::scoped_timer t1("STS"); ParallelMsLoop(digiTs.fData.fSts.fDigis, monitor.fSts, *timeslice, 0x20); } @@ -36,6 +41,8 @@ namespace cbm::algo if (!DetectorEnabled(systemId)) continue; + xpu::scoped_timer t1(fles::to_string(systemId)); + // Equipment ID of current component const uint16_t equipmentId = timeslice->descriptor(comp, 0).eq_id; @@ -68,6 +75,8 @@ namespace cbm::algo } //# component // --- Sorting of output digis. Is required by both digi trigger and event builder. + + xpu::scoped_timer t2("Sort"); Sort(digiTs.fData.fSts.fDigis.begin(), digiTs.fData.fSts.fDigis.end(), [](CbmStsDigi digi1, CbmStsDigi digi2) { return digi1.GetTime() < digi2.GetTime(); }); Sort(digiTs.fData.fMuch.fDigis.begin(), digiTs.fData.fMuch.fDigis.end(), @@ -305,6 +314,8 @@ namespace cbm::algo // ---------------------------------------------------------------------------- void Unpack::ParallelInit(const fles::Timeslice& timeslice) { + xpu::scoped_timer t("ParallelInit"); + fParallelStsSetup = {}; size_t numMs = 0; @@ -341,19 +352,25 @@ namespace cbm::algo auto& msDigis = fParallelStsSetup.msDigis; size_t numMs = msDigis.size(); + xpu::push_timer("Unpack"); #pragma omp parallel for schedule(dynamic) for (size_t i = 0; i < numMs; i++) { auto result = fAlgoSts.at(msEqIds[i])(msContent[i], msDesc[i], ts.start_time()); msDigis[i] = std::move(result.first); monitor[i] = std::move(result.second); } + xpu::pop_timer(); size_t nDigisTotal = 0; for (const auto& digis : msDigis) { nDigisTotal += digis.size(); } + xpu::push_timer("Resize"); digisOut.resize(nDigisTotal); + xpu::pop_timer(); + + xpu::push_timer("Merge"); #pragma omp parallel for schedule(dynamic) for (unsigned int i = 0; i < numMs; i++) { unsigned int offset = 0; @@ -361,6 +378,7 @@ namespace cbm::algo offset += msDigis[x].size(); std::copy(msDigis[i].begin(), msDigis[i].end(), digisOut.begin() + offset); } + xpu::pop_timer(); monitorOut = std::move(monitor); -- GitLab