0
Okay, guys, here’s the thing, I developed a code to pick up the percentage used by my processor core application:
private String getCPULoad() {
OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
DecimalFormat df = new DecimalFormat("#.##");
return (df.format(osBean.getProcessCpuLoad())) + "%";
}
In theory he should give me back the percentage, because well he returns it, only in the wrong way, for example: when all the cores are used at 100%, he should return me the percentage "100%", but instead he returns me 0,1%, could someone tell me what I’m doing wrong?
If the data were actually collected correctly, it would still correspond to 10% CPU (
0.1 * 100
), which conflicts with the statement that he was using all the cores at 100%– Jefferson Quesado
In fact it would be multiply by 1000, but for some reason I’m not managing to do this multiplication
– Sydrus