Re: High CPU usage applet

2009-05-11 Thread Jan Claeys
Op vrijdag 08-05-2009 om 00:40 uur [tijdzone -0400], schreef Timo
Sirainen:
> Somewhat relevant, yes, but I think people talking in that page don't  
> understand correctly the root cause of the problem. Linux scheduler is  
> good enough nowadays that even lots of processes all eating 100% CPU  
> don't make the system unusable. The problem comes from when some  
> process eats all the memory and starts forcing other processes to swap.

That's not the only reason why your system might get sluggish.

> I just tested this actually. I created 100 processes running an  
> infinite loop, causing the system load on a 2 core machine to hit 100.  
> It was a bit sluggish, but still perfectly usable.

Try adding one of the following in a (tight) infinite loops:
  * some disk (or similar) I/O, syncing very often (doing lots of
small database inserts & commits might be a good example)
  * an expensive syscall, preferably one that locks out the other
processes wanting to access the same kernel/system resource

Now try again...  ;)

-- 
Jan Claeys


-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: High CPU usage applet

2009-05-09 Thread Markus Hitter

Am 08.05.2009 um 14:47 schrieb Andrew Sayers:

> [...] then send a STOP signal to processes guilty beyond a
> reasonable doubt, before asking the user what to do.

Please ask the user first. There are very valid reasons why a system  
is running under full steam. For example, if one makes actually use  
of the available processing power: Doing scientific calculations,  
rendering videos, playing games, serving.


Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/





-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: High CPU usage applet

2009-05-08 Thread Martin Bammer
Hi,

do you know the hardware-monitor applet? I've extended this applet to
have exactly this feature.
It shows in the tooltip processes which consume lot's of cpu or memory
ressources. But because I'm not a gnome/gtk programmer I couldn't get
"kill" buttons into the tooltip.
If you are interested I can post the patched version of this applet. But
this applet still has one problem: It fails to run/compile on Jaunty
because of depencies to old libs. But if you use Intrepid you will have
no problems.

Cheers, Martin

Am Freitag, den 08.05.2009, 13:47 +0100 schrieb Andrew Sayers:
> I think this is a really good idea.  Making it an applet would let you 
> list "suspects" (programs that have a high CPU load, or use a lot of 
> memory, etc.), then send a STOP signal to processes guilty beyond a 
> reasonable doubt, before asking the user what to do.
> 
> I once played around with a command-line program that looked for 
> applications that were page-faulting like it was going out of style, by 
> repeatedly reading /proc/[0-9]*/stat.  If you're interested in pursuing 
> this idea yourself, I'd be happy to send along the (C++) code I wrote 
> back then.
> 
>   - Andrew
> 



-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


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

2009-05-08 Thread Martin Olsson
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 "s...@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
that means THIS_PROCESS_MAY_NOT_USE_100_CPU_FOR_LONGER_THAN_10_SECS or similar.
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.


Martin

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: High CPU usage applet

2009-05-08 Thread Andrew Sayers
I think this is a really good idea.  Making it an applet would let you 
list "suspects" (programs that have a high CPU load, or use a lot of 
memory, etc.), then send a STOP signal to processes guilty beyond a 
reasonable doubt, before asking the user what to do.

I once played around with a command-line program that looked for 
applications that were page-faulting like it was going out of style, by 
repeatedly reading /proc/[0-9]*/stat.  If you're interested in pursuing 
this idea yourself, I'd be happy to send along the (C++) code I wrote 
back then.

- Andrew

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: High CPU usage applet

2009-05-07 Thread Emmet Hikory
Mackenzie Morgan wrote:
> On Friday 08 May 2009 12:40:04 am Timo Sirainen wrote:
>> Somewhat relevant, yes, but I think people talking in that page don't  
>> understand correctly the root cause of the problem. Linux scheduler is  
>> good enough nowadays that even lots of processes all eating 100% CPU  
>> don't make the system unusable. The problem comes from when some  
>> process eats all the memory and starts forcing other processes to swap.
>>
>> I just tested this actually. I created 100 processes running an  
>> infinite loop, causing the system load on a 2 core machine to hit 100.  
>> It was a bit sluggish, but still perfectly usable.
> 
> Quick question:
> On a dual-core machine, does 100% CPU mean 100% of *both* cores or 100% of 
> one 
> and 0% of the other?  
> 
> I'm pretty sure I've seen top report 105% for a process before, so I thought 
> 100% on a dual core was really only half of the processing power.

It depends on how you measure it (and different applications report
it differently), but yes, on a multicore machine, a single-threaded
runaway process consumes only a portion of the available CPU.  It still
costs heat and power and component failure rate.  A multithreaded
application with multiple runaway threads can consume all available CPU
power, but this is usually noticable, and the user will do something.

It's the case of the runaway process that consumes a sufficiently
small proportion of resources that the user continues to operate
blissfully unaware of the situation that would be good to monitor and
report.  There exist cases where this is desired (e.g. long compilation,
data analysis, etc.), in which case the user can choose to do nothing.
In other cases, where it's not desired, the user could get a longer
battery life, or improved machine health, or just a snappier response.
In cases where this is a result of the Ubuntu code, and represents a
fixable bug, notification to the user could result in better bug
reports, and a better chance of fixing things.

-- 
Emmet HIKORY


-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: High CPU usage applet

2009-05-07 Thread Mackenzie Morgan
On Friday 08 May 2009 12:40:04 am Timo Sirainen wrote:
> Somewhat relevant, yes, but I think people talking in that page don't  
> understand correctly the root cause of the problem. Linux scheduler is  
> good enough nowadays that even lots of processes all eating 100% CPU  
> don't make the system unusable. The problem comes from when some  
> process eats all the memory and starts forcing other processes to swap.
> 
> I just tested this actually. I created 100 processes running an  
> infinite loop, causing the system load on a 2 core machine to hit 100.  
> It was a bit sluggish, but still perfectly usable.

Quick question:
On a dual-core machine, does 100% CPU mean 100% of *both* cores or 100% of one 
and 0% of the other?  

I'm pretty sure I've seen top report 105% for a process before, so I thought 
100% on a dual core was really only half of the processing power.

-- 
Mackenzie Morgan
http://ubuntulinuxtipstricks.blogspot.com
apt-get moo


signature.asc
Description: This is a digitally signed message part.
-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: High CPU usage applet

2009-05-07 Thread Timo Sirainen
On May 7, 2009, at 10:35 PM, John McCabe-Dansted wrote:

> On Fri, May 8, 2009 at 8:51 AM, 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.
>
> The following are relevant to this discussion
>  http://brainstorm.ubuntu.com/idea/11628 (similar idea)

Somewhat relevant, yes, but I think people talking in that page don't  
understand correctly the root cause of the problem. Linux scheduler is  
good enough nowadays that even lots of processes all eating 100% CPU  
don't make the system unusable. The problem comes from when some  
process eats all the memory and starts forcing other processes to swap.

I just tested this actually. I created 100 processes running an  
infinite loop, causing the system load on a 2 core machine to hit 100.  
It was a bit sluggish, but still perfectly usable.


-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss


Re: High CPU usage applet

2009-05-07 Thread John McCabe-Dansted
On Fri, May 8, 2009 at 8:51 AM, 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.


The following are relevant to this discussion
 http://brainstorm.ubuntu.com/idea/11628 (similar idea)
 http://docs.kde.org/kde3/en/kdebase/kicker/naughty-applet.html (for KDE)

-- 
John C. McCabe-Dansted
PhD Student
University of Western Australia
-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss