Skip to content

Commit

Permalink
DPL: allow resetting the oldest possible timeframe mechanism (AliceO2…
Browse files Browse the repository at this point in the history
…Group#9895)

* DPL: allow resetting the oldest possible timeframe mechanism

* Update TimesliceIndex.h

* fix clang-format

---------

Co-authored-by: David Rohr <github@jwdt.org>
  • Loading branch information
ktf and davidrohr authored Nov 15, 2023
1 parent 317fe0b commit d72165d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Framework/Core/include/Framework/TimesliceIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions Framework/Core/src/CommonServices.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<TimesliceIndex>().reset();
decongestion->nextEnumerationTimeslice = 0;
decongestion->nextEnumerationTimesliceRewinded = false;
decongestion->lastTimeslice = 0;
Expand Down
15 changes: 15 additions & 0 deletions Framework/Core/src/TimesliceIndex.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d72165d

Please sign in to comment.