Rounding cpu load
This commit is contained in:
parent
aa4e110832
commit
e38355aa56
2 changed files with 8 additions and 6 deletions
|
|
@ -32,6 +32,7 @@ import zutil.io.file.FileUtil;
|
|||
import zutil.parser.DataNode;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* Created by Ziver on 2015-04-07.
|
||||
|
|
@ -57,11 +58,11 @@ public class CpuStatus implements WAStatus {
|
|||
|
||||
try{
|
||||
Sigar sigar = new Shell().getSigar();
|
||||
for(CpuInfo cpu_info : sigar.getCpuInfoList()){
|
||||
for(CpuPerc cpu : sigar.getCpuPercList()){
|
||||
cpuNode.add(cpu.getCombined());
|
||||
}
|
||||
CpuInfo cpu_info = sigar.getCpuInfoList()[0];
|
||||
for(CpuPerc cpu : sigar.getCpuPercList()){
|
||||
cpuNode.add(Math.round(cpu.getCombined() * 100.0) / 100.0 );
|
||||
}
|
||||
|
||||
} catch (SigarException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue