Skip to content

Commit 29dd203

Browse files
committed
DPL: set TimingInfo field accordingly on new Run
1 parent 9f279ee commit 29dd203

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

Framework/Core/include/Framework/DataProcessingContext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ struct DataProcessorContext {
3030
// not shared by threads.
3131
bool* wasActive = nullptr;
3232
bool allDone = false;
33+
/// Latest run number we processed globally for this DataProcessor.
34+
int64_t lastRunNumberProcessed = 0;
3335

3436
// These are pointers to the one owned by the DataProcessingDevice
3537
// but they are fully reentrant / thread safe and therefore can

Framework/Core/include/Framework/TimingInfo.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ struct TimingInfo {
2929
uint32_t runNumber = -1;
3030
uint64_t creation = -1UL;
3131
uint64_t lapse = 0; // time at the start of the processing. Per thread.
32+
/// Wether this TimingInfo refers to the first timeframe
33+
/// from a new run.
34+
bool globalRunNumberChanged = false;
35+
/// Wether this TimingInfo refers to the first timeframe
36+
/// from a new run, as being processed by the current stream.
37+
/// FIXME: for now this is the same as the above.
38+
bool streamRunNumberChanged = false;
3239
};
3340

3441
} // namespace o2::framework

Framework/Core/src/DataProcessingDevice.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,15 +1817,26 @@ bool DataProcessingDevice::tryDispatchComputation(ServiceRegistryRef ref, std::v
18171817
// create messages) because the messages need to have the timeslice id into
18181818
// it.
18191819
auto prepareAllocatorForCurrentTimeSlice = [ref](TimesliceSlot i) -> void {
1820+
auto& dataProcessorContext = ref.get<DataProcessorContext>();
18201821
auto& relayer = ref.get<DataRelayer>();
18211822
auto& timingInfo = ref.get<TimingInfo>();
18221823
ZoneScopedN("DataProcessingDevice::prepareForCurrentTimeslice");
18231824
auto timeslice = relayer.getTimesliceForSlot(i);
1825+
18241826
timingInfo.timeslice = timeslice.value;
18251827
timingInfo.tfCounter = relayer.getFirstTFCounterForSlot(i);
18261828
timingInfo.firstTForbit = relayer.getFirstTFOrbitForSlot(i);
18271829
timingInfo.runNumber = relayer.getRunNumberForSlot(i);
18281830
timingInfo.creation = relayer.getCreationTimeForSlot(i);
1831+
timingInfo.globalRunNumberChanged = dataProcessorContext.lastRunNumberProcessed <= timingInfo.runNumber;
1832+
// We report wether or not this timing info refers to a new Run.
1833+
if (timingInfo.globalRunNumberChanged) {
1834+
dataProcessorContext.lastRunNumberProcessed = timingInfo.runNumber;
1835+
}
1836+
// FIXME: for now there is only one stream, however we
1837+
// should calculate this correctly once we finally get the
1838+
// the StreamContext in.
1839+
timingInfo.streamRunNumberChanged = timingInfo.globalRunNumberChanged;
18291840
};
18301841

18311842
// When processing them, timers will have to be cleaned up

0 commit comments

Comments
 (0)