Commit 78aff3e9 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vsc: Control adjusted values with a 'r'aw argument

parent 69dfe498
......@@ -69,6 +69,7 @@ struct VSC_point {
const char *sdesc; /* short description */
const char *ldesc; /* long description */
void *priv; /* return val from VSC_new_f */
unsigned raw; /* adjusted or raw value */
};
/*---------------------------------------------------------------------
......@@ -118,6 +119,7 @@ int VSC_Arg(struct vsc *, char arg, const char *opt);
* 'X' - field exclusion glob
* 'R' - required field glob
* 'f' - legacy field filter glob (deprecated)
* 'r' - toggle raw gauges
*
* Return:
* -1 error, VSM_Error() returns diagnostic string
......@@ -165,7 +167,7 @@ VSC_Value(const struct VSC_point * const pt)
uint64_t val;
val = *pt->ptr;
if (pt->semantics == 'g' && val > INT64_MAX)
if (!pt->raw && pt->semantics == 'g' && val > INT64_MAX)
val = 0;
return (val);
}
......
......@@ -98,6 +98,7 @@ struct vsc {
unsigned magic;
#define VSC_MAGIC 0x3373554a
unsigned raw;
struct vsc_sf_head sf_list;
VTAILQ_HEAD(,vsc_seg) segs;
......@@ -185,6 +186,7 @@ VSC_Arg(struct vsc *vsc, char arg, const char *opt)
case 'X': return (vsc_sf_arg(vsc, opt, VSC_SF_EXCLUDE));
case 'R': return (vsc_sf_arg(vsc, opt, VSC_SF_REQUIRE));
case 'f': return (vsc_f_arg(vsc, opt));
case 'r': vsc->raw = !vsc->raw; return (1);
default: return (0);
}
}
......@@ -299,6 +301,7 @@ vsc_fill_point(const struct vsc *vsc, const struct vsc_seg *seg,
AN(vt);
point->point.ptr = (volatile void*)(seg->body + atoi(vt->value));
point->point.raw = vsc->raw;
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment