LCOV - code coverage report
Current view: top level - app/fdctl/monitor - helper.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 7 0.0 %
Date: 2024-11-13 11:58:15 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_app_fdctl_monitor_helper_h
       2             : #define HEADER_fd_src_app_fdctl_monitor_helper_h
       3             : 
       4             : #include "../fdctl.h"
       5             : 
       6             : /* TEXT_* are quick-and-dirty color terminal hacks.  Probably should
       7             :    do something more robust longer term. */
       8             : #define TEXT_NOCURSOR   "\033[?25l"
       9             : #define TEXT_CURSOR     "\033[?25h"
      10           0 : #define TEXT_ERASE_LINE "\033[0K"
      11           0 : #define TEXT_NEWLINE    TEXT_ERASE_LINE "\n"
      12             : 
      13           0 : #define TEXT_NORMAL "\033[0m"
      14           0 : #define TEXT_BLUE   "\033[34m"
      15           0 : #define TEXT_GREEN  "\033[32m"
      16           0 : #define TEXT_YELLOW "\033[93m"
      17           0 : #define TEXT_RED    "\033[31m"
      18             : 
      19             : /* printf_age prints _dt in ns as an age to stdout, will be exactly 10
      20             :    char wide.  Since pretty printing this value will often require
      21             :    rounding it, the rounding is in a round toward zero sense. */
      22             : void
      23             : printf_age( char ** buf,
      24             :             ulong * buf_sz,
      25             :             long _dt );
      26             : 
      27             : /* printf_stale is printf_age with the tweak that ages less than or
      28             :    equal to expire (in ns) will be suppressed to limit visual chatter.
      29             :    Will be exactly 10 char wide and color coded. */
      30             : void
      31             : printf_stale( char ** buf,
      32             :               ulong * buf_sz,
      33             :               long age,
      34             :               long expire );
      35             : 
      36             : /* printf_heart will print to stdout whether or not a heartbeat was
      37             :    detected.  Will be exactly 5 char wide and color coded. */
      38             : void
      39             : printf_heart( char ** buf,
      40             :               ulong * buf_sz,
      41             :               long hb_now,
      42             :               long hb_then );
      43             : 
      44             : char const *
      45             : sig_color( ulong sig );
      46             : 
      47             : /* printf_sig will print the current and previous value of a cnc signal.
      48             :    to stdout.  Will be exactly 10 char wide and color coded. */
      49             : void
      50             : printf_sig( char ** buf,
      51             :             ulong * buf_sz,
      52             :             ulong sig_now,
      53             :             ulong sig_then );
      54             : 
      55             : /* printf_err_bool will print to stdout a boolean flag that indicates
      56             :    if error condition was present now and then.  Will be exactly 12 char
      57             :    wide and color coded. */
      58             : void
      59             : printf_err_bool( char ** buf,
      60             :                  ulong * buf_sz,
      61             :                  ulong err_now,
      62             :                  ulong err_then );
      63             : 
      64             : void
      65             : printf_err_cnt( char ** buf,
      66             :                 ulong * buf_sz,
      67             :                 ulong cnt_now,
      68             :                 ulong cnt_then );
      69             : 
      70             : /* printf_seq will print to stdout a 64-bit sequence number and how it
      71             :    has changed between now and then.  Will be exactly 25 char wide and
      72             :    color coded. */
      73             : void
      74             : printf_seq( char ** buf,
      75             :             ulong * buf_sz,
      76             :             ulong seq_now,
      77             :             ulong seq_then );
      78             : 
      79             : /* printf_rate prints to stdout:
      80             : 
      81             :      cvt*((overhead + (cnt_now - cnt_then)) / dt)
      82             : 
      83             :    Will be exactly 8 char wide, right justified with aligned decimal
      84             :    point.  Uses standard engineering base 10 suffixes (e.g. 10.0e9 ->
      85             :    10.0G) to support wide dynamic range rate diagnostics.  Since pretty
      86             :    printing this value will often require rounding it, the rounding is
      87             :    roughly in a round toward near even zero sense (this could be
      88             :    improved numerically to make it even more strict rounding, e.g.
      89             :    rate*=1e-3 used below is not exact, but this is more than adequate
      90             :    for a quick-and-dirty low precision diagnostic. */
      91             : void
      92             : printf_rate( char ** buf,
      93             :              ulong * buf_sz,
      94             :              double cvt,
      95             :              double overhead,
      96             :              ulong  cnt_now,
      97             :              ulong  cnt_then,
      98             :              long   dt  );
      99             : 
     100             : void
     101             : printf_pct( char ** buf,
     102             :             ulong * buf_sz,
     103             :             ulong  num_now,
     104             :             ulong  num_then,
     105             :             double lhopital_num,
     106             :             ulong  den_now,
     107             :             ulong  den_then,
     108             :             double lhopital_den );
     109             : 
     110             : #endif /* HEADER_fd_src_app_fdctl_monitor_helper_h */

Generated by: LCOV version 1.14