Hi,
Due to the SMT stuff the output of top showed the first few cpus instead
of the ones that are actually active.
To reproduce the bad output:
Use a machine with hyper therading, top should show half the cpus, of
which every second is disabled.
The following diff skips the disabled cpus and disabling/reenabling the
cores with hw.smt also works.
The only problem is that the lines reserved for cpu-stats does not
change with reenabling. Refreshing the output with '1' or resizing the
window should help.
Thanks,
Moritz Buhl
Index: display.c
===================================================================
RCS file: /home/mbuhl/cvs/src/usr.bin/top/display.c,v
retrieving revision 1.55
diff -u -p -r1.55 display.c
--- display.c 26 Sep 2018 17:23:13 -0000 1.55
+++ display.c 5 Oct 2018 15:19:00 -0000
@@ -381,7 +381,7 @@ cpustates_tag(int cpu)
void
i_cpustates(int64_t *ostates, int *online)
{
- int i, first, cpu, ncpuonline;
+ int i, first, cpu, ncpuonline, off;
double value;
int64_t *states;
char **names, *thisname;
@@ -434,15 +434,18 @@ i_cpustates(int64_t *ostates, int *onlin
}
return;
}
+ off = 0;
for (cpu = 0; cpu < ncpu; cpu++) {
/* now walk thru the names and print the line */
names = cpustate_names;
first = 0;
states = ostates + (CPUSTATES * cpu);
- if ((screen_length > 2 + cpu && 2 + cpu < y_mem) ||
+ if (y_mem == ncpuonline + 2 && !online[cpu])
+ continue;
+ if ((screen_length > 2 + cpu && 2 + off < y_mem) ||
!smart_terminal) {
- move(2 + cpu, 0);
+ move(2 + off, 0);
clrtoeol();
addstrp(cpustates_tag(cpu));
@@ -465,6 +468,7 @@ i_cpustates(int64_t *ostates, int *onlin
}
putn();
}
+ off++;
}
}