Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » What is gtk_main_do_event doing?
What is gtk_main_do_event doing? [message #983930] Wed, 14 November 2012 09:01 Go to next message
Alexander Jiteg is currently offline Alexander JitegFriend
Messages: 14
Registered: August 2012
Junior Member
We're currently examining some of our Eclipse environments (Eclipse 3.6) with a profiler and we have seen that a lot of time is spent in org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8189). It seems that sometimes a lot of time is event spent in there without the user actually using Eclipse at all?

Any hints on how the method is used and why some much time is spent in it?

I have tried to read up on it but I don't have the whole context clear to me so the documentation for the method does not speak to me.

/Alex
Re: What is gtk_main_do_event doing? [message #984089 is a reply to message #983930] Wed, 14 November 2012 11:44 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
What do you mean with time spend? Is it really CPU time? My guess would
be that it is only idleing there waiting for user events dispatching
them when they occur?

Tom

Am 14.11.12 10:01, schrieb Alexander Jiteg:
> We're currently examining some of our Eclipse environments (Eclipse 3.6)
> with a profiler and we have seen that a lot of time is spent in
> org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8189). It
> seems that sometimes a lot of time is event spent in there without the
> user actually using Eclipse at all?
> Any hints on how the method is used and why some much time is spent in it?
> I have tried to read up on it but I don't have the whole context clear
> to me so the documentation for the method does not speak to me.
> /Alex
Re: What is gtk_main_do_event doing? [message #984095 is a reply to message #984089] Wed, 14 November 2012 11:53 Go to previous messageGo to next message
Alexander Jiteg is currently offline Alexander JitegFriend
Messages: 14
Registered: August 2012
Junior Member
We're examining the current stacktrace element for the main thread in Eclipse once every second to get the information.

Idling would be my best guess as well. We have already identified org.eclipse.swt.widgets.Display.sleep(Display.java:4021) to be used for idling. Maybe org.eclipse.swt.internal.gtk.OS.gtk_main_do_event is in the call stack to that method?
Re: What is gtk_main_do_event doing? [message #984102 is a reply to message #984095] Wed, 14 November 2012 11:57 Go to previous messageGo to next message
Alexander Jiteg is currently offline Alexander JitegFriend
Messages: 14
Registered: August 2012
Junior Member
Just checked; org.eclipse.swt.internal.gtk.OS.gtk_main_do_event is NOT in the callstack for org.eclipse.swt.widgets.Display.sleep(Display.java:4021) during idle.

[Updated on: Wed, 14 November 2012 14:20]

Report message to a moderator

Re: What is gtk_main_do_event doing? [message #985620 is a reply to message #984102] Thu, 15 November 2012 14:45 Go to previous messageGo to next message
Alexander Jiteg is currently offline Alexander JitegFriend
Messages: 14
Registered: August 2012
Junior Member
I should add that the developers are accessing the machines with remote desktop .. If that could matter for any reason.
Re: What is gtk_main_do_event doing? [message #985674 is a reply to message #985620] Thu, 15 November 2012 16:23 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
This is the native GTK event loop, so all GTK events (whether handled by
SWT or not) pass through here. If you're looking for opportunities to
monitor performance then this method can give you a window into how many
native events like paint, timers, etc., are passing through. However
this method showing up as being "busy" in your profiler does not
indicate a problem with it, it's just the nature of what it does.

Grant


On 11/15/2012 9:45 AM, Alexander Jiteg wrote:
> I should add that the developers are accessing the machines with remote
> desktop .. If that could matter for any reason.
Re: What is gtk_main_do_event doing? [message #985775 is a reply to message #985674] Fri, 16 November 2012 06:41 Go to previous messageGo to next message
Alexander Jiteg is currently offline Alexander JitegFriend
Messages: 14
Registered: August 2012
Junior Member
So if we have a lot of action in this method without even using the machine, is't due to some native event? Any suggestions on what type of event that can be in this case?

Thanks
Re: What is gtk_main_do_event doing? [message #985894 is a reply to message #985775] Fri, 16 November 2012 15:24 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Even better, you can determine this on your end by putting a breakpoint
in SWT's OS.gtk_main_do_event(...) method (where it invokes
_OS.gtk_main_do_event(...)), and in the breakpoint's properties set the
condition to:

System.out.println("type: " + OS.GDK_EVENT_TYPE(event)); return false;

This will print each event type to stdout but will not stop execution.
Debug your app, don't run it otherwise the breakpoint condition code
will not be executed. You can then look up the event types at
http://developer.gnome.org/gdk/2.22/gdk-Events.html#GdkEventType . Try
this with
git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet1.java
and you'll see that the event queue goes quiet if you aren't mousing
within the Shell, etc.

I'm going to make a guess that your case that shows a lot of events
involves viewing a Mozilla-based Browser control, because the native
renderer is known to fire a lot of timer events, possibly among others.

Grant


On 11/16/2012 1:41 AM, Alexander Jiteg wrote:
> So if we have a lot of action in this method without even using the
> machine, is't due to some native event? Any suggestions on what type of
> event that can be in this case?
>
> Thanks
Re: What is gtk_main_do_event doing? [message #985897 is a reply to message #985894] Fri, 16 November 2012 15:27 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
One other detail is that if it is the Mozilla case then you may not see
its event code at the GTK link I provided because I think Mozilla
defines some custom event types for its own internal use.

Grant


On 11/16/2012 10:24 AM, Grant Gayed wrote:
> Even better, you can determine this on your end by putting a breakpoint
> in SWT's OS.gtk_main_do_event(...) method (where it invokes
> _OS.gtk_main_do_event(...)), and in the breakpoint's properties set the
> condition to:
>
> System.out.println("type: " + OS.GDK_EVENT_TYPE(event)); return false;
>
> This will print each event type to stdout but will not stop execution.
> Debug your app, don't run it otherwise the breakpoint condition code
> will not be executed. You can then look up the event types at
> http://developer.gnome.org/gdk/2.22/gdk-Events.html#GdkEventType . Try
> this with
> git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet1.java
> and you'll see that the event queue goes quiet if you aren't mousing
> within the Shell, etc.
>
> I'm going to make a guess that your case that shows a lot of events
> involves viewing a Mozilla-based Browser control, because the native
> renderer is known to fire a lot of timer events, possibly among others.
>
> Grant
>
>
> On 11/16/2012 1:41 AM, Alexander Jiteg wrote:
>> So if we have a lot of action in this method without even using the
>> machine, is't due to some native event? Any suggestions on what type of
>> event that can be in this case?
>>
>> Thanks
>
Re: What is gtk_main_do_event doing? [message #986339 is a reply to message #985897] Tue, 20 November 2012 07:06 Go to previous messageGo to next message
Alexander Jiteg is currently offline Alexander JitegFriend
Messages: 14
Registered: August 2012
Junior Member
I will look into thinks. Thanks for your time ..


Re: What is gtk_main_do_event doing? [message #987549 is a reply to message #983930] Tue, 27 November 2012 06:36 Go to previous message
Alexander Jiteg is currently offline Alexander JitegFriend
Messages: 14
Registered: August 2012
Junior Member
Hi again,

I haven't really made any big progress on this but I don't want to leave this thread hanging if someone else bump into it.

I have tried the debug-procedure suggested above and it indeed helps me to understand what applications are firing events. Thanks for that.

I have however not been able to recreate a scenario where an application is constantly firing events or to get a freeze in OS.gtk_main_do_event(...).

At the moment I suspect that the behavior occurs when the user is killing his remote desktop session (not finishing it gracefully by shutting down running programs) or when the remote desktop session is idling. Maybe some kind of screen saver could cause this?

Previous Topic:How to make my SWT application responsive during loading a lot of data
Next Topic:Make table editor behave more like Excel?
Goto Forum:
  


Current Time: Thu Mar 28 23:11:28 GMT 2024

Powered by FUDForum. Page generated in 0.03330 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top