gopsutil icon indicating copy to clipboard operation
gopsutil copied to clipboard

Fix #755 process.Percent returning invalid value

Open lrita opened this issue 6 years ago • 4 comments

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())

lrita avatar Sep 03 '19 16:09 lrita

This PR seems break a compatibility of returned value of PercentWithContext() and CPUPercent().

shirou avatar Sep 14 '19 08:09 shirou

@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.

lrita avatar Sep 17 '19 03:09 lrita

@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.

lrita avatar Oct 18 '19 07:10 lrita

Now the v3 code don't work correctly on cpu_percent() either: Please fix that, it doesn't equal to python's psutil value

keeplook4ever avatar Mar 26 '21 06:03 keeplook4ever