LCOV - code coverage report
Current view: top level - ipm/src - Receiver.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 100.0 % 19 19
Test Date: 2026-05-24 15:29:04 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /**
       2              :  * @file Receiver.hpp Receiver Class implementations
       3              :  *
       4              :  * This is part of the DUNE DAQ Application Framework, copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : 
       9              : #include "ipm/Receiver.hpp"
      10              : #include "ipm/opmon/ipm.pb.h"
      11              : 
      12              : #include <utility>
      13              : 
      14              : dunedaq::ipm::Receiver::Response
      15       108325 : dunedaq::ipm::Receiver::receive(const duration_t& timeout, message_size_t bytes, bool no_tmoexcept_mode)
      16              : {
      17       108325 :   if (!can_receive()) {
      18            2 :     throw KnownStateForbidsReceive(ERS_HERE);
      19              :   }
      20       108324 :   auto message = receive_(timeout, no_tmoexcept_mode);
      21              : 
      22       108279 :   if (bytes != s_any_size) {
      23            4 :     auto received_size = static_cast<message_size_t>(message.data.size());
      24            4 :     if (received_size != bytes) {
      25            2 :       throw UnexpectedNumberOfBytes(ERS_HERE, m_connection_info.connection_name, received_size, bytes);
      26              :     }
      27              :   }
      28              : 
      29              :   // 18-May-2026, KAB: only increment the opmon counters if a non-empty message was received
      30       108277 :   if (message.data.size() > 0) {
      31       107553 :     m_bytes += message.data.size();
      32       107553 :     ++m_messages;
      33              :   }
      34              : 
      35       108277 :   return message;
      36            2 : }
      37              : 
      38              : void
      39           20 : dunedaq::ipm::Receiver::generate_opmon_data()
      40              : {
      41              : 
      42           20 :   opmon::ReceiverInfo i;
      43              : 
      44           20 :   i.set_bytes(m_bytes.exchange(0));
      45           20 :   i.set_messages(m_messages.exchange(0));
      46              : 
      47           20 :   publish(std::move(i));
      48           20 : }
        

Generated by: LCOV version 2.0-1