LCOV - code coverage report
Current view: top level - logging/test/apps - debug_speed.cxx (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 21 0
Test Date: 2026-10-11 15:05:20 Functions: 0.0 % 14 0

            Line data    Source code
       1              : /**
       2              :  * @file debug_speed.cxx - demonstrate debug message speed when Issues are used.
       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              : Run:
      10              :                                            debug_speed
      11              :   or                                       debug_speed 1  # this
      12              :   or                DUNEDAQ_ERS_DEBUG_LEVEL=2 debug_speed
      13              :   or                DUNEDAQ_ERS_DEBUG_LEVEL=2 debug_speed 1
      14              :   or  TRACE_LVLS=-1                        debug_speed
      15              :   or  TRACE_LVLS=-1                        debug_speed 1
      16              :   or  TRACE_LVLS=-1 DUNEDAQ_ERS_DEBUG_LEVEL=2 debug_speed    # or this
      17              :  */
      18              : 
      19              : #include <logging/Logging.hpp>
      20              : #include <string>
      21              : 
      22            0 : ERS_DECLARE_ISSUE(ers,                                      // namespace
      23              :                   File2,                                    // issue class name
      24              :                   "simple message with file=" << file_name, // no message
      25              :                   ((const char*)file_name)                  // single attribute
      26              : )
      27              : 
      28              : int
      29            0 : main(int argc, char* argv[] __attribute__((__unused__)))
      30              : {
      31              :   // activate TRACE memory buffer for debugging
      32            0 :   std::string tfile = "/tmp/trace_buffer_" + std::string(getenv("USER")) + "_debug_speed";
      33            0 :   system(("rm -f " + tfile).c_str());
      34            0 :   setenv("TRACE_FILE", tfile.c_str(), 0);
      35              : 
      36            0 :   static const int dbglvl = 1;
      37            0 :   setenv("TRACE_LVLM",
      38            0 :          std::to_string(1ULL << (TLVL_DEBUG + dbglvl)).c_str(),
      39              :          0); // make sure the specific debug lvl used is enabled
      40              : 
      41            0 :   if (argc > 1) {
      42            0 :     dunedaq::logging::Logging::setup("test",
      43              :                                      "application"); // either do this or export DUNEDAQ_ERS_FATAL=erstrace,lstderr
      44              :                                                      // DUNEDAQ_ERS_ERROR='erstrace,throttle(30,100),lstderr'
      45              :                                                      // DUNEDAQ_ERS_WARNING='erstrace,throttle(30,100),lstderr'
      46              :   }
      47              : 
      48            0 :   ers::File2 efile2(ERS_HERE, "constructed file");
      49              : 
      50            0 :   for (int ii = 0; ii < 10; ++ii)
      51            0 :     TLOG_DEBUG(dbglvl) << ers::File2(ERS_HERE, "construct file");
      52              : 
      53            0 :   for (int ii = 0; ii < 10; ++ii)
      54            0 :     TLOG_DEBUG(dbglvl) << efile2;
      55              : 
      56            0 :   for (int ii = 0; ii < 10; ++ii)
      57            0 :     TLOG_DEBUG(dbglvl) << "message file does not exist";
      58              : 
      59            0 :   TLOG() << "\ntshow follows:\n\n";
      60            0 :   system("TRACE_SHOW=\"%H%x%N %T %P %i %C %e %L %R %m\" trace_cntl show | trace_delta -ct 1 -d 1");
      61              : 
      62            0 :   return (0);
      63            0 : } // main
        

Generated by: LCOV version 2.0-1