diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2025-04-12 15:39:42 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2025-04-19 12:43:45 -0700 |
commit | fbb5780216ab3274066d793ab583b15c0efcfcee (patch) | |
tree | 76d23982c12b6e616996be6663de3c1610272108 /src | |
parent | 7f361151ce53864540cfcff10e694bd557fcdf8f (diff) |
charts: add "'" modifier to Row,Sys,User,Wall columns
This helps reading the precise magnitude of these numbers when large.
I considered also adding more units for the times, but I kinda
like the ability to scan the width of the time columns to see
short vs. long durations without actually reading what they
contain, as a broad-phase scan. If they were simply HH:MM:SS
it'd require scanning the colon-separated columns with enough
scrutiny to parse zeroes vs. non-zeroes...
Diffstat (limited to 'src')
-rw-r--r-- | src/charts.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/charts.c b/src/charts.c index f5ccab0..1ce8e49 100644 --- a/src/charts.c +++ b/src/charts.c @@ -634,7 +634,7 @@ static void draw_columns(vwm_charts_t *charts, vwm_chart_t *chart, vwm_column_t if (heading) str_len = snpf(str, sizeof(str), "Row"); else - str_len = snpf(str, sizeof(str), "%i", row - CHART_NUM_FIXED_HEADER_ROWS); + str_len = snpf(str, sizeof(str), "%'i", row - CHART_NUM_FIXED_HEADER_ROWS); str_justify = VWM_JUSTIFY_LEFT; /* this is kind of hacky, but libvmon doesn't monitor our row, it's implicitly "sampled" when we draw */ @@ -645,7 +645,7 @@ static void draw_columns(vwm_charts_t *charts, vwm_chart_t *chart, vwm_column_t if (heading) str_len = snpf(str, sizeof(str), "User"); else - str_len = snpf(str, sizeof(str), "%.2fs", + str_len = snpf(str, sizeof(str), "%'.2fs", (float)proc_stat->utime * charts->inv_ticks_per_sec); str_justify = VWM_JUSTIFY_RIGHT; @@ -655,7 +655,7 @@ static void draw_columns(vwm_charts_t *charts, vwm_chart_t *chart, vwm_column_t if (heading) str_len = snpf(str, sizeof(str), "Sys"); else - str_len = snpf(str, sizeof(str), "%.2fs", + str_len = snpf(str, sizeof(str), "%'.2fs", (float)proc_stat->stime * charts->inv_ticks_per_sec); str_justify = VWM_JUSTIFY_RIGHT; @@ -667,7 +667,7 @@ static void draw_columns(vwm_charts_t *charts, vwm_chart_t *chart, vwm_column_t else if (!proc_stat->start || proc_stat->start > sys_stat->boottime) str_len = snpf(str, sizeof(str), "??s"); else - str_len = snpf(str, sizeof(str), "%.2fs", + str_len = snpf(str, sizeof(str), "%'.2fs", (float)(sys_stat->boottime - proc_stat->start) * charts->inv_ticks_per_sec); str_justify = VWM_JUSTIFY_RIGHT; |