Skip to content

Commit eb3bfb0

Browse files
committed
added disableOutput param. Remove idling on outputfifo near-empty. Added average throughput in end stats.
1 parent 3f048c6 commit eb3bfb0

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/ReadoutEquipment.cxx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,17 @@ ReadoutEquipment::ReadoutEquipment(ConfigFile &cfg, std::string cfgEntryPoint) {
3434
cfg.getOptionalValue<std::string>(cfgEntryPoint + ".memoryPoolPageSize",cfgMemoryPoolPageSize);
3535
memoryPoolPageSize=(int)ReadoutUtils::getNumberOfBytesFromString(cfgMemoryPoolPageSize.c_str());
3636
cfg.getOptionalValue<int>(cfgEntryPoint + ".memoryPoolNumberOfPages", memoryPoolNumberOfPages);
37+
38+
// disable output?
39+
cfg.getOptionalValue<int>(cfgEntryPoint + ".disableOutput", disableOutput);
40+
3741

3842
// log config summary
3943
theLog.log("Equipment %s: from config [%s], max rate=%lf Hz, idleSleepTime=%d us, outputFifoSize=%d", name.c_str(), cfgEntryPoint.c_str(), readoutRate, cfgIdleSleepTime, cfgOutputFifoSize);
4044
theLog.log("Equipment %s: memory pool %d pages x %d bytes from bank %s", name.c_str(),(int) memoryPoolNumberOfPages, (int) memoryPoolPageSize, memoryBankName.c_str());
45+
if (disableOutput) {
46+
theLog.log("Equipment %s: output DISABLED ! Data will be readout and dropped immediately",name.c_str());
47+
}
4148

4249
// init stats
4350
equipmentStats.resize(EquipmentStatsIndexes::maxIndex);
@@ -79,7 +86,8 @@ void ReadoutEquipment::start() {
7986
}
8087

8188
void ReadoutEquipment::stop() {
82-
89+
90+
double runningTime=clk0.getTime();
8391
readoutThread->stop();
8492
//printf("%llu blocks in %.3lf seconds => %.1lf block/s\n",nBlocksOut,clk0.getTimer(),nBlocksOut/clk0.getTime());
8593
readoutThread->join();
@@ -94,6 +102,7 @@ void ReadoutEquipment::stop() {
94102

95103
theLog.log("Average pages pushed per iteration: %.1f",equipmentStats[EquipmentStatsIndexes::nBlocksOut].get()*1.0/(equipmentStats[EquipmentStatsIndexes::nLoop].get()-equipmentStats[EquipmentStatsIndexes::nIdle].get()));
96104
theLog.log("Average fifoready occupancy: %.1f",equipmentStats[EquipmentStatsIndexes::fifoOccupancyFreeBlocks].get()*1.0/(equipmentStats[EquipmentStatsIndexes::nLoop].get()-equipmentStats[EquipmentStatsIndexes::nIdle].get()));
105+
theLog.log("Average data throughput: %s",ReadoutUtils::NumberOfBytesToString(equipmentStats[EquipmentStatsIndexes::nBytesOut].get()/runningTime,"Bytes/s").c_str());
97106
}
98107

99108
ReadoutEquipment::~ReadoutEquipment() {
@@ -168,9 +177,11 @@ Thread::CallbackResult ReadoutEquipment::threadCallback(void *arg) {
168177
break;
169178
}
170179

171-
// push new page to output fifo
172-
ptr->dataOut->push(nextBlock);
173-
180+
if (!ptr->disableOutput) {
181+
// push new page to output fifo
182+
ptr->dataOut->push(nextBlock);
183+
}
184+
174185
// update rate-limit clock
175186
if (ptr->readoutRate>0) {
176187
ptr->clk.increment();
@@ -186,16 +197,15 @@ Thread::CallbackResult ReadoutEquipment::threadCallback(void *arg) {
186197
// consider inactive if we have not pushed much compared to free space in output fifo
187198
// todo: instead, have dynamic 'inactive sleep time' as function of actual outgoing page rate to optimize polling interval
188199
if (nPushedOut<ptr->dataOut->getNumberOfFreeSlots()/4) {
189-
isActive=0;
200+
// disabled, should not depend on output fifo size
201+
// isActive=0;
190202
}
191203

192204
// todo: add SLICER to aggregate together time-range data
193205
// todo: get other FIFO status
194206

195207
break;
196208
}
197-
198-
199209

200210
if (!isActive) {
201211
ptr->equipmentStats[EquipmentStatsIndexes::nIdle].increment();

0 commit comments

Comments
 (0)