summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Warner <james.warner@comcast.net>2022-09-18 00:00:00 -0500
committerCraig Small <csmall@dropbear.xyz>2022-09-20 18:50:55 +1000
commit96153c0f0cea166edebb8e6c845f9f5a184f0a1d (patch)
tree5158fff66c46462be13e259604a2f3a8a57dad16
parente5386f1f217989c9e62188111891cb43ec11a244 (diff)
downloadprocps-ng-96153c0f0cea166edebb8e6c845f9f5a184f0a1d.tar.gz
top: distinct separator if two abreast summary display
When displaying detailed memory statistics two abreast data for the lines are less than those for cpus. So we can exploit such a difference to provide a distinctive separator. This may help separating cpu & memory data. [ in truth, this happened before this patch. what we ] [ are doing now is polishing that accidental feature ] [ and placing it under the control of a conditional. ] Signed-off-by: Jim Warner <james.warner@comcast.net>
-rw-r--r--src/top/top.c4
-rw-r--r--src/top/top.h4
-rw-r--r--src/top/top_nls.c6
3 files changed, 11 insertions, 3 deletions
diff --git a/src/top/top.c b/src/top/top.c
index bf1fd0f..b93ca9e 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -253,7 +253,11 @@ static const char Osel_filterI_fmt[] = "\ttype=%d,\t" OSEL_FILTER "%*s\n";
static char Adjoin_sp[] = " ";
#define ADJOIN_space (sizeof(Adjoin_sp) - 1) // 1 for null
#else
+#ifdef TOG4_STD_SEP
+static char Adjoin_sp[] = "~1 ~6 ";
+#else
static char Adjoin_sp[] = " ~6 ~1";
+#endif
#define ADJOIN_space (sizeof(Adjoin_sp) - 5) // 1 for null + 4 unprintable
#endif
#define ADJOIN_limit 8
diff --git a/src/top/top.h b/src/top/top.h
index 3619ed6..bc33f29 100644
--- a/src/top/top.h
+++ b/src/top/top.h
@@ -62,6 +62,7 @@
//#define THREADED_TSK /* separate background thread for tsk updt */
//#define TOG4_OFF_MEM /* don't show two abreast memory statistic */
//#define TOG4_OFF_SEP /* don't show two abreast visual separator */
+//#define TOG4_STD_SEP /* normal mem sep if 2 abreast & no graphs */
//#define TREE_NORESET /* sort keys should not force 'V' view off */
//#define TREE_SCANALL /* rescan array w/ forest view, avoid sort */
//#define TREE_VALTMRK /* use an indented '+' with collapsed pids */
@@ -625,6 +626,9 @@ typedef struct WIN_t {
#if defined(USE_X_COLHDR)
# warning 'USE_X_COLHDR' makes parts of man page misleading (4e, 5d & 5e)
#endif
+#if defined(TOG4_STD_SEP) && defined(TOG4_OFF_SEP)
+# warning 'TOG4_STD_SEP' has no effect when 'TOG4_OFF_SEP' is active
+#endif
/*###### Some Prototypes (ha!) #########################################*/
diff --git a/src/top/top_nls.c b/src/top/top_nls.c
index 8a34fab..7c44a7a 100644
--- a/src/top/top_nls.c
+++ b/src/top/top_nls.c
@@ -754,17 +754,17 @@ static void build_uniq_nlstab (void) {
. us = user, sy = system, ni = nice, id = idle, wa = wait,
. hi hardware interrupt, si = software interrupt */
Uniq_nlstab[STATE_lin2x6_fmt] = _("%s~3"
- " %#5.1f ~2us,~3 %#5.1f ~2sy,~3 %#5.1f ~2ni,~3 %#5.1f ~2id,~3 %#5.1f ~2wa,~3 %#5.1f ~2hi,~3 %#5.1f ~2si~3");
+ " %#5.1f ~2us,~3 %#5.1f ~2sy,~3 %#5.1f ~2ni,~3 %#5.1f ~2id,~3 %#5.1f ~2wa,~3 %#5.1f ~2hi,~3 %#5.1f ~2si~3 ~1");
/* Translation Hint: Only the following abbreviations need be translated
. us = user, sy = system, ni = nice, id = idle, wa = wait,
. hi hardware interrupt, si = software interrupt, st = steal time */
Uniq_nlstab[STATE_lin2x7_fmt] = _("%s~3"
- "%#5.1f ~2us,~3%#5.1f ~2sy,~3%#5.1f ~2ni,~3%#5.1f ~2id,~3%#5.1f ~2wa,~3%#5.1f ~2hi,~3%#5.1f ~2si,~3%#5.1f ~2st~3");
+ "%#5.1f ~2us,~3%#5.1f ~2sy,~3%#5.1f ~2ni,~3%#5.1f ~2id,~3%#5.1f ~2wa,~3%#5.1f ~2hi,~3%#5.1f ~2si,~3%#5.1f ~2st~3 ~1");
/* Translation Hint: next 2 must be treated together, with WORDS above & below aligned */
Uniq_nlstab[MEMORY_line1_fmt] = _(""
- "%s %s:~3 %9.9s~2total,~3 %9.9s~2free,~3 %9.9s~2used,~3 %9.9s~2buff/cache~3 ");
+ "%s %s:~3 %9.9s~2total,~3 %9.9s~2free,~3 %9.9s~2used,~3 %9.9s~2buff/cache~3 ~1 ");
Uniq_nlstab[MEMORY_line2_fmt] = _(""
"%s %s:~3 %9.9s~2total,~3 %9.9s~2free,~3 %9.9s~2used.~3 %9.9s~2avail %s~3");