summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Warner <james.warner@comcast.net>2014-06-29 00:00:00 -0500
committerCraig Small <csmall@enc.com.au>2014-07-01 21:30:46 +1000
commit8ef6cd91fc5df6372a93bc4a37cbad34ead9654e (patch)
tree62bde0451be545cc3d1e218da93c53db2a036c64
parent2199af404a92cac238728564f2f022255c5716ce (diff)
downloadprocps-ng-8ef6cd91fc5df6372a93bc4a37cbad34ead9654e.tar.gz
top: retire old stale startup defaults in favor of new
For over a decade top has used a startup configuration mimicking the original redhat top. This decision dates back to when the forked Sourceforge version was trying to win over users in battles with that ancient kludge. Will anybody deny that those defaults are coyote ugly? Well, it is time that top presented a more modern look at startup, providing that no saved rcfile exists. But just in case some distro prefers that old, comfortable look, there's the '--disable-modern-top' build option. [ Pssst. With the widened memory fields it turns out ] [ the 'Mem' default window had become almost useless ] [ on an 80x24 terminal since %CPU & COMMAND were out ] [ of view. So some other defaults were tweaked a bit ] [ whether or not --disable-modern-top was specified. ] Reference(s) http://www.freelists.org/post/procps/tops-graph-mode-saga-continues,3 Signed-off-by: Jim Warner <james.warner@comcast.net>
-rw-r--r--NEWS1
-rw-r--r--configure.ac8
-rw-r--r--top/top.19
-rw-r--r--top/top.h37
4 files changed, 44 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index 83809e7..f55546d 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ procps-ng-3.3.10
* top missing summary area info added to man document, ubuntu #574624
* top properly responds to the current locale LC_NUMERIC setting
* top provides alternate graph modes for cpu states and memory usage
+ * top offers new startup defaults, plus ./configure --disable-modern-top
procps-ng-3.3.9
diff --git a/configure.ac b/configure.ac
index 47e965a..ef48e58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -225,6 +225,14 @@ if test "x$enable_wide_memory" = xno; then
AC_DEFINE(NOBOOST_MEMS, 1, [disable extra precision under memory fields for top])
fi
+AC_ARG_ENABLE([modern-top],
+ AS_HELP_STRING([--disable-modern-top], [disable new startup defaults, return to original top]),
+ [], [enable_modern_top=yes]
+)
+if test "x$enable_modern_top" = xno; then
+ AC_DEFINE(ORIG_TOPDEFS, 1, [disable new startup defaults, return to original top])
+fi
+
DL_LIB=
AC_ARG_ENABLE([numa],
AS_HELP_STRING([--disable-numa], [disable NUMA/Node support in top]),
diff --git a/top/top.1 b/top/top.1
index 6aebd5d..68c9f4e 100644
--- a/top/top.1
+++ b/top/top.1
@@ -238,7 +238,7 @@ All are explained in detail in the sections that follow.
.nf
\fIGlobal-defaults\fR
A \- Alt display Off (full-screen)
- * d \- Delay time 3.0 seconds
+ * d \- Delay time 1.5 seconds
* H \- Threads mode Off (summarize as tasks)
I \- Irix mode On (no, `solaris' smp)
* p \- PID monitoring Off (show all processes)
@@ -248,9 +248,9 @@ All are explained in detail in the sections that follow.
l \- Load Avg/Uptime On (thus program name)
t \- Task/Cpu states On (1+1 lines, see `1')
m \- Mem/Swap usage On (2 lines worth)
- 1 \- Single Cpu On (thus 1 line if smp)
+ 1 \- Single Cpu Off (thus multiple cpus)
\fITask-Area-defaults\fR
- b \- Bold hilite On (not `reverse')
+ b \- Bold hilite Off (use `reverse')
* c \- Command line Off (name, not cmdline)
* i \- Idle tasks On (show all tasks)
J \- Num align right On (not left justify)
@@ -259,9 +259,10 @@ All are explained in detail in the sections that follow.
* S \- Cumulative time Off (no, dead children)
* u \- User filter Off (show euid only)
* U \- User filter Off (show any uid)
+ V \- Forest view On (show as branches)
x \- Column hilite Off (no, sort field)
y \- Row hilite On (yes, running tasks)
- z \- color/mono Off (no, colors)
+ z \- color/mono On (show colors)
.fi
.\" ----------------------------------------------------------------------
diff --git a/top/top.h b/top/top.h
index 26532f0..2a06e9a 100644
--- a/top/top.h
+++ b/top/top.h
@@ -27,6 +27,7 @@
//#define NOBOOST_MEMS /* disable extra precision for mem fields */
//#define NUMA_DISABLE /* disable summary area NUMA/Nodes display */
//#define OOMEM_ENABLE /* enable the SuSE out-of-memory additions */
+//#define ORIG_TOPDEFS /* with no rcfile retain original defaults */
//#define SIGNALS_LESS /* favor reduced signal load over response */
/* Development/Debugging defines ----------------------------------- */
@@ -103,7 +104,11 @@ char *strcasestr(const char *haystack, const char *needle);
/*###### Some Miscellaneous constants ##################################*/
/* The default delay twix updates */
+#ifdef ORIG_TOPDEFS
#define DEF_DELAY 3.0
+#else
+#define DEF_DELAY 1.5
+#endif
/* Length of time a message is displayed and the duration
of a 'priming' wait during library startup (in microseconds) */
@@ -327,9 +332,23 @@ typedef struct CPU_t {
#endif
// Default flags if there's no rcfile to provide user customizations
+#ifdef ORIG_TOPDEFS
#define DEF_WINFLGS ( View_LOADAV | View_STATES | View_CPUSUM | View_MEMORY \
| Show_HIBOLD | Show_HIROWS | Show_IDLEPS | Show_TASKON | Show_JRNUMS \
| Qsrt_NORMAL )
+#define DEF_GRAPHS2 0, 0
+#define DEF_SCALES2 SK_Kb, SK_Kb
+#define ALT_WINFLGS DEF_WINFLGS
+#define ALT_GRAPHS2 0, 0
+#else
+#define DEF_WINFLGS ( View_LOADAV | View_STATES | View_MEMORY \
+ | Show_COLORS | Show_FOREST | Show_HIROWS | Show_IDLEPS | Show_JRNUMS | Show_TASKON \
+ | Qsrt_NORMAL )
+#define DEF_GRAPHS2 1, 2
+#define DEF_SCALES2 SK_Gb, SK_Mb
+#define ALT_WINFLGS (DEF_WINFLGS | Show_HIBOLD) & ~Show_FOREST
+#define ALT_GRAPHS2 2, 0
+#endif
/* These are used to direct wins_reflag */
enum reflag_enum {
@@ -581,10 +600,14 @@ typedef struct WIN_t {
( with just one escaped value, the '\' character ) */
#define FLD_OFFSET '%'
// seq_fields "%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghij"
+#ifdef ORIG_TOPDEFS
#define DEF_FIELDS "¥¨³´»½ÀÄ·º¹Å&')*+,-./012568<>?ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
+#else
+#define DEF_FIELDS "¥&K¨³´»½@·º¹56ÄFÅ')*+,-./0128<>?ABCGHIJLMNOPQRSTUVWXYZ[" RCF_PLUS_H
+#endif
/* Pre-configured windows/field groups */
-#define JOB_FIELDS "¥¦¹·º³´Ä»¼½§Å()*+,-./012568>?@ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
-#define MEM_FIELDS "¥º»¼½¾¿ÀÁÃij´·Å&'()*+,-./0125689BFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
+#define JOB_FIELDS "¥¦¹·º(³´Ä»½@<§Å)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
+#define MEM_FIELDS "¥º»<½¾¿ÀÁMBNÃD34·Å&'()*+,-./0125689FGHIJKLOPQRSTUVWXYZ[" RCF_PLUS_H
#define USR_FIELDS "¥¦§¨ª°¹·ºÄÅ)+,-./1234568;<=>?@ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
#ifdef OOMEM_ENABLE
// the suse old top fields ( 'a'-'z' + '{|' ) in positions 0-27
@@ -600,19 +623,19 @@ typedef struct WIN_t {
/* The default values for the local config file */
#define DEF_RCFILE { \
RCF_VERSION_ID, 0, 1, DEF_DELAY, 0, { \
- { EU_CPU, DEF_WINFLGS, 0, 0, 0, \
+ { EU_CPU, DEF_WINFLGS, 0, DEF_GRAPHS2, \
COLOR_RED, COLOR_RED, COLOR_YELLOW, COLOR_RED, \
"Def", DEF_FIELDS }, \
- { EU_PID, DEF_WINFLGS, 0, 0, 0, \
+ { EU_PID, ALT_WINFLGS, 0, ALT_GRAPHS2, \
COLOR_CYAN, COLOR_CYAN, COLOR_WHITE, COLOR_CYAN, \
"Job", JOB_FIELDS }, \
- { EU_MEM, DEF_WINFLGS, 0, 0, 0, \
+ { EU_MEM, ALT_WINFLGS, 0, ALT_GRAPHS2, \
COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLUE, COLOR_MAGENTA, \
"Mem", MEM_FIELDS }, \
- { EU_UEN, DEF_WINFLGS, 0, 0, 0, \
+ { EU_UEN, ALT_WINFLGS, 0, ALT_GRAPHS2, \
COLOR_YELLOW, COLOR_YELLOW, COLOR_GREEN, COLOR_YELLOW, \
"Usr", USR_FIELDS } \
- }, 0, SK_Kb, SK_Kb, 0 }
+ }, 0, DEF_SCALES2, 0 }
/* Summary Lines specially formatted string(s) --
see 'show_special' for syntax details + other cautions. */