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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2021-07-20 00:00:00 -05:00 committed by Craig Small
parent 963d8ad52f
commit 6a8d8ff80b
2 changed files with 5 additions and 0 deletions

View File

@ -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;

View File

@ -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 */