For some reason, when trying to process the information for the final core, all values are returned as 0, or NaN, by the time it is displayed. Perhaps the problem is that this phone is actually bears one of those weird processors with an odd number of cores? I doubt that's it, so there is probably a logic error somewhere causing the wrong data to be polled. A one-off error...
for (int cntr2 = 0; cntr2 < 4; cntr2++) {
idle = deviceStats[cntr2][0]; iowait = deviceStats[cntr2][1];
irq = deviceStats[cntr2][2]; softirq = deviceStats[cntr2][3];
/*for (int statline : deviceStats[cntr2]) {
idle = statline[0];
iowait = statline[1];
irq = statline[2];
softirq = statline[3];*/
total = (idle + iowait + irq + softirq) / 100; //percentage work
if (debugging >= GENERAL) {
Toast.makeText(appShit, "total: " + total +
"\nidle: " + idle + "\niowait: " + iowait +
"\nirq: " + irq + "\nsoftirq: " + softirq,
Toast.LENGTH_SHORT).show();
}
try {
statsBox.append("\nCore: " + cntr2 + "\n\tIdle: " +
((float)idle / total) + "%\tIO Wait: " + ((float)iowait / total));
statsBox.append("%\n\tIRQ: " + ((float)irq / total) + "%\t\tSoft IRQ: " +
((float)softirq / total) + "%\n\n");
} catch (Exception e) {
Toast.makeText(appShit, "cntr: " + cntr2 + ": " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
//}
}
Told ya that code got uglified...