Skip to content

Commit d72165d

Browse files
ktfdavidrohr
andauthored
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 <github@jwdt.org>
1 parent 317fe0b commit d72165d

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

Framework/Core/include/Framework/TimesliceIndex.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ class TimesliceIndex
133133
OldestOutputInfo updateOldestPossibleOutput();
134134
[[nodiscard]] InputChannelInfo const& getChannelInfo(ChannelIndex channel) const;
135135

136+
// Reset the TimesliceIndex to its initial state
137+
auto reset() -> void;
138+
136139
private:
137140
/// @return the oldest slot possible so that we can eventually override it.
138141
/// This is the timeslices for all the in flight parts.

Framework/Core/src/CommonServices.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ o2::framework::ServiceSpec CommonServices::decongestionSpec()
509509
decongestion->lastTimeslice = oldestPossibleOutput.timeslice.value; },
510510
.stop = [](ServiceRegistryRef services, void* service) {
511511
auto* decongestion = (DecongestionService*)service;
512+
services.get<TimesliceIndex>().reset();
512513
decongestion->nextEnumerationTimeslice = 0;
513514
decongestion->nextEnumerationTimesliceRewinded = false;
514515
decongestion->lastTimeslice = 0;

Framework/Core/src/TimesliceIndex.cxx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,19 @@ InputChannelInfo const& TimesliceIndex::getChannelInfo(ChannelIndex channel) con
205205
return mChannels[channel.value];
206206
}
207207

208+
auto TimesliceIndex::reset() -> void
209+
{
210+
mOldestPossibleInput = {
211+
.timeslice = {0},
212+
/// The actual channel id of the oldest input.
213+
.channel = {ChannelIndex::INVALID}};
214+
mOldestPossibleOutput = {
215+
.timeslice = {0},
216+
.channel = {ChannelIndex::INVALID},
217+
.slot = {(size_t)-1}};
218+
for (auto& channel : mChannels) {
219+
channel.oldestForChannel = {0};
220+
}
221+
}
222+
208223
} // namespace o2::framework

0 commit comments

Comments
 (0)