diff options
| author | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-25 22:48:39 -0600 |
|---|---|---|
| committer | Sean Kurtz <seankurtz75@gmail.com> | 2026-11-25 22:48:39 -0600 |
| commit | 33dbb6057513fc8ba498b7cc05b9e5ccfea5fb58 (patch) | |
| tree | 5cb3e1283292b1eb65687d19136274dc84c30b80 /src | |
| parent | 986d03c57f5a55cde1f4e6af0418a5d9e062a689 (diff) | |
| download | ztop-33dbb6057513fc8ba498b7cc05b9e5ccfea5fb58.tar.gz | |
ztop: PVT has an unallocated pass, so it gets a total and a percent
Only CSA and PVT are asked for unallocated blocks; SQA and LSQA keep the
dash, because their totals are not knowable this way.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ztop.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -163,10 +163,15 @@ static bool collect_area(struct vsm_info *v, int area, bool dump) { } /** @brief Fraction of the mapped area in use, or -1 when there is no total. */ +/* Only CSA and PVT get an unallocated pass, so only they have a total. */ +static bool has_total(const struct vsm_info *v) { + return (v->area == VSM_CSA || v->area == VSM_PVT) && v->unalloc_valid; +} + static int pct(const struct vsm_info *v) { uint64_t total; - if (!v->unalloc_valid || v->area != VSM_CSA) + if (!has_total(v)) return -1; total = v->foot + v->unalloc; if (total == 0) @@ -582,7 +587,7 @@ static void draw_storage(struct tui *t, struct app *a) { human(v->used, used, sizeof used); human(v->free, freed, sizeof freed); human(v->foot, mapped, sizeof mapped); - if (v->area == VSM_CSA && v->unalloc_valid) { + if (has_total(v)) { human(v->foot + v->unalloc, total, sizeof total); (void)snprintf(pcbuf, sizeof pcbuf, "use %d%%", p); } else { |
