]> granicus.if.org Git - procps-ng/commit
top: enhance memory graphs two abreast summary display
authorJim Warner <james.warner@comcast.net>
Sun, 18 Sep 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Tue, 20 Sep 2022 08:50:55 +0000 (18:50 +1000)
commit602146a623a28b12552831c01aff87c934a3451e
treeaf2f40019cafd4198efbd096aa622dfc567e056a
parentbf916fdf046a98db9d621c95ce027802bccacc84
top: enhance memory graphs two abreast summary display

This patch introduces a new #define TOG4_MEM_FIX which
serves to turn off the new feature it also implements.

The feature, on by default, provides a flexible memory
graph approach which strives to always keep its visual
separator in alignment with cpu separators seen above.

Below is a summary of the algorithm implementing this:

1) First, ascertain the widest graph which corresponds
to the largest number of cpu graphs but doesn't exceed
maximum allowable graph width (i.e. GRAPH_length_max).

2) Next, apply that to the graphed 'Mem' portion which
is likely to remain entirely visible. However, it will
grow or shrink depending on total adjacent cpu graphs.

3) Last, the same width is used for the 'Swap' portion
but that graph is considered sacrificial and very well
could be truncated depending on the width of a screen.

[ along the way, when the cpu graphs revert to their ]
[ abbreviated form, the memory graphs will also show ]
[ an abbreviated prefix. in this way the widths will ]
[ also be maximized, reducing potential distortions. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
src/top/top.c
src/top/top.h