From 0f3766ad04eeaf72823964fe0c583863390dd4f7 Mon Sep 17 00:00:00 2001 From: Emilio <Emilio.Meschi@cern.ch> Date: Thu, 17 Nov 2022 17:01:43 +0100 Subject: [PATCH] minimal changes to use preallocated slices for output --- src/InputFilter.cc | 3 +-- src/OutputFileHandler.cc | 10 ---------- src/processor.cc | 5 +---- src/scdaq.cc | 3 ++- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/InputFilter.cc b/src/InputFilter.cc index f63c9f09..81c2ba47 100644 --- a/src/InputFilter.cc +++ b/src/InputFilter.cc @@ -163,7 +163,6 @@ void *InputFilter::operator()(void *) { // Adjust the end of this buffer thisSlice->set_end(thisSlice->end() + bytesRead); - // LOG(TRACE) << " Input filter returns slice at 0x" << std::hex << - // (uint64_t)thisSlice; + return thisSlice; } diff --git a/src/OutputFileHandler.cc b/src/OutputFileHandler.cc index f792c33e..ac28fd0b 100644 --- a/src/OutputFileHandler.cc +++ b/src/OutputFileHandler.cc @@ -2,12 +2,7 @@ #include "OutputFileHandler.h" #include "log.h" #include "tools.h" -#include <cstdio> -#include <fcntl.h> #include <iomanip> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> const std::string OutputFileHandler::working_dir_ = "in_progress"; const std::string OutputFileHandler::journal_file_ = "index.journal"; @@ -105,11 +100,6 @@ void OutputFileHandler::close_and_rename::operator()() const { } LOG(TRACE) << "popping file: " << n.first << " for closing, queue size now " << files_to_close_.size(); - struct stat buf; - fstat(fileno(n.second), &buf); - if (posix_fadvise(fileno(n.second), 0, buf.st_size, POSIX_FADV_DONTNEED) != - 0) - LOG(ERROR) << tools::strerror("Page cache release failed"); if (fclose(n.second) != 0) { LOG(ERROR) << tools::strerror("File close failed"); } diff --git a/src/processor.cc b/src/processor.cc index 29de5f95..6a5c5783 100644 --- a/src/processor.cc +++ b/src/processor.cc @@ -37,9 +37,7 @@ void bit_check(std::vector<unsigned int> *bx_vect, uint32_t word, return; } -StreamProcessor::~StreamProcessor() { - // Slice::giveAllocated(next_slice_); -} +StreamProcessor::~StreamProcessor() {} // checks that the packet size is an integer multiple of the BX block size, // minus the header/trailers @@ -468,7 +466,6 @@ void StreamProcessor::process(Slice &input, Slice &out) { } void *StreamProcessor::operator()(void *item) { Slice &input = *static_cast<Slice *>(item); - // LOG(TRACE) << "Processor gets slice at " << &input; Slice &out = *Slice::getAllocated(); process(input, out); Slice::giveAllocated(&input); diff --git a/src/scdaq.cc b/src/scdaq.cc index 90e8f510..c020490b 100644 --- a/src/scdaq.cc +++ b/src/scdaq.cc @@ -179,7 +179,6 @@ int main(int argc, char *argv[]) { int nbThreads = conf.getNumThreads(); retval = 0; - try { tbb::task_scheduler_init init(nbThreads); if (!run_pipeline(nbThreads, control, conf)) { @@ -201,6 +200,7 @@ int main(int argc, char *argv[]) { LOG(INFO) << "Successfully reset the board."; } } + LOG(DEBUG) << "Terminating the internal TCP server."; io_service.stop(); if (!t.try_join_for(boost::chrono::milliseconds(2000))) { @@ -209,6 +209,7 @@ int main(int argc, char *argv[]) { } else { LOG(DEBUG) << "Internal TCP server is terminated."; } + // utility::report_elapsed_time((tbb::tick_count::now() - // mainStartTime).seconds()); return retval; -- GitLab