diff options
author | Jim Warner <james.warner@comcast.net> | 2022-09-19 00:00:00 -0500 |
---|---|---|
committer | Craig Small <csmall@dropbear.xyz> | 2022-09-20 19:34:40 +1000 |
commit | 6f990103584487dc18e73bfa509b56717d8be4b6 (patch) | |
tree | 5930842528b30be38411f4b6c15e3b3bbc6a94a0 | |
parent | 2c2be24a4a84617f88ce1c79493258da3af236b3 (diff) | |
download | procps-ng-6f990103584487dc18e73bfa509b56717d8be4b6.tar.gz |
top: additional tweaks for two abreast summary display <=== port of newlib 3543172d
______________________________ original newlib message
This patch just supplements the previous series with a
few minor tweaks representing some diverse objectives:
. a recent date for man page (which i always overlook)
. improved length calculations to maximize graph width
. a proper response to platforms with less than 8 cpus
. more consistency and readability with one blank line
Signed-off-by: Jim Warner <james.warner@comcast.net>
-rw-r--r-- | top/top.1 | 2 | ||||
-rw-r--r-- | top/top.c | 11 |
2 files changed, 7 insertions, 6 deletions
@@ -57,7 +57,7 @@ . .\" Document ///////////////////////////////////////////////////////////// .\" ---------------------------------------------------------------------- -.TH TOP 1 "June 2022" "procps-ng" "User Commands" +.TH TOP 1 "September 2022" "procps-ng" "User Commands" .\" ---------------------------------------------------------------------- .nh @@ -273,10 +273,10 @@ static const char Osel_filterI_fmt[] = "\ttype=%d,\t" OSEL_FILTER "%*s\n"; /* Support for adjoining display (if terminal is wide enough) */ #ifdef TOG4_OFF_SEP -static char Adjoin_sp[] = " "; +static char Adjoin_sp[] = " "; #define ADJOIN_space (sizeof(Adjoin_sp) - 1) #else -static char Adjoin_sp[] = " ~1 ~6 "; +static char Adjoin_sp[] = " ~6 ~1"; #define ADJOIN_space (sizeof(Adjoin_sp) - 5) // 1 for null, 4 unprintable #endif #define ADJOIN_limit 8 @@ -2143,7 +2143,6 @@ static void adj_geometry (void) { int num = (Curwin->rc.double_up + 1); int pfx = (Curwin->rc.double_up < 2) ? GRAPH_prefix_std : GRAPH_prefix_abv; Graph_len = (Screen_cols - (ADJOIN_space * Curwin->rc.double_up) - (num * (pfx + GRAPH_suffix))) / num; - Graph_len += (Screen_cols % num) ? 0 : 1; } else { Graph_len = Screen_cols - (GRAPH_prefix_std + GRAPH_length_max + GRAPH_suffix); if (Graph_len >= 0) Graph_len = GRAPH_length_max; @@ -5841,7 +5840,9 @@ static void keys_summary (int ch) { break; case '4': w->rc.double_up += 1; - if (w->rc.double_up >= ADJOIN_limit) w->rc.double_up = 0; + if ((w->rc.double_up >= ADJOIN_limit) + || ((w->rc.double_up >= smp_num_cpus))) + w->rc.double_up = 0; OFFw(w, (View_CPUSUM | View_CPUNOD)); break; case 'C': @@ -6301,7 +6302,7 @@ static struct rx_st *sum_rx (long total, long part1, long part2, int style) { } snprintf(buf3, sizeof(buf3), "%s%s", buf1, buf2); // 'width' has accounted for any show_special directives embedded above - snprintf(rx.graph, sizeof(rx.graph), "[~1%-*.*s]~1", width, width, buf3); + snprintf(rx.graph, sizeof(rx.graph), "[~1%-*.*s] ~1", width, width, buf3); return ℞ } // end: sum_rx |