Skip to content

Commit 44df33b

Browse files
committed
Possibility to limit raw data dumps from ITS/MFT decoder
1) If argument of --raw-data-dumps is negative, the dumps will be allowed only from 1st decoded pipeline (as before, 1 corresponds to dumping only the links with detected errors, 2 - to whole TF). 2) New option --stop-raw-data-dumps-after-size <size_in_MB> sets max allowed total size in MB for dumps (of given pipeline), dumping will be disabled once this size is exceeded.
1 parent 46615df commit 44df33b

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

Detectors/ITSMFT/common/reconstruction/include/ITSMFTReconstruction/RawPixelDecoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class RawPixelDecoder final : public PixelReader
9595
bool getAlwaysParseTrigger() const { return mAlwaysParseTrigger; }
9696

9797
void printReport(bool decstat = true, bool skipNoErr = true) const;
98-
void produceRawDataDumps(int dump, const o2::framework::TimingInfo& tinfo);
98+
size_t produceRawDataDumps(int dump, const o2::framework::TimingInfo& tinfo);
9999

100100
void clearStat(bool resetRaw = false);
101101

Detectors/ITSMFT/common/reconstruction/src/RawPixelDecoder.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,9 @@ void RawPixelDecoder<Mapping>::clearStat(bool resetRaw)
515515

516516
///______________________________________________________________________
517517
template <class Mapping>
518-
void RawPixelDecoder<Mapping>::produceRawDataDumps(int dump, const o2::framework::TimingInfo& tinfo)
518+
size_t RawPixelDecoder<Mapping>::produceRawDataDumps(int dump, const o2::framework::TimingInfo& tinfo)
519519
{
520+
size_t outSize = 0;
520521
bool dumpFullTF = false;
521522
for (auto& ru : mRUDecodeVec) {
522523
if (ru.linkHBFToDump.size()) {
@@ -550,6 +551,7 @@ void RawPixelDecoder<Mapping>::produceRawDataDumps(int dump, const o2::framework
550551
break;
551552
}
552553
ostrm.write(reinterpret_cast<const char*>(piece->data), piece->size);
554+
outSize += piece->size;
553555
entry++;
554556
}
555557
LOG(info) << "produced " << std::filesystem::current_path().c_str() << '/' << fnm;
@@ -569,11 +571,13 @@ void RawPixelDecoder<Mapping>::produceRawDataDumps(int dump, const o2::framework
569571
for (size_t i = 0; i < lnk.rawData.getNPieces(); i++) {
570572
const auto* piece = lnk.rawData.getPiece(i);
571573
ostrm.write(reinterpret_cast<const char*>(piece->data), piece->size);
574+
outSize += piece->size;
572575
}
573576
}
574577
LOG(info) << "produced " << std::filesystem::current_path().c_str() << '/' << fnm;
575578
break;
576579
}
580+
return outSize;
577581
}
578582

579583
///______________________________________________________________________

Detectors/ITSMFT/common/workflow/include/ITSMFTWorkflow/STFDecoderSpec.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class STFDecoder : public Task
8181
bool mApplyNoiseMap = true;
8282
bool mUseClusterDictionary = true;
8383
bool mVerifyDecoder = false;
84+
bool mDumpFrom1stPipeline = false;
8485
int mDumpOnError = 0;
8586
int mNThreads = 1;
8687
int mVerbosity = 0;
@@ -91,6 +92,8 @@ class STFDecoder : public Task
9192
size_t mEstNClusPatt = 0;
9293
size_t mEstNCalib = 0;
9394
size_t mEstNROF = 0;
95+
size_t mMaxRawDumpsSize = 0;
96+
size_t mRawDumpedSize = 0;
9497
std::string mInputSpec;
9598
std::string mSelfName;
9699
std::unique_ptr<RawPixelDecoder<Mapping>> mDecoder;

