LCOV - code coverage report
Current view: top level - /opt/artdaq/srcs/trace/python - tracelib.c (source / functions) Coverage Total Hit
Test: artdaq.info.cleaned Lines: 0.0 % 35 0
Test Date: 2026-10-29 00:35:58 Functions: 0.0 % 3 0

            Line data    Source code
       1              : 
       2              : 
       3              : /*  gcc -g -Wall -I$TRACE_INC -o libtracelib.so -shared -fPIC tracelib.c
       4              :  OR gcc -std=c11 -Wall -I$TRACE_INC -Wextra -pedantic -c -fPIC -o tracelib.{o,c}
       5              :     gcc -shared tracelib.o -o libtracelib.so
       6              :  */
       7              : #define TRACE_IMPL
       8              : #include "TRACE/trace.h"
       9              : 
      10            0 : void ctrace0(char *namp, uint8_t lvl, int32_t line, const char *function, const char *msg)
      11              : {
      12            0 :         trace_tv_t tv= {0, 0};
      13            0 :         unsigned long long no_args[1];
      14            0 :         va_list ap= TRACE_VA_LIST_INIT((void *)no_args);
      15            0 :         if TRACE_INIT_CHECK (TRACE_NAME) {
      16            0 :                 int trcId= (int)trace_name2TID(namp);
      17            0 :                 vtrace(&tv, trcId, lvl, line, function, 0, msg, ap);
      18              :         }
      19            0 : }
      20              : 
      21              : /* similar to TRACE macro, except this compilation unit is for all python
      22              :    traces. tid_ cannot be static :(
      23              :  */
      24              : #undef TRACE
      25            0 : void TRACE(char *namp, uint8_t lvl, int32_t line, const char *function, const char *msg)
      26              : {
      27            0 :         struct {
      28              :                 char tn[TRACE_TN_BUFSZ];
      29              :         } _trc_;
      30            0 :         if TRACE_INIT_CHECK (trace_name(TRACE_NAME, __TRACE_FILE__, _trc_.tn, sizeof(_trc_.tn))) {
      31            0 :                 /*static TRACE_THREAD_LOCAL*/ int tid_= -1;
      32            0 :                 trace_tv_t lclTime;
      33            0 :                 uint8_t lvl_= (uint8_t)(lvl);
      34            0 :                 TRACE_SBUFDECL;
      35            0 :                 if (tid_ == -1) tid_= (int)trace_name2TID(&(namp)[0]);
      36            0 :                 lclTime.tv_sec= 0;
      37            0 :                 if (traceControl_rwp->mode.bits.M && (traceLvls_p[tid_].M & TLVLMSK(lvl_))) {
      38              : #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || (defined(__cplusplus) && (__cplusplus >= 201103L))
      39              : #       pragma GCC diagnostic push
      40              : #       pragma GCC diagnostic ignored "-Wformat-security"
      41              : #endif
      42              :                         /* Note: CANNOT add to "...NARGS..." (i.e. for long doubles issue) b/c nargs==0 in mem entry is signficant */
      43            0 :                         trace(&lclTime, tid_, lvl_, line, function, 0 TRACE_XTRA_PASSED, msg);
      44              : #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || (defined(__cplusplus) && (__cplusplus >= 201103L))
      45              : #       pragma GCC diagnostic pop
      46              : #endif
      47              :                 }
      48            0 :                 if (traceControl_rwp->mode.bits.S && (traceLvls_p[tid_].S & TLVLMSK(lvl_))) {
      49            0 :                         TRACE_LIMIT_SLOW(lvl_, _insert, &lclTime)
      50              :                         {
      51            0 :                                 TRACE_LOG_FUNCTION(&lclTime, tid_, lvl_, _insert, __FILE__, line, function, 0, msg);
      52              :                         }
      53              :                 }
      54              :         }
      55            0 : }
      56              : 
      57              : #undef TRACE_CNTL
      58            0 : int64_t TRACE_CNTL(const char *_name, const char *_file, int nargs, const char *cmd, ...)
      59              : {
      60            0 :         int64_t retval;
      61            0 :         va_list ap;
      62            0 :         int arg_i[10];
      63              : 
      64            0 :         va_start(ap, cmd);
      65              : 
      66            0 :         if (strcmp(cmd, "printfd") == 0) {
      67              :                 int max= (int)(sizeof(arg_i) / sizeof(arg_i[0]));
      68            0 :                 for (int ii= 0; ii < ((nargs < max) ? nargs : max); ++ii) { arg_i[ii]= va_arg(ap, int); }
      69            0 :                 retval= traceCntl(_name, _file, nargs, cmd, arg_i[0], arg_i[1], arg_i[2], arg_i[3], arg_i[4], arg_i[5], arg_i[6], arg_i[7],
      70              :                                                   arg_i[8], arg_i[9]);
      71              :         } else {
      72              :                 int max= (int)(sizeof(arg_i) / sizeof(arg_i[0]));
      73            0 :                 for (int ii= 0; ii < ((nargs < max) ? nargs : max); ++ii) { arg_i[ii]= va_arg(ap, int); }
      74            0 :                 retval= traceCntl(_name, _file, nargs, cmd, arg_i[0], arg_i[1], arg_i[2], arg_i[3], arg_i[4], arg_i[5], arg_i[6], arg_i[7],
      75              :                                                   arg_i[8], arg_i[9]);
      76              :         }
      77            0 :         va_end(ap);
      78            0 :         return retval;
      79              : }
        

Generated by: LCOV version 2.0-1