amwyyyy opened a new issue #7602:
URL: https://github.com/apache/skywalking/issues/7602


   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [x] Question or discussion
   - [ ] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   #### The cpu usage rate exceeds 100%. From the source code of the agent, it 
will not exceed 100%. What might be the cause?
   
   <img width="1859" alt="图片" 
src="https://user-images.githubusercontent.com/8274512/131280025-daca2ce4-9afa-4d50-99e2-b1ee03b2d22f.png";>
   
   ```
       public CPU getCPUMetrics() {
           long cpuTime = this.getCpuTime();
           long cpuCost = cpuTime - lastCPUTimeNs;
           long now = System.nanoTime();
   
           try {
               CPU.Builder cpuBuilder = CPU.newBuilder();
               return cpuBuilder.setUsagePercent(cpuCost * 1.0d / ((now - 
lastSampleTimeNs) * cpuCoreNum) * 100).build();
           } finally {
               lastCPUTimeNs = cpuTime;
               lastSampleTimeNs = now;
           }
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to