From d72165d39b9db8cabe161f86b8e157823a3642d2 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 15 Nov 2023 14:18:14 +0100 Subject: [PATCH] DPL: allow resetting the oldest possible timeframe mechanism (#9895) * DPL: allow resetting the oldest possible timeframe mechanism * Update TimesliceIndex.h * fix clang-format --------- Co-authored-by: David Rohr --- Framework/Core/include/Framework/TimesliceIndex.h | 3 +++ Framework/Core/src/CommonServices.cxx | 1 + Framework/Core/src/TimesliceIndex.cxx | 15 +++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/Framework/Core/include/Framework/TimesliceIndex.h b/Framework/Core/include/Framework/TimesliceIndex.h index 1f205082337a5..c3f3c82bdeb6e 100644 --- a/Framework/Core/include/Framework/TimesliceIndex.h +++ b/Framework/Core/include/Framework/TimesliceIndex.h @@ -133,6 +133,9 @@ class TimesliceIndex OldestOutputInfo updateOldestPossibleOutput(); [[nodiscard]] InputChannelInfo const& getChannelInfo(ChannelIndex channel) const; + // Reset the TimesliceIndex to its initial state + auto reset() -> void; + private: /// @return the oldest slot possible so that we can eventually override it. /// This is the timeslices for all the in flight parts. diff --git a/Framework/Core/src/CommonServices.cxx b/Framework/Core/src/CommonServices.cxx index 66e0330841ea6..7d502216bc509 100644 --- a/Framework/Core/src/CommonServices.cxx +++ b/Framework/Core/src/CommonServices.cxx @@ -509,6 +509,7 @@ o2::framework::ServiceSpec CommonServices::decongestionSpec() decongestion->lastTimeslice = oldestPossibleOutput.timeslice.value; }, .stop = [](ServiceRegistryRef services, void* service) { auto* decongestion = (DecongestionService*)service; + services.get().reset(); decongestion->nextEnumerationTimeslice = 0; decongestion->nextEnumerationTimesliceRewinded = false; decongestion->lastTimeslice = 0; diff --git a/Framework/Core/src/TimesliceIndex.cxx b/Framework/Core/src/TimesliceIndex.cxx index 267341eafd105..4d5cf443e5385 100644 --- a/Framework/Core/src/TimesliceIndex.cxx +++ b/Framework/Core/src/TimesliceIndex.cxx @@ -205,4 +205,19 @@ InputChannelInfo const& TimesliceIndex::getChannelInfo(ChannelIndex channel) con return mChannels[channel.value]; } +auto TimesliceIndex::reset() -> void +{ + mOldestPossibleInput = { + .timeslice = {0}, + /// The actual channel id of the oldest input. + .channel = {ChannelIndex::INVALID}}; + mOldestPossibleOutput = { + .timeslice = {0}, + .channel = {ChannelIndex::INVALID}, + .slot = {(size_t)-1}}; + for (auto& channel : mChannels) { + channel.oldestForChannel = {0}; + } +} + } // namespace o2::framework