From cb5c6369ac1254cf0cd68174460eec5d6b8f2083 Mon Sep 17 00:00:00 2001 From: Giovanna Lazzari Miotto <giovanna.lazzari.miotto@cern.ch> Date: Fri, 14 Feb 2025 14:25:51 +0100 Subject: [PATCH] logging: Rewrite, remove trace logging --- src/OutputFileHandler.cc | 20 ++++++++++---------- src/muon_orbit_processor.cc | 4 ---- src/orbit_processor.cc | 17 +++++++---------- src/pipeline.cc | 2 +- 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/OutputFileHandler.cc b/src/OutputFileHandler.cc index 873ac4eb..6ccd6f83 100644 --- a/src/OutputFileHandler.cc +++ b/src/OutputFileHandler.cc @@ -55,8 +55,7 @@ void OutputFileHandler::CommitFile() { Detail::FileMetadata file_meta = outputFile_.GetMetadata(); if (ls_->IsLastIndex(file_meta.index_in_ls) && IsMainPipeline() && HasCmsswHeaders()) { // If last in lumisection and using CMSSW header and is the main pipeline - LOG(TRACE) << "Last file in lumisection " << ls_->lumisection - << ", handing over metadata footer."; + LOG(TRACE) << "Last file for lumisection " << ls_->lumisection << ", setting metadata footer."; outputFile_.SetLumisectionFooter(*ls_); ls_ = std::make_unique<Detail::LumisectionMetadata>(GetMaxFileIndexPerLumisection()); } @@ -70,12 +69,13 @@ int OutputFileHandler::StageSlice(const char *buffer, size_t size_bytes, uint32_ bool is_new_index = (current_global_index_ != static_cast<int>(file_index)); if (is_new_run || is_new_index) { - LOG(TRACE) << "Committing file because ... new_run? " << is_new_run << ", new_index? " - << is_new_index << "(context: current_global_index_=" << current_global_index_ - << ", incoming_file_index=" << file_index << ", current_run=" << run_.number - << ", incoming_run=" << run_number << ")"; + LOG(TRACE) << "Triggering new file. Context: current run=" << run_.number + << ", current_global_index_=" << current_global_index_ + << ", upcoming file_index=" << file_index << ", upcoming run=" << run_number << ")"; // Commit current file and start a new one, unless it's the first execution - if (current_global_index_ != -1) CommitFile(); + if (current_global_index_ != -1) { + CommitFile(); + } UpdateRunInfo(run_number, file_index); NewFile(); } @@ -87,7 +87,7 @@ void OutputFileHandler::NewFile() { // Create a new file uint32_t ls_number = ls_->lumisection; uint32_t index_in_lumisection = ls_->GetIndexInLumisection(current_global_index_); - LOG(TRACE) << "opening file with index " << current_global_index_ << ", in lumisection " + LOG(TRACE) << "Opening file with index " << current_global_index_ << ", in lumisection " << ls_number; auto working_path = sink_.GetRootPath() + GetWorkingDir(); @@ -125,8 +125,8 @@ void OutputFileHandler::CommitRun() { if (ls_) { auto ls_index_footer = ls_->lumisection; if (ls_index_footer != ls_index) { - LOG(WARNING) << "Expected lumisection number " << ls_index << ", but lumisection footer has " - << ls_index_footer; + LOG(WARNING) << "Expected lumisection number " << ls_index << ", but found " + << ls_index_footer << " in lumisection footer."; assert(ls_index_footer == ls_index); } diff --git a/src/muon_orbit_processor.cc b/src/muon_orbit_processor.cc index ab793908..7592c1fd 100644 --- a/src/muon_orbit_processor.cc +++ b/src/muon_orbit_processor.cc @@ -46,10 +46,6 @@ int MuonOrbitProcessor::ProcessBlock(MemRegion &readable_block, WriteMemRegion & return -1; } - // LOG(DEBUG) << "Filling data with total size = " << std::to_string(bx_data.GetSize()) - // << ", data points = " << std::to_string(bx_data.count) - // << ", available space = " << std::to_string(writeable_block.GetAvailable()); - // header word of packed muon data contains number of muons in words 3-4 and number of muons in // words 5-6, as well as the warning test enable flag. meta.header = uint32_t{(count_m1 << 16) + ((static_cast<uint32_t>(meta.header)) << 8) + count_m2}; diff --git a/src/orbit_processor.cc b/src/orbit_processor.cc index 5037a818..575971d8 100644 --- a/src/orbit_processor.cc +++ b/src/orbit_processor.cc @@ -48,15 +48,15 @@ bool OrbitProcessor::CheckFrameMultBlock(size_t inputSize, uint16_t nDroppedOrbi ((stats.packet_skipped_inconsistent_size < 10000) && (stats.packet_skipped_inconsistent_size % 1000 == 0)) || (stats.packet_skipped_inconsistent_size % 10000 == 0)) { - // LOG(WARNING) << "Frame size not a multiple of block size after headers " - // "and trailers have been subtracted. Counted " - // << stats.packet_skipped_inconsistent_size << " packets skipped."; + LOG(WARNING) << "Frame size not a multiple of block size after headers " + "and trailers have been subtracted. Counted " + << stats.packet_skipped_inconsistent_size << " packets skipped."; } - // LOG(WARNING) << "Frame size not a multiple of block size after orbit headers " - // "(32B*nOrbitsPerPacket), orbit trailers (512B*nOrbitsPerPacket), " - // "and packet trailer (32B) have been subtracted. \n Frame size = " - // << inputSize << ", block size = " << bsize << ", packet will be skipped"; + LOG(WARNING) << "Frame size not a multiple of block size after orbit headers " + "(32B*nOrbitsPerPacket), orbit trailers (512B*nOrbitsPerPacket), " + "and packet trailer (32B) have been subtracted. \n Frame size = " + << inputSize << ", block size = " << bsize << ", packet will be skipped"; return false; } else { stats.n_consistent_sized_packets++; @@ -162,9 +162,6 @@ OrbitProcessor::FillOrbitMetadata OrbitProcessor::FillOrbit(orbit_trailer *trail MemRegion readable_block(&rd_ptr, rd_end_ptr); WriteMemRegion writeable_block(&wr_ptr, wr_end_ptr); - // LOG(DEBUG) << "Writing to memory region: " << - // std::to_string(writeable_block.GetAvailable()) - // << " bytes available, " << std::to_string(GetPacketSize()) << " needed."; assert(writeable_block.CheckBounds(GetPacketSize())); // Max size a decoded block can use BxMetadata meta{orbit_header.second, static_cast<uint32_t>(bx), orbit}; diff --git a/src/pipeline.cc b/src/pipeline.cc index 0864f4a5..82f4cfb3 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -188,7 +188,7 @@ void MultiPipeline::MonitorRun() { } else if (!control_.running && control_.run_number > 0 && latest_EoR != control_.run_number) { // "Stop" command issued - Write EoR and EoLS files, maybe destroy pipelines - LOG(TRACE) << "Ending run number=" << control_.run_number; + LOG(TRACE) << "Ending run with number=" << control_.run_number; assert(!pipelines_.empty()); pipelines_[0].output_stream_->Commit(); -- GitLab