Detectors/ITSMFT/common/workflow/src/STFDecoderSpec.cxx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,16 @@ void STFDecoder<Mapping>::init(InitContext& ic)
8787
mDecoder->setNThreads(mNThreads);
8888
mUnmutExtraLanes = ic.options().get<bool>("unmute-extra-lanes");
8989
mVerbosity = ic.options().get<int>("decoder-verbosity");
90+
auto dmpSz = ic.options().get<int>("stop-raw-data-dumps-after-size");
91+
if (dmpSz > 0) {
92+
mMaxRawDumpsSize = size_t(dmpSz) * 1024 * 1024;
93+
}
9094
mDumpOnError = ic.options().get<int>("raw-data-dumps");
91-
if (mDumpOnError < 0 || mDumpOnError >= int(GBTLink::RawDataDumps::DUMP_NTYPES)) {
95+
if (mDumpOnError < 0) {
96+
mDumpOnError = -mDumpOnError;
97+
mDumpFrom1stPipeline = true;
98+
}
99+
if (mDumpOnError >= int(GBTLink::RawDataDumps::DUMP_NTYPES)) {
92100
throw std::runtime_error(fmt::format("unknown raw data dump level {} requested", mDumpOnError));
93101
}
94102
auto dumpDir = ic.options().get<std::string>("raw-data-dumps-directory");
@@ -243,8 +251,13 @@ void STFDecoder<Mapping>::run(ProcessingContext& pc)
243251

244252
pc.outputs().snapshot(Output{orig, "PHYSTRIG", 0}, mDecoder->getExternalTriggers());
245253

246-
if (mDumpOnError != int(GBTLink::RawDataDumps::DUMP_NONE)) {
247-
mDecoder->produceRawDataDumps(mDumpOnError, pc.services().get<o2::framework::TimingInfo>());
254+
if (mDumpOnError != int(GBTLink::RawDataDumps::DUMP_NONE) &&
255+
(!mDumpFrom1stPipeline || pc.services().get<const o2::framework::DeviceSpec>().inputTimesliceId == 0)) {
256+
mRawDumpedSize += mDecoder->produceRawDataDumps(mDumpOnError, pc.services().get<o2::framework::TimingInfo>());
257+
if (mRawDumpedSize > mMaxRawDumpsSize && mMaxRawDumpsSize > 0) {
258+
LOGP(info, "Max total dumped size {} MB exceeded allowed limit, disabling further dumping", mRawDumpedSize / (1024 * 1024));
259+
mDumpOnError = int(GBTLink::RawDataDumps::DUMP_NONE);
260+
}
248261
}
249262

250263
if (mDoClusters) {
@@ -417,8 +430,9 @@ DataProcessorSpec getSTFDecoderSpec(const STFDecoderInp& inp)
417430
{"nthreads", VariantType::Int, 1, {"Number of decoding/clustering threads"}},
418431
{"decoder-verbosity", VariantType::Int, 0, {"Verbosity level (-1: silent, 0: errors, 1: headers, 2: data, 3: raw data dump) of 1st lane"}},
419432
{"always-parse-trigger", VariantType::Bool, false, {"parse trigger word even if flags continuation of old trigger"}},
420-
{"raw-data-dumps", VariantType::Int, int(GBTLink::RawDataDumps::DUMP_NONE), {"Raw data dumps on error (0: none, 1: HBF for link, 2: whole TF for all links"}},
433+
{"raw-data-dumps", VariantType::Int, int(GBTLink::RawDataDumps::DUMP_NONE), {"Raw data dumps on error (0: none, 1: HBF for link, 2: whole TF for all links. If negative, dump only on from 1st pipeline."}},
421434
{"raw-data-dumps-directory", VariantType::String, "", {"Destination directory for the raw data dumps"}},
435+
{"stop-raw-data-dumps-after-size", VariantType::Int, 1024, {"Stop dumping once this size in MB is accumulated. 0: no limit"}},
422436
{"unmute-extra-lanes", VariantType::Bool, false, {"allow extra lanes to be as verbose as 1st one"}},
423437
{"allow-empty-rofs", VariantType::Bool, false, {"record ROFs w/o any hit"}},
424438
{"ignore-noise-map", VariantType::Bool, false, {"do not mask pixels flagged in the noise map"}},

0 commit comments

Comments
 (0)