Skip to content

Commit 0cd8417

Browse files
authored
Merge pull request #242 from sy-c/master
v2.16.1
2 parents 05bf1a0 + 93d27e1 commit 0cd8417

19 files changed

+278
-67
lines changed

CMakeLists.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ find_package(FairMQ)
7171
find_package(ZLIB)
7272
find_package(RDMA)
7373
find_package(Occ)
74-
find_package(BookkeepingApiCpp)
74+
find_package(BookkeepingApi)
7575
find_package(ZMQ)
7676
find_package(MySQL)
7777
#find_package(gperftools)
@@ -116,13 +116,13 @@ else ()
116116
endif(Occ_FOUND)
117117

118118
# check Bookkeeping
119-
if (BookkeepingApiCpp_FOUND)
120-
get_target_property(BookkeepingApiCpp_INCLUDES BookkeepingApiCpp INTERFACE_INCLUDE_DIRECTORIES)
121-
# get_target_property(BookkeepingApiCpp_LIBRARIES BookkeepingApiCpp INTERFACE_LINK_LIBRARIES)
122-
message(STATUS "Bookkeeping found")
119+
if (BookkeepingApi_FOUND)
120+
get_target_property(BookkeepingApi_INCLUDES AliceO2::BookkeepingApi INTERFACE_INCLUDE_DIRECTORIES)
121+
get_target_property(BookkeepingApi_LIBRARIES AliceO2::BookkeepingApi INTERFACE_LINK_LIBRARIES)
122+
message(STATUS "Bookkeeping found: ${BookkeepingApi_INCLUDES} ${BookkeepingApi_LIBRARIES}")
123123
else ()
124124
message(STATUS "Bookkeeping not found, corresponding features will be disabled.")
125-
endif(BookkeepingApiCpp_FOUND)
125+
endif(BookkeepingApi_FOUND)
126126

127127
# check ZMQ
128128
if(${ZMQ_FOUND})
@@ -149,7 +149,7 @@ endif()
149149

150150

151151
# add flags to enable optional features in Readout, based on available dependencies
152-
add_compile_definitions($<$<BOOL:${Numa_FOUND}>:WITH_NUMA> $<$<BOOL:${RDMA_FOUND}>:WITH_RDMA> $<$<BOOL:${Configuration_FOUND}>:WITH_CONFIG> $<$<BOOL:${FairMQ_FOUND}>:WITH_FAIRMQ> $<$<BOOL:${Occ_FOUND}>:WITH_OCC> $<$<BOOL:${BookkeepingApiCpp_FOUND}>:WITH_LOGBOOK> $<$<BOOL:${ZMQ_FOUND}>:WITH_ZMQ> $<$<BOOL:${MYSQL_FOUND}>:WITH_DB> $<$<BOOL:${ReadoutCard_FOUND}>:WITH_READOUTCARD> $<$<BOOL:${gperftools_FOUND}>:WITH_GPERFTOOLS>)
152+
add_compile_definitions($<$<BOOL:${Numa_FOUND}>:WITH_NUMA> $<$<BOOL:${RDMA_FOUND}>:WITH_RDMA> $<$<BOOL:${Configuration_FOUND}>:WITH_CONFIG> $<$<BOOL:${FairMQ_FOUND}>:WITH_FAIRMQ> $<$<BOOL:${Occ_FOUND}>:WITH_OCC> $<$<BOOL:${BookkeepingApi_FOUND}>:WITH_LOGBOOK> $<$<BOOL:${ZMQ_FOUND}>:WITH_ZMQ> $<$<BOOL:${MYSQL_FOUND}>:WITH_DB> $<$<BOOL:${ReadoutCard_FOUND}>:WITH_READOUTCARD> $<$<BOOL:${gperftools_FOUND}>:WITH_GPERFTOOLS>)
153153

