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

Fix CPU is 0. (#2952)

上级 09225480
......@@ -22,6 +22,9 @@ 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.
*
* @author wusheng
*/
public abstract class CPUMetricsAccessor {
......@@ -46,6 +49,6 @@ public abstract class CPUMetricsAccessor {
long now = System.nanoTime();
CPU.Builder cpuBuilder = CPU.newBuilder();
return cpuBuilder.setUsagePercent(cpuCost * 1.0d / ((now - lastSampleTimeNs) * cpuCoreNum) * 100).build();
return cpuBuilder.setUsagePercent(cpuCost * 1.0d / ((now - lastSampleTimeNs) * cpuCoreNum) * 10000).build();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册