LCOV - code coverage report
Current view: top level - fdreadoutlibs/src/daphneeth - DAPHNEEthStreamFrameProcessor.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 27 0
Test Date: 2026-10-11 15:05:20 Functions: 0.0 % 5 0

            Line data    Source code
       1              : /**
       2              :  * @file DAPHNEEthStreamFrameProcessor.hpp DAPHNE specific Task based raw processor
       3              :  * implementation for streaming mode
       4              :  *
       5              :  * This is part of the DUNE DAQ , copyright 2020.
       6              :  * Licensing/copyright details are in the COPYING file that you should have
       7              :  * received with this code.
       8              :  */
       9              : #include "fdreadoutlibs/daphneeth/DAPHNEEthStreamFrameProcessor.hpp"
      10              : #include "fddetdataformats/DAPHNEEthStreamFrame.hpp"
      11              : 
      12              : #include <atomic>
      13              : #include <functional>
      14              : #include <memory>
      15              : #include <string>
      16              : 
      17              : using dunedaq::datahandlinglibs::logging::TLVL_BOOKKEEPING;
      18              : using dunedaq::datahandlinglibs::logging::TLVL_FRAME_RECEIVED;
      19              : 
      20              : namespace dunedaq {
      21              : namespace fdreadoutlibs {
      22              : 
      23              : void
      24            0 : DAPHNEEthStreamFrameProcessor::conf(const appmodel::DataHandlerModule* conf)
      25              : {
      26            0 :   datahandlinglibs::TaskRawDataProcessorModel<types::DAPHNEEthStreamTypeAdapter>::add_preprocess_task(
      27            0 :     std::bind(&DAPHNEEthStreamFrameProcessor::timestamp_check, this, std::placeholders::_1));
      28              :   // m_tasklist.push_back( std::bind(&DAPHNEStreamFrameProcessor::frame_error_check, this, std::placeholders::_1) );
      29            0 :   TaskRawDataProcessorModel<types::DAPHNEEthStreamTypeAdapter>::conf(conf);
      30            0 : }
      31              : 
      32              : /**
      33              :  * Pipeline Stage 1.: Check proper timestamp increments in DAPHNE frame
      34              :  * */
      35              : void
      36            0 : DAPHNEEthStreamFrameProcessor::timestamp_check(frameptr fp)
      37              : {
      38              :   /* Let Source Emulator deal with this
      39              :     // If EMU data, emulate perfectly incrementing timestamp
      40              :     if (inherited::m_emulator_mode) { // emulate perfectly incrementing timestamp
      41              :       uint64_t ts_next = m_previous_ts + 64; // NOLINT(build/unsigned)
      42              :       auto df = reinterpret_cast<daphneframeptr>(((uint8_t*)fp));  // NOLINT
      43              :       for (unsigned int i = 0; i < fp->get_num_frames(); ++i) { // NOLINT(build/unsigned)
      44              :         //auto wfh = const_cast<dunedaq::fddetdataformats::WIB2Header*>(wf->get_wib_header());
      45              :         df->set_timestamp(ts_next);
      46              :         ts_next += 64;
      47              :         df++;
      48              :       }
      49              :     }
      50              :   */
      51              :   // Acquire timestamp
      52            0 :   m_current_ts = fp->get_timestamp();
      53            0 :   uint64_t k_clock_frequency = 62500000; // NOLINT(build/unsigned)
      54            0 :   uint16_t tick_difference = types::DAPHNEEthStreamTypeAdapter::expected_tick_difference;
      55            0 :   uint16_t frame_tick_difference = tick_difference * fp->get_num_frames();
      56            0 :   TLOG_DEBUG(TLVL_FRAME_RECEIVED) << "Received DAPHNEEthStream frame timestamp value of " << m_current_ts
      57            0 :                                   << " ticks (..." << std::fixed << std::setprecision(8)
      58            0 :                                   << (static_cast<double>(m_current_ts % (k_clock_frequency * 1000)) /
      59            0 :                                       static_cast<double>(k_clock_frequency))
      60            0 :                                   << " sec)"; // NOLINT
      61              : 
      62              :   // Check timestamp
      63              :   // RS warning : not fixed rate!
      64            0 :   if (m_current_ts - m_previous_ts != frame_tick_difference) {
      65            0 :     ++m_ts_error_ctr;
      66              :   }
      67              : 
      68            0 :   if (m_ts_error_ctr > 1000) {
      69            0 :     if (!m_problem_reported) {
      70            0 :       TLOG() << "*** Data Integrity ERROR *** Timestamp continuity is completely broken! "
      71            0 :              << "Something is wrong with the FE source or with the configuration!";
      72            0 :       m_problem_reported = true;
      73              :     }
      74              :   }
      75              : 
      76            0 :   m_previous_ts = m_current_ts;
      77            0 :   m_last_processed_daq_ts = m_current_ts;
      78            0 : }
      79              : 
      80              : /**
      81              :  * Pipeline Stage 2.: Check DAPHNE headers for error flags
      82              :  * */
      83              : void
      84            0 : DAPHNEEthStreamFrameProcessor::frame_error_check(frameptr /*fp*/)
      85              : {
      86              :   // check error fields
      87            0 : }
      88              : 
      89              : } // namespace fdreadoutlibs
      90              : } // namespace dunedaq
        

Generated by: LCOV version 2.0-1