You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
5.6 KiB

diff -up ./configure.ac.ori ./configure.ac
--- ./configure.ac.ori 2014-09-23 13:40:36.000000000 +0200
+++ ./configure.ac 2017-08-02 13:04:25.439881501 +0200
@@ -218,11 +218,11 @@ if test "x$enable_wide_percent" = xyes;
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],
diff -up ./top/top.c.ori ./top/top.c
--- ./top/top.c.ori 2017-08-02 12:56:41.681326790 +0200
+++ ./top/top.c 2017-08-02 13:50:24.953331241 +0200
@@ -1542,11 +1542,11 @@ static inline const char *make_str (cons
* We'll interpret 'num' as a kibibytes quantity and try to
* format it to reach 'target' while also fitting 'width'. */
static const char *scale_mem (int target, unsigned long num, int width, int justr) {
-#ifndef NOBOOST_MEMS
// SK_Kb SK_Mb SK_Gb SK_Tb SK_Pb SK_Eb
+#ifdef BOOST_MEMORY
static const char *fmttab[] = { "%.0f", "%#.1f%c", "%#.3f%c", "%#.3f%c", "%#.3f%c", NULL };
#else
- static const char *fmttab[] = { "%.0f", "%.0f%c", "%.0f%c", "%.0f%c", "%.0f%c", NULL };
+ static const char *fmttab[] = { "%.0f", "%.1f%c", "%.1f%c", "%.1f%c", "%.1f%c", NULL };
#endif
static char buf[SMLBUFSIZ];
float scaled_num;
@@ -1750,21 +1750,12 @@ static FLD_t Fieldstab[] = {
#else
{ 4, -1, A_right, SF(RES), L_statm }, // EU_MEM slot
#endif
-#ifndef NOBOOST_MEMS
{ 7, SK_Kb, A_right, SF(VRT), L_statm },
{ 6, SK_Kb, A_right, SF(SWP), L_status },
{ 6, SK_Kb, A_right, SF(RES), L_statm },
{ 6, SK_Kb, A_right, SF(COD), L_statm },
{ 7, SK_Kb, A_right, SF(DAT), L_statm },
{ 6, SK_Kb, A_right, SF(SHR), L_statm },
-#else
- { 5, SK_Kb, A_right, SF(VRT), L_statm },
- { 4, SK_Kb, A_right, SF(SWP), L_status },
- { 4, SK_Kb, A_right, SF(RES), L_statm },
- { 4, SK_Kb, A_right, SF(COD), L_statm },
- { 5, SK_Kb, A_right, SF(DAT), L_statm },
- { 4, SK_Kb, A_right, SF(SHR), L_statm },
-#endif
{ 4, -1, A_right, SF(FL1), L_stat },
{ 4, -1, A_right, SF(FL2), L_stat },
{ 4, -1, A_right, SF(DRT), L_statm },
@@ -1785,11 +1776,7 @@ static FLD_t Fieldstab[] = {
{ -1, -1, A_left, SF(ENV), L_ENVIRON },
{ 3, -1, A_right, SF(FV1), L_stat },
{ 3, -1, A_right, SF(FV2), L_stat },
-#ifndef NOBOOST_MEMS
{ 6, SK_Kb, A_right, SF(USE), L_USED },
-#else
- { 4, SK_Kb, A_right, SF(USE), L_USED },
-#endif
{ 10, -1, A_right, SF(NS1), L_NS }, // IPCNS
{ 10, -1, A_right, SF(NS2), L_NS }, // MNTNS
{ 10, -1, A_right, SF(NS3), L_NS }, // NETNS
@@ -5208,12 +5195,20 @@ numa_nope:
const char *fmts;
const char *label;
} scaletab[] = {
- { 1, "%1.0f ", NULL }, // kibibytes
- { 1024.0, "%#4.3f ", NULL }, // mebibytes
- { 1024.0*1024, "%#4.3f ", NULL }, // gibibytes
- { 1024.0*1024*1024, "%#4.3f ", NULL }, // tebibytes
- { 1024.0*1024*1024*1024, "%#4.3f ", NULL }, // pebibytes
- { 1024.0*1024*1024*1024*1024, "%#4.3f ", NULL } // exbibytes
+ { 1, "%.0f ", NULL }, // kibibytes
+#ifdef BOOST_MEMORY
+ { 1024.0, "%#.3f ", NULL }, // mebibytes
+ { 1024.0*1024, "%#.3f ", NULL }, // gibibytes
+ { 1024.0*1024*1024, "%#.3f ", NULL }, // tebibytes
+ { 1024.0*1024*1024*1024, "%#.3f ", NULL }, // pebibytes
+ { 1024.0*1024*1024*1024*1024, "%#.3f ", NULL } // exbibytes
+#else
+ { 1024.0, "%#.1f ", NULL }, // mebibytes
+ { 1024.0*1024, "%#.1f ", NULL }, // gibibytes
+ { 1024.0*1024*1024, "%#.1f ", NULL }, // tebibytes
+ { 1024.0*1024*1024*1024, "%#.1f ", NULL }, // pebibytes
+ { 1024.0*1024*1024*1024*1024, "%#.1f ", NULL } // exbibytes
+#endif
};
struct { // 0123456789
// snprintf contents of each buf (after SK_Kb): 'nnnn.nnn 0'
diff -up ./top/top.h.ori ./top/top.h
--- ./top/top.h.ori 2017-08-02 12:56:41.681326790 +0200
+++ ./top/top.h 2017-08-02 13:04:25.446881464 +0200
@@ -23,8 +23,8 @@
#include "../proc/readproc.h"
/* Defines represented in configure.ac ----------------------------- */
-//#define BOOST_PERCNT /* enable extra precision for two % fields */
-//#define NOBOOST_MEMS /* disable extra precision for mem fields */
+//#define BOOST_MEMORY /* enable extra precision for mem fields */
+//#define BOOST_PERCNT /* enable extra precision for 2 % 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 */