未验证 提交 55d71e0e 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Update UI, revert #2952 and fix JVM CPU usage again (#2961)

* Update UI.

* Fix CPU time again

* Update UI.
上级 c82a230d
......@@ -22,8 +22,8 @@ package org.apache.skywalking.apm.agent.core.jvm.cpu;
import org.apache.skywalking.apm.network.common.CPU;
/**
* The unit of CPU usage is 1/10000.
* The backend is using `avg` func directly, and query for percentage requires this unit.
* The unit of CPU usage is 1/10000. The backend is using `avg` func directly, and query for percentage requires this
* unit.
*
* @author wusheng
*/
......@@ -38,7 +38,7 @@ public abstract class CPUMetricsAccessor {
protected void init() {
lastCPUTimeNs = this.getCpuTime();
this.lastSampleTimeNs = System.nanoTime();
lastSampleTimeNs = System.nanoTime();
}
protected abstract long getCpuTime();
......@@ -48,7 +48,12 @@ public abstract class CPUMetricsAccessor {
long cpuCost = cpuTime - lastCPUTimeNs;
long now = System.nanoTime();
CPU.Builder cpuBuilder = CPU.newBuilder();
return cpuBuilder.setUsagePercent(cpuCost * 1.0d / ((now - lastSampleTimeNs) * cpuCoreNum) * 10000).build();
try {
CPU.Builder cpuBuilder = CPU.newBuilder();
return cpuBuilder.setUsagePercent(cpuCost * 1.0d / ((now - lastSampleTimeNs) * cpuCoreNum) * 100).build();
} finally {
lastCPUTimeNs = cpuTime;
lastSampleTimeNs = now;
}
}
}
Subproject commit d48cc15b3a7260ff62a79dab3699db32a6889b3f
Subproject commit 1ace261b8bbef0ac8b799106fb0a8a362571153b
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册