Blame SOURCES/procps-ng-3.3.10-top-strange-mem-val-scaling.patch

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