shirou / gopsutil

psutil for golang
Other
10.6k stars 1.59k forks source link

refactor CpuUtilTotalStat as CpuUtilStat #1509

Closed yakuter closed 1 year ago

yakuter commented 1 year ago

This PR fixes a bug (wrong function name) in the AIX support of the CPU package.

Screenshot 2023-08-18 at 11 40 34
shirou commented 1 year ago

I am unable to confirm this using AIX's actual machine. However, cpu.Times() returns the "number of CPUs consumed at the moment" based on the Linux definition. Therefore, I think using perfstat.CpuUtilTotalStat() is correct. Also, when percpu is true, perfstat.CpuStat() is used, which does not wait one second. Wouldn't we get different meanings when percpu is true and false?

I am not familiar with AIX so sorry if I am wrong.

yakuter commented 1 year ago

Hi @shirou thank you for the comment. There is no function called CpuUtilTotalStat in the project. I think it is already a typo. So it should be either CpuUtilStat or CpuTotalStat. As long as I get the CPU info in AIX rıght, they are all OK for me :)

shirou commented 1 year ago

Hmm, it seems CpuUtilTotalStat is defined here. And also I can build with GOOS=aix GOARCH=ppc64.

yakuter commented 1 year ago

Ohh I searched in the wrong project, you are right. Thank you @shirou , that should be great 🙏

shirou commented 1 year ago

I am closing this PR. If you have another issue, please feel free to reopen it. Thank you for using gopsutil.