diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2021-09-13 19:43:54 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2021-09-13 19:43:54 -0700 |
commit | 5f2ba43a47246898eabbcb679dd6d711a8dcfda9 (patch) | |
tree | c1d7fe71948785b9ba0d38d49471def7d7fd43db | |
parent | 8fc58cfd5d7aa3e4002063392d757951566fec30 (diff) |
charts: show ??s when proc_stat->start is unset
When libvmon fails to successfully sample proc_stat, it will
leave this value as 0, which isn't really otherwise a normal
process start value.
Handle this by producing "??s" for the Wall time normally derived
from (sys_stat->boottime - proc_stat->start), to prevent
producing an incorrect Wall time equal to sys_stat->boottime.
There should probably be a more robust means of communicating
these libvmon sampling failures to vwm/vmon, but I've thus far
been resisting adding something like an errno to every sample
store, or worse every sample store's datum. It's kind of
non-trivial to do without bloating the sample stores, especially
since the stores consolidate multiple proc files under a single
store/want. Having a single errno in the store would prevent
letting the valid portions of the store be usable while ignoring
the errored portions. Perhaps just a per-store errno with a
bitfield to indicate which subset are errored would suffice...
-rw-r--r-- | src/charts.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/charts.c b/src/charts.c index 0edb7e6..11680d0 100644 --- a/src/charts.c +++ b/src/charts.c @@ -794,6 +794,8 @@ static void draw_columns(vwm_charts_t *charts, vwm_chart_t *chart, vwm_column_t case VWM_COLUMN_PROC_WALL: /* User Sys Wall times */ if (!row) str_len = snpf(str, sizeof(str), "Wall"); + else if (!proc_stat->start) + str_len = snpf(str, sizeof(str), "??s"); else str_len = snpf(str, sizeof(str), "%.2fs", (float)(sys_stat->boottime - proc_stat->start) / (float)charts->vmon.ticks_per_sec); |