Re: Help CPU usage at 8.9% ?



In message <Pine LNX 4 10 10011151819450 2040-100000 localhost localdomain>you 
write:
>I have this piece of code that when run, has a 9.0% cpu usage

Ah, did you mention you were using GtkLevelHold the last time ? :))

Yes, if you have twenty of these suckers updating every 10msecs,
you'll be burning a notable fraction of your CPU. The way they use
GtkRgb (and GdkRgb below it) is not supremely efficient.

For my project ardour (http://ardour.sourceforge.net), I typically
have 26 on screen, and its been a growing concern of mine. It would be
possible to do 90% of the functionality with gdk_copy_area() and 1 or
2 pixmaps, but the level *hold* bar is a little tricker to get right.

So basically, yep, this is exactly what you'd expect.

However, I would point out that your implementation could be
improved. You only need a single gtk_timeout_add() - that function can
itself loop through all _TWTY LevelHolds and update them. This will
reduce the strain on the main loop scheduling in glib. Right now, you
have one timeout per bar, which is the wrong way around, IMHO

--p (seasoned LevelHold user and hacker)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]