Skip to content

Commit 92fd0f0

Browse files
committed
added readout.disableTimeframes
1 parent 2df7f91 commit 92fd0f0

File tree

4 files changed

+64
-33
lines changed

4 files changed

+64
-33
lines changed

doc/releaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,7 @@ This file describes the main feature changes for each readout.exe released versi
354354
- equipment-cruemulator: TF id extracted from trigger counters (single timer source for improved coherency).
355355
- Memory allocation policy updated: all readout memory is locked (RAM only, can not be swapped). A warning is reported if not.
356356
- consumer-FMQchannel: checks are done before FMQ shared memory region is created, to avoid going in a state with over-committed memory (no checks done in FMQ library about the validity of the region created, which can cause severe crash when trying to access it). Both /proc/meminfo (MemFree) and /dev/shm (if using shmem transport type) should report enough available memory before proceeding. Memory is also immediately locked and zeroed to avoid later crashes.
357+
358+
## Next version
359+
- Updated configuration parameters:
360+
- added readout.disableTimefarmes: when set, all timeframe-related features are disabled (STF slicing, TF rate limits, etc). All data are tagged with TF id = 0. To be used for some calibration runs not using a central trigger clock.

src/ReadoutEquipment.cxx

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ ReadoutEquipment::ReadoutEquipment(ConfigFile& cfg, std::string cfgEntryPoint, b
100100
cfgTfRateLimit = 0;
101101
cfg.getOptionalValue<double>("readout.tfRateLimit", cfgTfRateLimit);
102102

103+
// get TF disable flag from toplevel config
104+
cfgDisableTimeframes = 0;
105+
cfg.getOptionalValue<int>("readout.disableTimeframes", cfgDisableTimeframes);
106+
103107
// log config summary
104108
theLog.log(LogInfoDevel_(3002), "Equipment %s: from config [%s], max rate=%lf Hz, idleSleepTime=%d us, outputFifoSize=%d", name.c_str(), cfgEntryPoint.c_str(), readoutRate, cfgIdleSleepTime, cfgOutputFifoSize);
105109
theLog.log(LogInfoDevel_(3008), "Equipment %s: requesting memory pool %d pages x %d bytes from bank '%s', block aligned @ 0x%X, 1st page offset @ 0x%X", name.c_str(), (int)memoryPoolNumberOfPages, (int)memoryPoolPageSize, memoryBankName.c_str(), (int)cfgBlockAlign, (int)cfgFirstPageOffset);
@@ -120,22 +124,24 @@ ReadoutEquipment::ReadoutEquipment(ConfigFile& cfg, std::string cfgEntryPoint, b
120124
cfg.getOptionalValue<int>(cfgEntryPoint + ".rdhUseFirstInPageEnabled", cfgRdhUseFirstInPageEnabled);
121125
theLog.log(LogInfoDevel_(3002), "RDH settings: rdhCheckEnabled=%d rdhDumpEnabled=%d rdhDumpErrorEnabled=%d rdhDumpWarningEnabled=%d rdhUseFirstInPageEnabled=%d", cfgRdhCheckEnabled, cfgRdhDumpEnabled, cfgRdhDumpErrorEnabled, cfgRdhDumpWarningEnabled, cfgRdhUseFirstInPageEnabled);
122126

123-
// configuration parameter: | equipment-* | TFperiod | int | 256 | Duration of a timeframe, in number of LHC orbits. |
124-
int cfgTFperiod = 256;
125-
cfg.getOptionalValue<int>(cfgEntryPoint + ".TFperiod", cfgTFperiod);
126-
timeframePeriodOrbits = cfgTFperiod;
127+
if (!cfgDisableTimeframes) {
128+
// configuration parameter: | equipment-* | TFperiod | int | 256 | Duration of a timeframe, in number of LHC orbits. |
129+
int cfgTFperiod = 256;
130+
cfg.getOptionalValue<int>(cfgEntryPoint + ".TFperiod", cfgTFperiod);
131+
timeframePeriodOrbits = cfgTFperiod;
127132

128-
if (!cfgRdhUseFirstInPageEnabled) {
129-
usingSoftwareClock = true; // if RDH disabled, use internal clock for TF id
130-
}
131-
theLog.log(LogInfoDevel_(3002), "Timeframe length = %d orbits", (int)timeframePeriodOrbits);
132-
if (usingSoftwareClock) {
133-
timeframeRate = LHCOrbitRate * 1.0 / timeframePeriodOrbits; // timeframe rate, in Hz
134-
theLog.log(LogInfoDevel_(3002), "Timeframe IDs generated by software, %.2lf Hz", timeframeRate);
135-
} else {
136-
theLog.log(LogInfoDevel_(3002), "Timeframe IDs generated from RDH trigger counters");
133+
if (!cfgRdhUseFirstInPageEnabled) {
134+
usingSoftwareClock = true; // if RDH disabled, use internal clock for TF id
135+
}
136+
theLog.log(LogInfoDevel_(3002), "Timeframe length = %d orbits", (int)timeframePeriodOrbits);
137+
if (usingSoftwareClock) {
138+
timeframeRate = LHCOrbitRate * 1.0 / timeframePeriodOrbits; // timeframe rate, in Hz
139+
theLog.log(LogInfoDevel_(3002), "Timeframe IDs generated by software, %.2lf Hz", timeframeRate);
140+
} else {
141+
theLog.log(LogInfoDevel_(3002), "Timeframe IDs generated from RDH trigger counters");
142+
}
137143
}
138-
144+
139145
// init stats
140146
equipmentStats.resize(EquipmentStatsIndexes::maxIndex);
141147
equipmentStatsLast.resize(EquipmentStatsIndexes::maxIndex);
@@ -346,9 +352,14 @@ Thread::CallbackResult ReadoutEquipment::threadCallback(void* arg)
346352
ptr->currentBlockId++; // don't start from 0
347353
nextBlock->getData()->header.blockId = ptr->currentBlockId;
348354

349-
// tag data with (dummy) timeframeid, if none set
350-
if (nextBlock->getData()->header.timeframeId == undefinedTimeframeId) {
351-
nextBlock->getData()->header.timeframeId = ptr->getCurrentTimeframe();
355+
if (ptr->cfgDisableTimeframes) {
356+
// disable TF id
357+
nextBlock->getData()->header.timeframeId = undefinedTimeframeId;
358+
} else {
359+
// tag data with (dummy) timeframeid, if none set
360+
if (nextBlock->getData()->header.timeframeId == undefinedTimeframeId) {
361+
nextBlock->getData()->header.timeframeId = ptr->getCurrentTimeframe();
362+
}
352363
}
353364

354365
// tag data with run number
@@ -647,14 +658,16 @@ int ReadoutEquipment::processRdh(DataBlockContainerReference& block)
647658
}
648659

649660
// check no timeframe overlap in page
650-
if (((blockHeader.timeframeOrbitFirst < blockHeader.timeframeOrbitLast) && ((h.getTriggerOrbit() < blockHeader.timeframeOrbitFirst) || (h.getTriggerOrbit() > blockHeader.timeframeOrbitLast))) || ((blockHeader.timeframeOrbitFirst > blockHeader.timeframeOrbitLast) && ((h.getTriggerOrbit() < blockHeader.timeframeOrbitFirst) && (h.getTriggerOrbit() > blockHeader.timeframeOrbitLast)))) {
651-
if (cfgRdhDumpErrorEnabled) {
652-
theLog.log(logRdhErrorsToken, "Equipment %d RDH #%d @ 0x%X : TimeFrame ID change in page not allowed : orbit 0x%08X not in range [0x%08X,0x%08X]", id, rdhIndexInPage, (unsigned int)pageOffset, (int)h.getTriggerOrbit(), (int)blockHeader.timeframeOrbitFirst, (int)blockHeader.timeframeOrbitLast);
653-
}
654-
statsRdhCheckStreamErr++;
655-
break; // stop checking this page
661+
if (!cfgDisableTimeframes) {
662+
if (((blockHeader.timeframeOrbitFirst < blockHeader.timeframeOrbitLast) && ((h.getTriggerOrbit() < blockHeader.timeframeOrbitFirst) || (h.getTriggerOrbit() > blockHeader.timeframeOrbitLast))) || ((blockHeader.timeframeOrbitFirst > blockHeader.timeframeOrbitLast) && ((h.getTriggerOrbit() < blockHeader.timeframeOrbitFirst) && (h.getTriggerOrbit() > blockHeader.timeframeOrbitLast)))) {
663+
if (cfgRdhDumpErrorEnabled) {
664+
theLog.log(logRdhErrorsToken, "Equipment %d RDH #%d @ 0x%X : TimeFrame ID change in page not allowed : orbit 0x%08X not in range [0x%08X,0x%08X]", id, rdhIndexInPage, (unsigned int)pageOffset, (int)h.getTriggerOrbit(), (int)blockHeader.timeframeOrbitFirst, (int)blockHeader.timeframeOrbitLast);
665+
}
666+
statsRdhCheckStreamErr++;
667+
break; // stop checking this page
668+
}
656669
}
657-
670+
658671
/*
659672
// check packetCounter is contiguous
660673
if (cfgRdhCheckPacketCounterContiguous) {

src/ReadoutEquipment.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class ReadoutEquipment
155155
int cfgRdhUseFirstInPageEnabled = 0; // flag to enable reading of first RDH in page to populate readout headers
156156
//int cfgRdhCheckPacketCounterContiguous = 1; // flag to enable checking if RDH packetCounter value contiguous (done link-by-link)
157157
double cfgTfRateLimit = 0; // TF rate limit, to throttle data readout
158+
int cfgDisableTimeframes = 0; // When set, all TF features disabled
158159
RateRegulator TFregulator; // clock counter for TF rate checks
159160
DataBlockContainerReference throttlePendingBlock; // in case TF rate limit was reached, a block may be set aside for later (when it belongs to next TF)
160161

src/mainReadout.cxx

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class Readout
143143
// configuration parameters
144144
double cfgExitTimeout;
145145
double cfgFlushEquipmentTimeout;
146+
int cfgDisableTimeframes;
146147
int cfgDisableAggregatorSlicing;
147148
double cfgAggregatorSliceTimeout;
148149
double cfgAggregatorStfTimeout;
@@ -468,10 +469,21 @@ int Readout::configure(const boost::property_tree::ptree& properties)
468469
// configuration parameter: | readout | tfRateLimit | double | 0 | When set, the output is limited to a given timeframe rate. |
469470
cfgTfRateLimit = 0;
470471
cfg.getOptionalValue<double>("readout.tfRateLimit", cfgTfRateLimit);
472+
473+
// configuration parameter: | readout | disableTimeframes | int | 0 | When set, all timeframe related features are disabled (this may supersede other config parameters). |
474+
cfgDisableTimeframes = 0;
475+
cfg.getOptionalValue<int>("readout.disableTimeframes", cfgDisableTimeframes);
476+
if (cfgDisableTimeframes) {
477+
cfgDisableAggregatorSlicing = 1;
478+
cfgTfRateLimit = 0;
479+
theLog.log(LogInfoDevel, "Timeframes disabled");
480+
}
481+
471482
if (cfgTfRateLimit > 0) {
472483
theLog.log(LogInfoDevel, "Timeframe rate limit = % .2lf Hz", cfgTfRateLimit);
473484
}
474485

486+
475487
// configuration parameter: | readout | logbookEnabled | int | 0 | When set, the logbook is enabled and populated with readout stats at runtime. |
476488
cfgLogbookEnabled = 0;
477489
cfg.getOptionalValue<int>("readout.logbookEnabled", cfgLogbookEnabled);
@@ -828,15 +840,16 @@ int Readout::start()
828840
if (cfgDisableAggregatorSlicing) {
829841
theLog.log(LogInfoDevel, "Aggregator slicing disabled");
830842
agg->disableSlicing = 1;
831-
}
832-
if (cfgAggregatorSliceTimeout > 0) {
833-
theLog.log(LogInfoDevel, "Aggregator slice timeout = %.2lf seconds", cfgAggregatorSliceTimeout);
834-
agg->cfgSliceTimeout = cfgAggregatorSliceTimeout;
835-
}
836-
if (cfgAggregatorStfTimeout > 0) {
837-
theLog.log(LogInfoDevel, "Aggregator subtimeframe timeout = %.2lf seconds", cfgAggregatorStfTimeout);
838-
agg->cfgStfTimeout = cfgAggregatorStfTimeout;
839-
agg->enableStfBuilding = 1;
843+
} else {
844+
if (cfgAggregatorSliceTimeout > 0) {
845+
theLog.log(LogInfoDevel, "Aggregator slice timeout = %.2lf seconds", cfgAggregatorSliceTimeout);
846+
agg->cfgSliceTimeout = cfgAggregatorSliceTimeout;
847+
}
848+
if (cfgAggregatorStfTimeout > 0) {
849+
theLog.log(LogInfoDevel, "Aggregator subtimeframe timeout = %.2lf seconds", cfgAggregatorStfTimeout);
850+
agg->cfgStfTimeout = cfgAggregatorStfTimeout;
851+
agg->enableStfBuilding = 1;
852+
}
840853
}
841854

842855
agg->start();

0 commit comments

Comments
 (0)