Skip to content
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

fix(cpu): fix cpu total and busy calc #1325

Merged
merged 1 commit into from Jul 11, 2022
Merged

fix(cpu): fix cpu total and busy calc #1325

merged 1 commit into from Jul 11, 2022

Conversation

shirou
Copy link
Owner

@shirou shirou commented Jul 9, 2022

The current CPU Total/Busy calculation is different from psutil code. This PR changes to make it the same as psutil.

This PR is based on #1308. Thank your @sworgod, and sorry for overwriting the same code. This PR is a credit to you. I appreciate it very much.

Note: I found cpu.Total() is exposed unintentionally. It will be removed in future release.

@sworgod
Copy link

sworgod commented Jul 9, 2022

You're welcome,my English is not very good.
不用谢,我也是在使用过程中发现了这个问题。

@edigaryev
Copy link
Sponsor

Note: I found cpu.Total() is exposed unintentionally. It will be removed in future release.

We use this function in the Cirrus CI Agent and it's pretty useful.

Is there a reason to remove it? Or maybe there's an alternative that allows to easily calculate the sum of all of the TimesStat fields?

@shirou
Copy link
Owner Author

shirou commented Aug 17, 2023

Because psutil does not have a method called Total. Also, Total is used to calculate Busy, but this value depends on the version of Linux. In other words, the meaning of Total may differ. So it is deprecated and should not be used.

However, since we have heard that you are using it now, this method will not disappear (but not guaranteed).

@sworgod
Copy link

sworgod commented Aug 17, 2023

Because psutil does not have a method called Total. Also, Total is used to calculate Busy, but this value depends on the version of Linux. In other words, the meaning of Total may differ. So it is deprecated and should not be used.

However, since we have heard that you are using it now, this method will not disappear (but not guaranteed).

The total method should not be canceled, Because I am also using it.
No need to guarantee identical functionality with psutil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants