High CPU usage applet (how to use apport to report CPU hogs)

Martin Olsson mnemo at minimum.se
Fri May 8 13:09:53 UTC 2009

Timo Sirainen wrote:
> If some process has been eating 100% CPU for hours, there should be some
> kind of a notification that it's happening. Like a small icon could
> appear to gnome panel and clicking it would show the process details and
> allow to kill it.
> Nowadays with multicore processors this 100% CPU usage can be difficult
> to notice. I've had it happen several times and lasting for over a week
> until I finally realized the system is running slower than normal.
> (I know about the existing system monitor applet. I don't want a
> distracting animation on my screen.)

Great idea, here is another proposed solution that utilizes apport as well.

I have been in this position as well, I have quad core machine with 8gb RAM
and I had just re-installed it so I did not have the CPU meter added as a
GNOME applet yet. I had this machine in this state for almost a week before I
finally added the CPU metering applet and saw it. Once 8-core becomes the norm
I don't even think the "CPU status graph tools" we have today will be enough
because I'm very much used to xorg and what not taking up like 1-5% of my CPU
all the time when I'm working on stuff so if one core out of eight is maxed
out that means the graphing tool showing like 10% all over CPU load which is
a bit of a distortion of the real situation I'd say. Problems get's even worse
with 16 cores etc.

I think an appropriate solution would be to force each app to tag itself with
a "LICENSED_TO_HOG_THE_CPU" badge before it starts to hog the CPU with 100%
intensity for extended periods of time.

Once we have a way for apps to tell us "yes i'm hogging the CPU by design"
we can just fire up an apport dialog asking the user if he wants to report
the CPU hogging as a bug to LP. If some apps gets incorrectly reported we'll
just fix that by making sure that they activate the "LICENSED_TO_HOG_THE_CPU"
badge/tag before they hog CPU and that they remove the marker/tag when they
stop their CPU intensive run.

Clearly some processes like "Seti at HOME" or whatever should be allowed to always
be marked with the LICENSED_TO_HOG_THE_CPU tag but normal apps should only
mark themselves with the tag for short periods of time while they know that
they will (or might) hog the CPU for a valid reason. For example, if apt needs
to rebuild some package database or whatever, then that process should mark
itself with the tag, do the necessary computations and then unmark itself.
Of course the apport thing won't trigger until a process runs with 100% CPU
for like 60 full seconds without having the LICENSED_TO_HOG_THE_CPU marker,
and because of this most apps will never need any changes at all. And if too
many changes in too many apps are needed, one option would be to invert
the meaning of the marker so that certain processes gets marked with a tag
I'd love to have such a tag on pulseaudio for example which runs into CPU
spins every now and then and never for valid reasons.

I actually think a system like this could undercover a range of interesting
bugs and performance problems.


More information about the Ubuntu-devel-discuss mailing list