From 8e218c6cff59044b56f62c4fcef82b0b5ec66d87 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 27a44212..e7838ed9 100644 --- a/src/InputFilter.cc +++ b/src/InputFilter.cc @@ -162,7 +162,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 bcb2813c..09655c83 100644 --- a/src/OutputFileHandler.cc +++ b/src/OutputFileHandler.cc @@ -1,12 +1,6 @@ #include "OutputFileHandler.h" -#include <fcntl.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> - -#include <cstdio> #include <iomanip> #include "log.h" @@ -99,10 +93,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 b96a4175..c03a4937 100644 --- a/src/processor.cc +++ b/src/processor.cc @@ -41,9 +41,7 @@ void bit_check(std::vector<unsigned int> *bx_vect, uint32_t word, uint32_t offse 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 @@ -446,7 +444,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 8c4b018b..ab98d9b5 100644 --- a/src/scdaq.cc +++ b/src/scdaq.cc @@ -174,7 +174,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)) { @@ -194,6 +193,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))) { @@ -202,6 +202,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