libosmovty  0.12.0
Osmocom VTY library
Rate_ctr

Data Structures

struct  vty_out_context
 

Functions

static int rate_ctr_handler (struct rate_ctr_group *ctrg, struct rate_ctr *ctr, const struct rate_ctr_desc *desc, void *vctx_)
 
void vty_out_rate_ctr_group (struct vty *vty, const char *prefix, struct rate_ctr_group *ctrg)
 print a rate counter group to given VTY More...
 
static char * pad_append_str (char *s, const char *a, int minwidth)
 
static char * pad_append_ctr (char *s, uint64_t ctr, int minwidth)
 
static int rate_ctr_handler_fmt (struct rate_ctr_group *ctrg, struct rate_ctr *ctr, const struct rate_ctr_desc *desc, void *vctx_)
 
void vty_out_rate_ctr_group_fmt (struct vty *vty, const char *fmt, struct rate_ctr_group *ctrg)
 print a rate counter group to given VTY, formatting the line for each counter according to a format string. More...
 
static int rate_ctr_group_handler (struct rate_ctr_group *ctrg, void *vctx_)
 

Detailed Description

Function Documentation

◆ pad_append_ctr()

static char* pad_append_ctr ( char *  s,
uint64_t  ctr,
int  minwidth 
)
static

Referenced by rate_ctr_handler_fmt().

◆ pad_append_str()

static char* pad_append_str ( char *  s,
const char *  a,
int  minwidth 
)
static

Referenced by rate_ctr_handler_fmt().

◆ rate_ctr_group_handler()

static int rate_ctr_group_handler ( struct rate_ctr_group *  ctrg,
void *  vctx_ 
)
static

◆ rate_ctr_handler()

static int rate_ctr_handler ( struct rate_ctr_group *  ctrg,
struct rate_ctr *  ctr,
const struct rate_ctr_desc *  desc,
void *  vctx_ 
)
static

◆ rate_ctr_handler_fmt()

static int rate_ctr_handler_fmt ( struct rate_ctr_group *  ctrg,
struct rate_ctr *  ctr,
const struct rate_ctr_desc *  desc,
void *  vctx_ 
)
static

◆ vty_out_rate_ctr_group()

void vty_out_rate_ctr_group ( struct vty vty,
const char *  prefix,
struct rate_ctr_group *  ctrg 
)

print a rate counter group to given VTY

Parameters
[in]vtyThe VTY to which it should be printed
[in]prefixAny additional log prefix ahead of each line
[in]ctrgRate counter group to be printed

References rate_ctr_handler(), vty_out_context::vty, VTY_NEWLINE, and vty_out().

◆ vty_out_rate_ctr_group_fmt()

void vty_out_rate_ctr_group_fmt ( struct vty vty,
const char *  fmt,
struct rate_ctr_group *  ctrg 
)

print a rate counter group to given VTY, formatting the line for each counter according to a format string.

The following format string directives are supported:

  • d: The description of the counter
  • n: The name of the counter
  • c: The current value of the counter
  • p: The previous value of the counter
  • S: The interval of the counter in seconds
  • M: The interval of the counter in minutes
  • H: The interval of the counter in hours
  • D: The interval of the counter in days
  • %%: Print a literal %.

An optional number between % and the letter in a format directive may be used to set a minimum field width. If the expanded format directive is smaller than this width (according to strlen()) the string will be left-padded (if the number is positive) or right-padded (if the number is negative) with spaces. For example, "%25n" prints the counter name left-padded up to a minimum width of 25 columns.

VTY_NEWLINE will be appended to the format string when it is printed.

Parameters
[in]vtyThe VTY to which it should be printed
[in]ctrgRate counter group to be printed
[in]fmtA format which may contain the above directives.

References rate_ctr_handler_fmt(), vty_out_context::vty, VTY_NEWLINE, and vty_out().

Referenced by rate_ctr_group_handler().