summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Warner <james.warner@comcast.net>2022-09-12 08:00:00 -0500
committerCraig Small <csmall@dropbear.xyz>2022-09-13 19:54:33 +1000
commit3543172d4b6aaa75cdcd8d1ab29d0bda7a50b452 (patch)
tree4cafe0ddb936dc7118a0311d29e73b9ba6a2f470
parentfd529e967983c88343c531559d71cf37c16ad064 (diff)
downloadprocps-ng-3543172d4b6aaa75cdcd8d1ab29d0bda7a50b452.tar.gz
top: additional tweaks for two abreast summary display
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--man/top.12
-rw-r--r--src/top/top.c12
2 files changed, 8 insertions, 6 deletions
diff --git a/man/top.1 b/man/top.1
index e3b0fb2..5561d5f 100644
--- a/man/top.1
+++ b/man/top.1
@@ -59,7 +59,7 @@ memory statistics and data for other users requires root privileges
.
.\" Document /////////////////////////////////////////////////////////////
.\" ----------------------------------------------------------------------
-.TH TOP 1 "June 2022" "procps-ng" "User Commands"
+.TH TOP 1 "September 2022" "procps-ng" "User Commands"
.\" ----------------------------------------------------------------------
.nh
diff --git a/src/top/top.c b/src/top/top.c
index 48e76a8..b713b61 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -244,10 +244,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) // 1 for null
#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
@@ -2074,7 +2074,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;
@@ -5708,7 +5707,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 >= Cpu_cnt)))
+ w->rc.double_up = 0;
OFFw(w, (View_CPUSUM | View_CPUNOD));
break;
case 'C':
@@ -6168,7 +6169,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 &rx;
} // end: sum_rx
@@ -6444,6 +6445,7 @@ static void do_memory (void) {
, rx->graph);
}
Msg_row += sum_see(row, mem2UP);
+
rx = sum_rx(MEM_VAL(swp_TOT), 0, MEM_VAL(swp_USE), Curwin->rc.graph_mems);
if (Curwin->rc.double_up > 1)
snprintf(row, sizeof(row), "%s %s~3%3.0f%s"