top: show fewer decimal places for memory (by default)

After much reflection I've come to the conclusion that
displaying 3 decimal places (usually) when memory data
had been scaled is no longer optimal with today's ever
increasing amounts. And given that not all task memory
fields are the same widths, inconsistencies can easily
arise as illustrated and discussed in the issue below.

Instead of unilaterally reducing the number of decimal
places, this commit will sneak in such a change via an
existing configure option that was very likely unused.

The former 'disable-wide-memory' option has now become
'enable-wide-memory', which can be used if the current
behavior (3 decimal places) is preferred. Without that
option, whenever memory is scaled beyond KiB, just one
decimal place will be shown in Summary and Task areas.

And Task area field width will no longer be changed by
this revised configure option. Instead, all such field
widths will now be fixed at the former maximum values.

Reference(s):
https://gitlab.com/procps-ng/procps/issues/50

[ this patch has been adapted from the master branch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2017-03-13 03:00:00 -05:00
committed by Craig Small
parent 7468e229e8
commit f318be467b
4 changed files with 23 additions and 34 deletions

View File

@ -223,11 +223,11 @@ if test "x$enable_wide_percent" = xyes; then
fi
AC_ARG_ENABLE([wide-memory],
AS_HELP_STRING([--disable-wide-memory], [disable extra precision under memory fields for top]),
[], [enable_wide_memory=yes]
AS_HELP_STRING([--enable-wide-memory], [provide extra precision under memory fields for top]),
[], [enable_wide_memory=no]
)
if test "x$enable_wide_memory" = xno; then
AC_DEFINE(NOBOOST_MEMS, 1, [disable extra precision under memory fields for top])
if test "x$enable_wide_memory" = xyes; then
AC_DEFINE(BOOST_MEMORY, 1, [provide extra precision under memory fields for top])
fi
AC_ARG_ENABLE([modern-top],