154154
# define include directories
155155
set(READOUT_INCLUDE_DIRS
@@ -161,7 +161,7 @@ set(READOUT_INCLUDE_DIRS
161161
${Configuration_INCLUDE_DIRS}
162162
${FairMQ_INCLUDE_DIRS}
163163
${Occ_INCLUDE_DIRS}
164-
${BookkeepingApiCpp_INCLUDES}
164+
${BookkeepingApi_INCLUDES}
165165
)
166166

167167
# define liraries to be linked
@@ -173,7 +173,7 @@ set(READOUT_LINK_LIBRARIES
173173
$<$<BOOL:${Configuration_FOUND}>:AliceO2::Configuration>
174174
$<$<BOOL:${FairMQ_FOUND}>:FairMQ::FairMQ>
175175
$<$<BOOL:${Occ_FOUND}>:AliceO2::Occ>
176-
$<$<BOOL:${BookkeepingApiCpp_FOUND}>:BookkeepingApiCpp>
176+
$<$<BOOL:${BookkeepingApi_FOUND}>:AliceO2::BookkeepingApi>
177177
)
178178
if(Numa_FOUND)
179179
list(APPEND READOUT_LINK_LIBRARIES ${Numa_LIBRARIES})
@@ -460,7 +460,7 @@ add_executable(
460460
)
461461

462462
# a minimal test program to check Bookkeeping library
463-
if (BookkeepingApiCpp_FOUND)
463+
if (BookkeepingApi_FOUND)
464464
add_executable(
465465
o2-readout-test-lib-bookkeeping
466466
${SOURCE_DIR}/testBookkeeping.cxx
@@ -488,7 +488,7 @@ endif()
488488
if (${ZMQ_FOUND})
489489
list (APPEND executables o2-readout-test-zmq-client o2-readout-test-zmq-server o2-readout-eventdump)
490490
endif()
491-
if (BookkeepingApiCpp_FOUND)
491+
if (BookkeepingApi_FOUND)
492492
list (APPEND executables o2-readout-test-lib-bookkeeping)
493493
endif()
494494
if (MYSQL_FOUND)

doc/configurationParameters.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ The parameters related to 3rd-party libraries are described here for convenience
115115
| equipment-* | rdhCheckDetectorField | int | 0 | If set, the detector field is checked and changes reported. |
116116
| equipment-* | rdhCheckEnabled | int | 0 | If set, data pages are parsed and RDH headers checked. Errors are reported in logs. |
117117
| equipment-* | rdhCheckFirstOrbit | int | 1 | If set, it is checked that the first orbit of all equipments and links is the same. If not, run is stopped. |
118+
| equipment-* | rdhCheckTrigger | int | 0 | If set, the RDH trigger counters are checked for consistency. |
118119
| equipment-* | rdhDumpEnabled | int | 0 | If set, data pages are parsed and RDH headers summary printed on console. Setting a negative number will print only the first N pages.|
119120
| equipment-* | rdhDumpErrorEnabled | int | 1 | If set, a log message is printed for each RDH header error found.|
120121
| equipment-* | rdhDumpFirstInPageEnabled | int | 0 | If set, the first RDH in each data page is logged. Setting a negative number will printit only for the first N pages. |
@@ -132,9 +133,11 @@ The parameters related to 3rd-party libraries are described here for convenience
132133
| equipment-cruemulator-* | feeId | int | 0 | Front-End Electronics Id, used for FEE Id field in RDH. |
133134
| equipment-cruemulator-* | HBperiod | int | 1 | Interval between 2 HeartBeat triggers, in number of LHC orbits. |
134135
| equipment-cruemulator-* | linkId | int | 0 | Id of first link. If numberOfLinks>1, ids will range from linkId to linkId+numberOfLinks-1. |
136+
| equipment-cruemulator-* | linkThroughput | double | 3.2 | The data throughput of each link, in Gbps. |
135137
| equipment-cruemulator-* | maxBlocksPerPage | int | 0 | [obsolete- not used]. Maximum number of blocks per page. |
136138
| equipment-cruemulator-* | numberOfLinks | int | 1 | Number of GBT links simulated by equipment. |
137139
| equipment-cruemulator-* | PayloadSize | int | 64k | Maximum payload size for each trigger. Actual size is randomized, and then split in a number of (cruBlockSize) packets. |
140+
| equipment-cruemulator-* | PayloadSizeStdev | double | 0.0 | Standard deviation of randomized PayloadSize (no unit, as a fraction of PayloadSize). |
138141
| equipment-cruemulator-* | systemId | int | 19 | System Id, used for System Id field in RDH. By default, using the TEST code. |
139142
| equipment-cruemulator-* | triggerRate | double | 0 | If set, the HB frame rate is limited to given value in Hz (1 HBF per data page). |
140143
| equipment-dummy-* | eventMaxSize | bytes | 128k | Maximum size of randomly generated event. |

doc/releaseNotes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,3 +511,12 @@ This file describes the main feature changes for each readout.exe released versi
511511
- Updated configuration parameters:
512512
- added consumer-fileRecorder-*.dropEmptyHBFramesTriggerMask: when using dropEmptyHBFrames = 1, keep some empty HB frames with trigger type matching given (decimal) mask.
513513
- Added support for RDHv7. Readout already accepts data from equipments with v7, but still generates data (internal sw generator) with v6, for compatibility with current software downstream.
514+
515+
## v2.16.1 - 16/02/2022
516+
- Updated configuration parameters:
517+
- added equipemnt-*.rdhCheckTrigger: when set, enables some consistency checks on trigger counters, as follows:
518+
- Trigger type TF should happen only on orbits % TF period = 0.
519+
- First trigger received on each link should be SOC or SOT.
520+
- added equipment-cruemulator-*.PayloadSizeStdev: generate payload with random size (gaussian distribution mean=PayloadSize sigma=PayloadSizeStdev).
521+
- added equipment-cruemulator-*.linkThroughput: set incoming link data throughput (in Gbps).
522+
- Minor logging updates.

src/MemoryBankManager.cxx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "ReadoutUtils.h"
1414
#include <unistd.h>
1515
#include <sys/mman.h>
16+
#include <thread>
1617

1718
#include "readoutInfoLogger.h"
1819

@@ -141,7 +142,34 @@ std::shared_ptr<MemoryPagesPool> MemoryBankManager::getPagedPool(size_t pageSize
141142
#else
142143
mlock(blockAddress, blockSize);
143144
#endif
144-
bzero(blockAddress, blockSize);
145+
const int nMemThreads = 1;
146+
if (nMemThreads <= 1) {
147+
bzero(blockAddress, blockSize);
148+
} else {
149+
// parallel
150+
std::thread memThreads[nMemThreads];
151+
char *ptr = (char *)blockAddress;
152+
char *ptrEnd = (char *)blockAddress + blockSize;
153+
const size_t blockUnit = 128 * 1024UL * 1024UL; // block unit = 128MB
154+
int nThreads = 0;
155+
for (int i = 0; i<nMemThreads; i++) {
156+
size_t sz = blockSize / nMemThreads;
157+
sz = sz + (blockUnit - ((size_t)ptr + sz) % blockUnit); // round up to next block
158+
if ((ptr + sz > ptrEnd) || (i + 1 == nMemThreads)) {
159+
sz = ptrEnd - ptr;
160+
}
161+
theLog.log(LogDebugDevel, "Thread %d - zero %p - %llu", i, ptr, (unsigned long long)sz);
162+
memThreads[i] = std::thread(bzero, ptr, sz);
163+
ptr += sz;
164+
nThreads++;
165+
if (ptr >= ptrEnd) {
166+
break;
167+
}
168+
}
169+
for (int i = 0; i < nThreads; i++) {
170+
memThreads[i].join();
171+
}
172+
}
145173
theLog.log(LogInfoDevel, "Zero memory done");
146174

147175
if (numaNode >= 0) {

src/RAWDataHeader.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ typedef struct _RAWDataHeaderV6 {
504504

505505
} RAWDataHeaderV6;
506506

507+
// as defined in https://gitlab.cern.ch/AliceO2Group/wp6-doc/-/blob/master/rdh/RDHv7.md
507508
typedef struct _RAWDataHeaderV7 {
508509
// 32-bits words
509510

@@ -640,6 +641,36 @@ typedef struct _RAWDataHeaderV7 {
640641

641642
} RAWDataHeaderV7;
642643

644+
// definition of triggerType RDH field
645+
typedef struct _RDHTriggerType {
646+
union {
647+
uint32_t word0 = 0;
648+
struct {
649+
uint32_t ORBIT : 1;
650+
uint32_t HB : 1;
651+
uint32_t HBr : 1;
652+
uint32_t HC : 1;
653+
uint32_t PhT : 1;
654+
uint32_t PP : 1;
655+
uint32_t Cal : 1;
656+
uint32_t SOT : 1;
657+
uint32_t EOT : 1;
658+
uint32_t SOC : 1;
659+
uint32_t EOC : 1;
660+
uint32_t TF : 1;
661+
uint32_t FErst : 1;
662+
uint32_t RT : 1;
663+
uint32_t RS : 1;
664+
uint32_t spare : 12;
665+
uint32_t LHCgap1 : 1;
666+
uint32_t LHCgap2 : 1;
667+
uint32_t TPCsync : 1;
668+
uint32_t TPCrst : 1;
669+
uint32_t TOF : 1;
670+
};
671+
};
672+
} RDHTriggerType;
673+
643674
using RAWDataHeader = RAWDataHeaderV6;
644675

645676
// expecting 16*32bits = 64 bytes

src/RdhUtils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class RdhHandle
5858
inline uint32_t getTriggerOrbit() { return (uint32_t)rdhPtr->triggerOrbit; }
5959
inline uint32_t getTriggerBC() { return (uint32_t)rdhPtr->triggerBC; }
6060
inline uint32_t getTriggerType() { return (uint32_t)rdhPtr->triggerType; }
61+
inline o2::Header::RDHTriggerType getTriggerTypeStruct() { o2::Header::RDHTriggerType tt; tt.word0 = rdhPtr->triggerType; return tt; }
6162
inline uint16_t getCruId() { return (uint16_t)rdhPtr->cruId; }
6263
inline uint8_t getEndPointId() { return (uint8_t)rdhPtr->dpwId; }
6364
inline uint32_t getDetectorField() { return (uint32_t)rdhPtr->detectorField; }

src/ReadoutEquipment.cxx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ ReadoutEquipment::ReadoutEquipment(ConfigFile& cfg, std::string cfgEntryPoint, b
143143
cfg.getOptionalValue<int>(cfgEntryPoint + ".rdhCheckFirstOrbit", cfgRdhCheckFirstOrbit);
144144
// configuration parameter: | equipment-* | rdhCheckDetectorField | int | 0 | If set, the detector field is checked and changes reported. |
145145
cfg.getOptionalValue<int>(cfgEntryPoint + ".rdhCheckDetectorField", cfgRdhCheckDetectorField);
146+
// configuration parameter: | equipment-* | rdhCheckTrigger | int | 0 | If set, the RDH trigger counters are checked for consistency. |
147+
cfg.getOptionalValue<int>(cfgEntryPoint + ".rdhCheckTrigger", cfgRdhCheckTrigger);
146148
theLog.log(LogInfoDevel_(3002), "RDH settings: rdhCheckEnabled=%d rdhDumpEnabled=%d rdhDumpErrorEnabled=%d rdhDumpWarningEnabled=%d rdhUseFirstInPageEnabled=%d rdhCheckFirstOrbit=%d rdhCheckDetectorField=%d", cfgRdhCheckEnabled, cfgRdhDumpEnabled, cfgRdhDumpErrorEnabled, cfgRdhDumpWarningEnabled, cfgRdhUseFirstInPageEnabled, cfgRdhCheckFirstOrbit, cfgRdhCheckDetectorField);
147149

148150
// configuration parameter: | equipment-* | ctpMode | int | 0 | If set, the detector field (CTP run mask) is checked. Incoming data is discarded until a new bit is set, and discarded again after this bit is unset. Automatically implies rdhCheckDetectorField=1 and rdhCheckDetectorField=1. |
@@ -845,6 +847,14 @@ int ReadoutEquipment::processRdh(DataBlockContainerReference& block)
845847
}
846848
equipmentLinksData[linkId].firstOrbit = orbitId;
847849
equipmentLinksData[linkId].firstOrbitIsDefined = 1;
850+
851+
if (cfgRdhCheckTrigger) {
852+
// first data from link should be SOC or SOT trigger type
853+
if (! (h.getTriggerTypeStruct().SOC || h.getTriggerTypeStruct().SOT)) {
854+
theLog.log(LogErrorSupport_(3241), "Equipment %s : first RDH of link %d is not SOC or SOT, trigger type = 0x%X", name.c_str(), linkId, h.getTriggerTypeStruct().word0);
855+
}
856+
}
857+
848858
}
849859
}
850860
}
@@ -938,6 +948,22 @@ int ReadoutEquipment::processRdh(DataBlockContainerReference& block)
938948
break; // stop checking this page
939949
}
940950
}
951+
952+
// check trigger counters
953+
if (cfgRdhCheckTrigger) {
954+
if (h.getTriggerTypeStruct().TF) {
955+
// TF boundary should be aligned with TF length
956+
if (h.getHbOrbit() % timeframePeriodOrbits) {
957+
if (cfgRdhDumpErrorEnabled) {
958+
theLog.log(logRdhErrorsToken, "Equipment %d Link %d RDH %d @ 0x%X : TriggerType TF bit set, but orbit 0x%08X not aligned with TF period = %d", id, (int)blockHeader.linkId, rdhIndexInPage, (unsigned int)pageOffset, (int)h.getTriggerOrbit(), (int)timeframePeriodOrbits);
959+
isPageError = 1;
960+
}
961+
statsRdhCheckStreamErr++;
962+
break; // stop checking this page
963+
}
964+
}
965+
}
966+
941967
/*
942968
// check packetCounter is contiguous
943969
if (cfgRdhCheckPacketCounterContiguous) {

src/ReadoutEquipment.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ class ReadoutEquipment
176176
int cfgRdhUseFirstInPageEnabled = 0; // flag to enable reading of first RDH in page to populate readout headers
177177
int cfgRdhDumpFirstInPageEnabled = 0;// flag to enable RDH dump of first header in page
178178
int cfgRdhCheckFirstOrbit = 1; // flag to enable RDH check of first orbit is the same in all equipments
179+
int cfgRdhCheckTrigger = 0; // flag to enable RDH check of trigger counters
179180
//int cfgRdhCheckPacketCounterContiguous = 1; // flag to enable checking if RDH packetCounter value contiguous (done link-by-link)
180181
int cfgRdhCheckDetectorField = 0; // flag to enable checking for changes in detector field
181182
double cfgTfRateLimit = 0; // TF rate limit, to throttle data readout

src/ReadoutEquipmentCruEmulator.cxx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <Common/Fifo.h>
1313
#include <Common/Timer.h>
1414
#include <stdlib.h>
15+
#include <random>
16+
#include <cmath>
1517

1618
#include "RAWDataHeader.h"
1719
#include "ReadoutEquipment.h"
@@ -54,6 +56,11 @@ class ReadoutEquipmentCruEmulator : public ReadoutEquipment
5456

5557
double cfgEmptyHbRatio = 0.0; // amount of empty HB frames
5658
int cfgPayloadSize = 64 * 1024; // maximum payload size, randomized
59+
double cfgPayloadSizeStdev = 0.0; // standard deviation of randomized payload size
60+
61+
std::random_device payloadRd{};
62+
std::mt19937 payloadGen{payloadRd()};
63+
std::normal_distribution<double> payloadDistrib{};
5764

5865
double cfgTriggerRate = 0.0; // if set, generate blocks at given rate instead of continuously
5966
unsigned long long nBlocksPerLink = 0; // number of blocks sent
@@ -93,7 +100,9 @@ ReadoutEquipmentCruEmulator::ReadoutEquipmentCruEmulator(ConfigFile& cfg, std::s
93100
// configuration parameter: | equipment-cruemulator-* | HBperiod | int | 1 | Interval between 2 HeartBeat triggers, in number of LHC orbits. |
94101
// configuration parameter: | equipment-cruemulator-* | EmptyHbRatio | double | 0 | Fraction of empty HBframes, to simulate triggered detectors. |
95102
// configuration parameter: | equipment-cruemulator-* | PayloadSize | int | 64k | Maximum payload size for each trigger. Actual size is randomized, and then split in a number of (cruBlockSize) packets. |
103+
// configuration parameter: | equipment-cruemulator-* | PayloadSizeStdev | double | 0.0 | Standard deviation of randomized PayloadSize (no unit, as a fraction of PayloadSize). |
96104
// configuration parameter: | equipment-cruemulator-* | triggerRate | double | 0 | If set, the HB frame rate is limited to given value in Hz (1 HBF per data page). |
105+
// configuration parameter: | equipment-cruemulator-* | linkThroughput | double | 3.2 | The data throughput of each link, in Gbps. |
97106
cfg.getOptionalValue<int>(cfgEntryPoint + ".maxBlocksPerPage", cfgMaxBlocksPerPage, (int)0);
98107
cfg.getOptionalValue<int>(cfgEntryPoint + ".cruBlockSize", cruBlockSize, (int)8192);
99108
cfg.getOptionalValue<int>(cfgEntryPoint + ".numberOfLinks", cfgNumberOfLinks, (int)1);
@@ -105,10 +114,12 @@ ReadoutEquipmentCruEmulator::ReadoutEquipmentCruEmulator(ConfigFile& cfg, std::s
105114
cfg.getOptionalValue<int>(cfgEntryPoint + ".HBperiod", cfgHBperiod);
106115
cfg.getOptionalValue<double>(cfgEntryPoint + ".EmptyHbRatio", cfgEmptyHbRatio);
107116
cfg.getOptionalValue<int>(cfgEntryPoint + ".PayloadSize", cfgPayloadSize);
117+
cfg.getOptionalValue<double>(cfgEntryPoint + ".PayloadSizeStdev", cfgPayloadSizeStdev);
108118
cfg.getOptionalValue<double>(cfgEntryPoint + ".triggerRate", cfgTriggerRate);
119+
cfg.getOptionalValue<double>(cfgEntryPoint + ".linkThroughput", cfgGbtLinkThroughput);
109120

110121
// log config summary
111-
theLog.log(LogInfoDevel_(3002), "Equipment %s: maxBlocksPerPage=%d cruBlockSize=%d numberOfLinks=%d systemId=%d cruId=%d dpwId=%d feeId=%d linkId=%d HBperiod=%d EmptyHbRatio=%f PayloadSize=%d TriggerRate=%f", name.c_str(), cfgMaxBlocksPerPage, cruBlockSize, cfgNumberOfLinks, cfgSystemId, cfgCruId, cfgDpwId, cfgFeeId, cfgLinkId, cfgHBperiod, cfgEmptyHbRatio, cfgPayloadSize, cfgTriggerRate);
122+
theLog.log(LogInfoDevel_(3002), "Equipment %s: maxBlocksPerPage=%d cruBlockSize=%d numberOfLinks=%d systemId=%d cruId=%d dpwId=%d feeId=%d linkId=%d HBperiod=%d EmptyHbRatio=%f PayloadSize=%d PayloadSizeStdev=%f TriggerRate=%f linkThroughput=%f", name.c_str(), cfgMaxBlocksPerPage, cruBlockSize, cfgNumberOfLinks, cfgSystemId, cfgCruId, cfgDpwId, cfgFeeId, cfgLinkId, cfgHBperiod, cfgEmptyHbRatio, cfgPayloadSize, cfgPayloadSizeStdev, cfgTriggerRate, cfgGbtLinkThroughput);
112123

113124
// initialize array of pending blocks (to be filled with data)
114125
pendingBlocks.resize(cfgNumberOfLinks);
@@ -120,8 +131,11 @@ ReadoutEquipmentCruEmulator::ReadoutEquipmentCruEmulator(ConfigFile& cfg, std::s
120131
}
121132

122133
// init parameters
123-
bcStep = (int)(LHCBCRate * ((cruBlockSize - sizeof(o2::Header::RAWDataHeader)) * 1.0 / (cfgGbtLinkThroughput * 1024 * 1024 * 1024 / 8)));
134+
bcStep = (int)ceil(LHCBCRate * (double)(cfgPayloadSize + sizeof(o2::Header::RAWDataHeader) * ceil(cfgPayloadSize * 1.0 / (cruBlockSize - sizeof(o2::Header::RAWDataHeader)))) * 8 / (cfgGbtLinkThroughput * 1000 * 1000 * 1000));
124135
theLog.log(LogInfoDevel_(3002), "Equipment %s: using block rate = %d BC", name.c_str(), bcStep);
136+
137+
// random payload distribution
138+
payloadDistrib = std::normal_distribution<> (cfgPayloadSize, cfgPayloadSizeStdev * cfgPayloadSize);
125139
}
126140

127141
ReadoutEquipmentCruEmulator::~ReadoutEquipmentCruEmulator() {}
@@ -243,7 +257,10 @@ Thread::CallbackResult ReadoutEquipmentCruEmulator::prepareBlocks()
243257
} else {
244258
// HB with random payload size
245259
ls.isEmpty = 0;
246-
ls.payloadBytesLeft = cfgPayloadSize * (rand() * 1.0 / RAND_MAX);
260+
ls.payloadBytesLeft = std::round(payloadDistrib(payloadGen));
261+
if (ls.payloadBytesLeft < 0 ) {
262+
ls.payloadBytesLeft = 0;
263+
}
247264
}
248265

249266
} else {

src/ReadoutEquipmentZmq.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ int ReadoutEquipmentZmq::tfClientCallback(void* msg, int msgSize)
358358
tfUpdateTime = time(NULL);
359359
if (tfUpdateTimeWarning) {
360360
tfUpdateTimeWarning = 0;
361-
theLog.log(LogInfoSupport_(3236), "New TF id received from TF server");
361+
theLog.log(LogInfoDevel_(3236), "New TF id received from TF server");
362362
}
363363
if (maxTf == 0) {
364364
// that's the first TF

0 commit comments

Comments
 (0)