gopsutil
gopsutil copied to clipboard
Fix #755 process.Percent returning invalid value
Hi @Lomanic and @shirou ,
Make it return percent of all cpu core usage which will bewteen 0 and 100.
I think this patch is match both you two's ideas and make the returned value valid.
If you want got the full core usage which was saw in top command, you can do this:
percent, _ := process.Percent(0)
percent *= float64(runtime.NumCPU())
This PR seems break a compatibility of returned value of PercentWithContext() and CPUPercent().
@shirou, I think there is no any compatibility was broken in this RP.
The PR #715 break the compatibility of returned value of PercentWithContext() and CPUPercent() in really. And you accept it. But it import 2 bugs also. This PR is only fixes those bugs.
@shirou do you want to add more collaborators for this repo, that will make this repo great and fix issue faster. I think every developer want to using a fresh upstream, that will reduce ecosystem split.
Now the v3 code don't work correctly on cpu_percent() either: Please fix that, it doesn't equal to python's psutil value