elvetemedve / gnome-shell-extension-system-monitor

Gnome Shell extension for displaying resource usage
GNU General Public License v3.0
87 stars 15 forks source link

Missing processes for CPU usage? #27

Closed bagage closed 7 years ago

bagage commented 7 years ago

For multiple times now, it looks like the extension does not show all my processes in CPU list (while it looks OK for memory thanks to #25 fix ;-) ). See webm in action where Geary is not even appearing in the CPU list:

http://webm.land/media/NFb0.webm

Existing processes CPU percentage seems a little bit wrong too, but it might be due to refresh frequency?

elvetemedve commented 7 years ago

I changed the code which produces the process list to use GlibTop and I also added an option to filter out system processes. I expected kernel module processes to disappear, but it might be removed other processes too. I'll look into this.

Actually the extension has an error in the design. You will see the statistics for the previous refresh. That's because statistics has to be re-calculated asynchronously in the background, otherwise you will experience a lag in Gnome Shell at each refresh period (e.g. mouse pointer stops every 2 seconds). Unfortunately there is no way to create threads from an extension, so I had to use the glib.idle_add() function to schedule statistics calculation in the background. Sometimes I still see the lag, but I don't understand why. I'll think about other solutions.

bagage commented 7 years ago

I don't think the delay is much of an issue, because I don't expect the extension to be real-time. I would just expect it to give me a rough idea of what is going on - which it does well (except the missing processes).

It looks to me that processes started from the terminal (eg not from .desktop entries) are not listed? It might be the issue I see since I'm starting geary from the commandline.

elvetemedve commented 7 years ago

Alright. But if someone changes the refresh period to 10 seconds, it would mean a 10 seconds delay which is not so good.

Thanks for the info, I'll check it.

elvetemedve commented 7 years ago

@bagage I've found and fixed the problem with the process list.

Could you test it for me, please? Here is the fixed version: System_Monitor@bghome.gmail.com-7.zip

bagage commented 7 years ago

Yes, it works great. Again, thanks for the quick fix :).

elvetemedve commented 7 years ago

I'm glad to see that. :) New release is on the way.

bagage commented 7 years ago

Just on a side note: what does 1% of CPU usage means for the extension? It seems that htop and top have "100%" available for each CPU core. So in my case I can have up to 400% for a single process. I believe the extension 100% is the equivalent of the above 400%, right? If not, I am seeing odd values:

http://webm.land/media/1q7r.webm

elvetemedve commented 7 years ago

@bagage Yes, 100% means all available CPU cores are utilised (equivalent to htop's 400%). The percentage is computed using the time values from the first line of /proc/stat.