Re: Slow gui response - need to see gtk queue



After changing my custom widgets with label widgets, I found that the application runs fine.  So the gtk 
queue is being bogged down by my widgets.  So now the hard part is determining where the problem is in my 
custom widgets.
   
  I have 5 custom widgets.  I have put them up for sharing at http://flashpages.prodigy.net/richarmt/
  I also put up images of them in use.  I believe the customled widget is fine.  But I think the 
customnumeric and customlabel widgets are what is causing the slow down. I know the customlevel widget has a 
problem (gets an error about g_object_unref() floating object finalized - use g_object_ref_sink()).  The goal 
behind these widgets was to setup the widget with indicators, min, max, formatting, etc.  Then, to call one 
function (say custom_label_set_text()) to set the text in that widget (or custom_numeric_set_value()) or set 
the value, which is then translated to text.  The widgets are NOT supposed to redraw if the value being set 
is the same as what it currently has. There is also a property for every widget called type - and this is to 
set the color of the widget (sometimes the background) - to one of 4 values - off, green(normal), 
yellow(caution), red(alert). This is indendent of the text or the value for the widget.  I've recoded these 
widgets a number of times (from
 gtk2.4.1, gtk 2.8.17, gtk 2.10.0).  I used the gtk widget that is closest to the custom widget as a 
template.  Gtk label for custom label, custom numeric, and custom led. Gtk range for level, gtk range for 
dial.  I would have liked to have them running well before releasing to the public - but alas, I need the 
help.
   
  I know digging in someone else's code is a pain, but I would greatly appreciate any insight anyone can give 
me - I've learned lots, but I still have lots more to learn.  My intention is to share them with all 
(hopefully the data acquisition widgets that I saw someone else posting).
   
  Thanks again for any help - especially Tristan Van Berkom - you've been very helpful.
  Mark

Tristan Van Berkom <tvb gnome org> wrote:
  On Tue, 2007-01-30 at 12:40 -0800, Mark Richardson wrote:
I can't figure out why my gui becomes sluggish. I have a main window with a bunch of vboxes and hboxes - in 
one area, I don't put in a widget - because I load glade.xml files (so you can swap your views). I should 
say that I have some custom widgets, and I've been pulling them out so I can see if the fault lies in my 
code or not. But, when the application is first run, everything is fast. If I leave it up for a few hours 
(or overnight) - it becomes very slow. Even the mouse over of a button highlight takes 5 or 6 seconds.

I'm assuming that the fault lies in my custom widgets, and that they are calling redraw too much, so it 
creates a "back-log" of redraws in the gtk even queue. But I don't know how to look at the event queue to 
determine the true cause. I've run the debugger and stopped it a bunch of times, but that's hit or miss. Is 
there anyway to examine the queue in a debugger?

This application is designed for showing information - not really processing user/gui events. As data comes 
in, it updates different displays. I've played around with the frequency of updating the gui and that 
doesn't seem to help (even 1 second per gui update becomes slow).

The custom widgets I wrote can run overnight without delay when I code them into an application - so I'm 
starting to think that maybe the xml parser or how gtk handles the xml widgets might be the culprit.

Thanks in advance for any help that you can provide - I can't seem to get this one, and I don't know what 
else to try.
Mark

I dont think your problem has to do with the frequency at which you
update the GUI, typically when data arrives, you update your private
data representation of what should be displayed and then flag your UI as
"dirty" - whenever you happen to get a chance later on... you go and
actually update the GUI (i.e. no matter how many times you go and
call gdk_window_invalidate_region(), that region will only be "dirty"
once untill the server sends an expose event and your widget updates
widget->window).

Rather, 
a.) Does your program or other programs on your desktop consume alot
of memory (is your program getting swapped out after time ?), does
it become responsive again after poking it ?

b.) Is it possible that you are leaking event sources ?
(GSourceFuncs fed to g_idle_add/g_timeout_add that neglect to
return FALSE ever, or are accumulated over time without
properly bookkeeping the event source id and calling
g_source_remove())

Cheers,
-Tristan




 
---------------------------------
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.


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