Open dsluo opened 5 years ago
@dsluo I compared the output of psutil
on macOS and on Ubuntu Linux a couple of days ago. Sadly, they're not consistent either...
@anirudhajith What do you mean? Can you provide an example?
@dsluo I stand corrected. I checked psutil's output on my friend's MacBook. It's consistent for the most part. WE ARE GO FOR PSUTIL!
@dsluo
I've attempted a port to psutil
on a new branch: d7531658f1e07c00819d24998d1aec54c3498716
This should work on all platforms since we're not relying on the precise format of the output of top
.
@anirudhajith alright, I'm gonna pull the branch and make some changes.
@anirudhajith according to psutil's docs, the first time that cpu_percent
is retrieved, it will always return 0% CPU usage. As such all processes from when you iterate through psutil.process_iter
will have 0% CPU.
@anirudhajith I've pushed some changes to the psutil
branch that should address this.
This will ensure better compatibility as
psutil
takes care of all that for us and a better API astop
wasn't really meant to be machine readable anyway.