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

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