aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/top/machine.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/top/machine.c')
-rw-r--r--usr.bin/top/machine.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index f0420799e440..21bf033edc89 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -413,14 +413,15 @@ get_system_info(struct system_info *si)
si->load_avg[i] = (double)sysload.ldavg[i] / sysload.fscale;
if (pcpu_stats) {
- for (i = j = 0; i <= maxid; i++, j++) {
- if (cpumask && (1ul << i) == 0)
+ for (i = j = 0; i <= maxid; i++) {
+ if ((cpumask & (1ul << i)) == 0)
continue;
/* convert cp_time counts to percentages */
percentages(CPUSTATES, &pcpu_cpu_states[j * CPUSTATES],
&pcpu_cp_time[j * CPUSTATES],
&pcpu_cp_old[j * CPUSTATES],
&pcpu_cp_diff[j * CPUSTATES]);
+ j++;
}
} else {
/* convert cp_time counts to percentages */