Skip to content

Commit 28e32fd

Browse files
committed
DPL will propagate DPH.creation time of 1st input slot
1 parent 87b9da2 commit 28e32fd

8 files changed

Lines changed: 25 additions & 2 deletions

File tree

Framework/Core/include/Framework/DataDescriptorMatcher.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ enum ContextPos {
4747
STARTTIME_POS = 0, /// The DataProcessingHeader::startTime associated to the timeslice
4848
TFCOUNTER_POS = 14, /// The DataHeader::tfCounter associated to the timeslice
4949
FIRSTTFORBIT_POS = 15, /// The DataHeader::firstTFOrbit associated to the timeslice
50-
RUNNUMBER_POS = 13 /// The DataHeader::runNumber associated to the timeslice
50+
RUNNUMBER_POS = 13, /// The DataHeader::runNumber associated to the timeslice
51+
CREATIONTIME_POS = 12 /// The DataProcessingHeader::creation associated to the timeslice
5152
};
5253

5354
/// An element of the matching context. Context itself is really a vector of

Framework/Core/include/Framework/DataRelayer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ class DataRelayer
137137
uint32_t getFirstTFCounterForSlot(TimesliceSlot slot);
138138
/// Get the runNumber associated to a given slot
139139
uint32_t getRunNumberForSlot(TimesliceSlot slot);
140+
/// Get the creation time associated to a given slot
141+
uint64_t getCreationTimeForSlot(TimesliceSlot slot);
140142
/// Remove all pending messages
141143
void clear();
142144

Framework/Core/include/Framework/TimingInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct TimingInfo {
2222
uint32_t firstTFOrbit = -1; /// the orbit the TF begins
2323
uint32_t tfCounter = -1; // the counter associated to a TF
2424
uint32_t runNumber = -1;
25+
uint64_t creation = -1UL;
2526
};
2627

2728
#endif // O2_FRAMEWORK_TIMINGINFO_H_

Framework/Core/include/Framework/VariableContextHelpers.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ struct VariableContextHelpers {
5858
}
5959
return *pval;
6060
}
61+
62+
static inline uint64_t getCreationTime(data_matcher::VariableContext const& variables)
63+
{
64+
// creation time is always at register 14
65+
auto pval = std::get_if<uint64_t>(&variables.get(data_matcher::CREATIONTIME_POS));
66+
if (pval == nullptr) {
67+
return -1UL;
68+
}
69+
return *pval;
70+
}
6171
};
6272
} // namespace o2::framework
6373

Framework/Core/src/DataAllocator.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ FairMQMessagePtr DataAllocator::headerMessageFromOutput(Output const& spec,
104104
dh.firstTForbit = timingInfo.firstTFOrbit;
105105
dh.runNumber = timingInfo.runNumber;
106106

107-
DataProcessingHeader dph{timingInfo.timeslice, 1};
107+
DataProcessingHeader dph{timingInfo.timeslice, 1, timingInfo.creation};
108108
auto& context = mRegistry->get<MessageContext>();
109109

110110
auto channelAlloc = o2::pmr::getTransportAllocator(context.proxy().getTransport(channel, 0));

Framework/Core/src/DataDescriptorMatcher.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ bool StartTimeValueMatcher::match(header::DataHeader const& dh, DataProcessingHe
106106
return (dph.startTime / mScale) == *value;
107107
}
108108
context.put({ref->index, dph.startTime / mScale});
109+
// We always put in 12 the creation time
110+
context.put({CREATIONTIME_POS, dph.creation});
109111
// We always put in 13 the runNumber
110112
context.put({RUNNUMBER_POS, dh.runNumber});
111113
// We always put in 14 the tfCounter

Framework/Core/src/DataProcessingDevice.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,7 @@ bool DataProcessingDevice::tryDispatchComputation(DataProcessorContext& context,
11941194
timingInfo->tfCounter = relayer->getFirstTFCounterForSlot(i);
11951195
timingInfo->firstTFOrbit = relayer->getFirstTFOrbitForSlot(i);
11961196
timingInfo->runNumber = relayer->getRunNumberForSlot(i);
1197+
timingInfo->creation = relayer->getCreationTimeForSlot(i);
11971198
};
11981199

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

Framework/Core/src/DataRelayer.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,12 @@ uint32_t DataRelayer::getRunNumberForSlot(TimesliceSlot slot)
746746
return VariableContextHelpers::getRunNumber(mTimesliceIndex.getVariablesForSlot(slot));
747747
}
748748

749+
uint64_t DataRelayer::getCreationTimeForSlot(TimesliceSlot slot)
750+
{
751+
std::scoped_lock<LockableBase(std::recursive_mutex)> lock(mMutex);
752+
return VariableContextHelpers::getCreationTime(mTimesliceIndex.getVariablesForSlot(slot));
753+
}
754+
749755
void DataRelayer::sendContextState()
750756
{
751757
std::scoped_lock<LockableBase(std::recursive_mutex)> lock(mMutex);

0 commit comments

Comments
 (0)