From 6a8d8ff80bcadba9da90c4ca735fb7b457a717b9 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 20 Jul 2021 00:00:00 -0500 Subject: [PATCH] top: added a new #define to test absence of numa nodes 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 --- top/top.c | 4 ++++ top/top.h | 1 + 2 files changed, 5 insertions(+) diff --git a/top/top.c b/top/top.c index 04e75654..c69db6b5 100644 --- 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; diff --git a/top/top.h b/top/top.h index 5ab5759b..0a95ea3d 100644 --- 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 */