fix getProcessCpuStat return value (in percentage) breaks compatibility.#540
fix getProcessCpuStat return value (in percentage) breaks compatibility.#540sunyucheng wants to merge 1 commit intoalibaba:masterfrom
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #540 +/- ##
==========================================
+ Coverage 53.17% 53.25% +0.08%
==========================================
Files 91 91
Lines 5894 5896 +2
==========================================
+ Hits 3134 3140 +6
+ Misses 2413 2408 -5
- Partials 347 348 +1
☔ View full report in Codecov by Sentry. |
|
Hi @binbin0325 @sczyh30, looking forward to your reply. |
| } | ||
|
|
||
| // fix getProcessCpuStat return value (in percentage) breaks compatibility. | ||
| cpuNum := runtime.NumCPU() |
There was a problem hiding this comment.
Is it for CPU requests or CPU limits under container env?
|
Hi @sczyh30 @binbin0325, if there are no doubts, we look forward to the adoption of PR |
|
Hi @sczyh30 @binbin0325, looking forward to your reply |
|
Hi @sczyh30 @binbin0325, looking forward to your reply |
|
|
||
| // fix getProcessCpuStat return value (in percentage) breaks compatibility. | ||
| cpuNum := runtime.NumCPU() | ||
| cpuPercent = cpuPercent / float64(cpuNum) / 100.0 |
There was a problem hiding this comment.
Why do we divide by cpuNum
Describe what this PR does / why we need it
fix getProcessCpuStat return value (in percentage) breaks compatibility.
Does this pull request fix one issue?
Fix #539
Describe how you did it
fix the bug that the CPU usage from getProcessCpuStat was changed to percentage value (i.e. 0-100), which breaks compatibility and affects system adaptive rules.
Describe how to verify it
Added a unit test
func TestRetrieveAndUpdateCpuStatReturnValueRange(t *testing.T)Special notes for reviews