fixed CPU UsagePercent Error (#2222)

fixed CPU UsagePercent Error
The cpu usage storage longitude should be one percent, not one in ten thousand. When the storage unit is one ten thousandth, as long as the usage rate does not exceed 100%. Stored values are less than one. When the current query is forced to be converted to a long type, it will always be 0. This is not correct.
This commit is contained in:
2019-01-30 16:27:19 +08:00 committed by 吴晟 Wu Sheng
parent f7ca26729d
commit 5003d6da31
1 changed files with 1 additions and 1 deletions

View File

@ -46,6 +46,6 @@ public abstract class CPUMetricAccessor {
long now = System.nanoTime();
CPU.Builder cpuBuilder = CPU.newBuilder();
return cpuBuilder.setUsagePercent(cpuCost * 1.0d / ((now - lastSampleTimeNs) * cpuCoreNum)).build();
return cpuBuilder.setUsagePercent(cpuCost * 1.0d / ((now - lastSampleTimeNs) * cpuCoreNum) * 100).build();
}
}