]> granicus.if.org Git - procps-ng/commitdiff
top: added a new #define to test absence of numa nodes
authorJim Warner <james.warner@comcast.net>
Tue, 20 Jul 2021 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Tue, 27 Jul 2021 11:17:18 +0000 (21:17 +1000)
This new #define will produce top results identical to
the results achieved for './configure --disable-numa'.

However it keeps the change entirely local to our top.

[ it has been introduced to test the following patch ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c
top/top.h

index 04e756549b1fb249e50f0a4ef86cabe18d37bcbd..c69db6b57cc543cf881e5dc2abb3060be9005e74 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -2354,11 +2354,13 @@ static void cpus_refresh (void) {
    Stat_reap = procps_stat_reap(Stat_ctx, which, Stat_items, MAXTBL(Stat_items));
    if (!Stat_reap)
       error_exit(fmtmk(N_fmt(LIB_errorcpu_fmt),__LINE__, strerror(errno)));
+#ifndef PRETEND0NUMA
    // adapt to changes in total numa nodes (assuming it's even possible)
    if (Stat_reap->numa->total && Stat_reap->numa->total != Numa_node_tot) {
       Numa_node_tot = Stat_reap->numa->total;
       Numa_node_sel = -1;
    }
+#endif
    if (Stat_reap->cpus->total && Stat_reap->cpus->total != Cpu_cnt) {
       Cpu_cnt = Stat_reap->cpus->total;
 #ifdef PRETEND48CPU
@@ -3259,7 +3261,9 @@ static void before (char *me) {
       error_exit(fmtmk(N_fmt(LIB_errorcpu_fmt),__LINE__, strerror(-rc)));
    if (!(Stat_reap = procps_stat_reap(Stat_ctx, which, Stat_items, MAXTBL(Stat_items))))
       error_exit(fmtmk(N_fmt(LIB_errorcpu_fmt),__LINE__, strerror(errno)));
+#ifndef PRETEND0NUMA
    Numa_node_tot = Stat_reap->numa->total;
+#endif
    Cpu_cnt = Stat_reap->cpus->total;
 #ifdef PRETEND48CPU
    Cpu_cnt = 48;
index 5ab5759bfec8653801279f618183a16f7d52de34..0a95ea3d36e88c303335ed7c87472f7a983e06a8 100644 (file)
--- a/top/top.h
+++ b/top/top.h
@@ -38,6 +38,7 @@
 //#define OFF_STDERROR            /* disable our stderr buffering (redirect) */
 //#define OFF_STDIOLBF            /* disable our own stdout _IOFBF override  */
 //#define OFF_XTRAWIDE            /* disable our extra wide multi-byte logic */
+//#define PRETEND0NUMA            /* pretend that there ain't any numa nodes */
 //#define PRETEND48CPU            /* pretend we're smp with 48 ticsers (sic) */
 //#define PRETENDNOCAP            /* use a terminal without essential caps   */
 //#define QUICK_GRAPHS            /* use fast algorithm, accept +2% distort  */