Skip to content

Commit c0e8a97

Browse files
authored
Add parameter to limit the printing of the payload to X values (#508)
* Add parameter to limit the printing of the paylaod to X values * Update readout.json * Update readout.json * Update readout.json * format * Update DaqTask.cxx
1 parent 1157807 commit c0e8a97

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

Framework/readout.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"": "All the printing options might significantly slow down your QC",
4040
"printInputHeader": "false", "": "set to true to print all headers",
4141
"printInputPayload": "false", "": "hex or bin (anything else means no)",
42+
"printInputPayloadLimit": "-1", "": "only print the X first words (-1 means no limit)",
4243
"printPageInfo": "false", "": "set to true to print information about pages",
4344
"printRDH": "false", "": "set to true to print the RDHs"
4445
}

Modules/Daq/src/DaqTask.cxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ void DaqTask::printInputPayload(const header::DataHeader* header, const char* pa
147147
} else if (mCustomParameters["printInputPayload"] == "bin") {
148148
representation = getBinRepresentation((unsigned char*)payload, header->payloadSize);
149149
}
150+
size_t limit = std::numeric_limits<size_t>::max();
151+
if (mCustomParameters.count("printInputPayloadLimit") > 0) {
152+
limit = std::stoi(mCustomParameters["printInputPayloadLimit"]);
153+
}
150154

151155
for (size_t i = 0; i < representation.size();) {
152156
ILOG(Info, Ops) << std::setw(4) << i << " : ";
@@ -162,6 +166,10 @@ void DaqTask::printInputPayload(const header::DataHeader* header, const char* pa
162166
}
163167
ILOG(Info, Ops) << ENDM;
164168
i = i + 8;
169+
// limit output but we don't troncate the lines.
170+
if (i > limit) {
171+
return;
172+
}
165173
}
166174
}
167175

0 commit comments

Comments
 (0)