-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
process.Percent returns incorrect value on multiple cores #755
Comments
Looks like the percent calculation was wrong all along then, as I don't think having more than 100% is expectable (it's called "Percent" after all). Or the other way, if we assume the calculation was right before, the fix is as simple as The commit you mention is f4e2355 btw (way easier to find afterwards instead of "this commit from days ago"). |
make it return percent of all cpu core usage which will bewteen 0 and 100
in multi-core platform
Hi, In general, a "percent" can totally be greater than 100 ("inflation at 250%"), or lesser than 0 ("-30% discount !"). It's just a ratio, multiplied by 100.
CPU usage is taken from lrita@9870316 would make things more consistent, but the reference would be the total capacity of the machine, not 1 core. I strongly suggest f4e2355 should just be reverted. Thanks ! (Adding a floor at 0 should have no consequence because a negative value is theoretically impossible. I'd suggest raising an error instead of forcing a 0 value, but no strong opinion) |
I've just spent the last $hours debugging this after 1.11.2 => 1.12.3 telegraf upgrade.
((1000/ (6*250))*100) * 6 = (1000/1500) *100) * 6 = 400. If you /were/ to constrain this to 0..100 for a 'process' - then 100 should mean that process is using all of the available CPU cores. Clearly that's not how it is functioning today, any process consuming more than a single-core's worth of CPU returns 100. I think - where you already factor the number of cpu-cores into 'delta' - you can drop the * numcpu in the overall_percent to get the 'right' answer, if the intent was to have 100% mean 'every core doing work for this process' Happy to send a pull-request if you agree. |
…ent() between 0 and 100" This reverts commit f4e2355. Fixes shirou#755
hello:
Some days before you push process.go, you change code
According to my observation ,this is probably wrong.
when the process useing 60% of a six core processor ,the process.Percent return 100 to me not 6 * 100 * 60%
The text was updated successfully, but these errors were encountered: