top: adapt former PRETEND8CPUS #define as PRETEND48CPU
This patch simply allows for better testing of our two new toggles: '4' (2 abreast) plus '!' (combined cpus). It had previously been dropped under the newlib branch since top no longer managed cpus. However, now that we have those new toggles, it seemed worth the efforts to once again re-imagine then implement such a provision. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
c2d10e7f07
commit
2ca99a2ee4
23
top/top.c
23
top/top.c
@ -2336,8 +2336,12 @@ static void cpus_refresh (void) {
|
||||
Numa_node_tot = Stat_reap->nodes->total;
|
||||
Numa_node_sel = -1;
|
||||
}
|
||||
if (Stat_reap->cpus->total && Stat_reap->cpus->total != Cpu_cnt)
|
||||
if (Stat_reap->cpus->total && Stat_reap->cpus->total != Cpu_cnt) {
|
||||
Cpu_cnt = Stat_reap->cpus->total;
|
||||
#ifdef PRETEND48CPU
|
||||
Cpu_cnt = 48;
|
||||
#endif
|
||||
}
|
||||
return;
|
||||
} // end: cpus_refresh
|
||||
|
||||
@ -3233,6 +3237,9 @@ static void before (char *me) {
|
||||
error_exit(fmtmk(N_fmt(LIB_errorcpu_fmt),__LINE__, strerror(errno)));
|
||||
Numa_node_tot = Stat_reap->nodes->total;
|
||||
Cpu_cnt = Stat_reap->cpus->total;
|
||||
#ifdef PRETEND48CPU
|
||||
Cpu_cnt = 48;
|
||||
#endif
|
||||
|
||||
// prepare for memory stats from new library API ...
|
||||
if ((rc = procps_meminfo_new(&Mem_ctx)))
|
||||
@ -5516,7 +5523,11 @@ numa_oops:
|
||||
if (i == Numa_node_tot) goto numa_oops;
|
||||
snprintf(tmp, sizeof(tmp), N_fmt(NUMA_nodenam_fmt), Numa_node_sel);
|
||||
Msg_row += cpu_tics(Stat_reap->nodes->stacks[Numa_node_sel], tmp, 1);
|
||||
#ifdef PRETEND48CPU
|
||||
for (i = 0; i < Stat_reap->cpus->total; i++) {
|
||||
#else
|
||||
for (i = 0; i < Cpu_cnt; i++) {
|
||||
#endif
|
||||
if (Numa_node_sel == CPU_VAL(stat_NU, i)) {
|
||||
if (!isROOM(anyFLG, 1)) break;
|
||||
snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), CPU_VAL(stat_ID, i));
|
||||
@ -5534,13 +5545,23 @@ numa_nope:
|
||||
// display each cpu's states separately, screen height permitting...
|
||||
if (w->combine_cpus) {
|
||||
for (i = 0; i < Cpu_cnt; i++) {
|
||||
#ifdef PRETEND48CPU
|
||||
Stat_reap->summary->head[stat_ID].result.s_int = i;
|
||||
Msg_row += cpu_unify(Stat_reap->summary, (i+1 >= Cpu_cnt));
|
||||
#else
|
||||
Msg_row += cpu_unify(Stat_reap->cpus->stacks[i], (i+1 >= Cpu_cnt));
|
||||
#endif
|
||||
if (!isROOM(anyFLG, 1)) break;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < Cpu_cnt; i++) {
|
||||
#ifdef PRETEND48CPU
|
||||
snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), i);
|
||||
Msg_row += cpu_tics(Stat_reap->summary, tmp, (i+1 >= Cpu_cnt));
|
||||
#else
|
||||
snprintf(tmp, sizeof(tmp), N_fmt(WORD_eachcpu_fmt), CPU_VAL(stat_ID, i));
|
||||
Msg_row += cpu_tics(Stat_reap->cpus->stacks[i], tmp, (i+1 >= Cpu_cnt));
|
||||
#endif
|
||||
if (!isROOM(anyFLG, 1)) break;
|
||||
}
|
||||
}
|
||||
|
@ -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 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 */
|
||||
//#define RCFILE_NOERR /* rcfile errs silently default, vs. fatal */
|
||||
|
Loading…
Reference in New Issue
Block a user