After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 710723 - Main loop debug patches
Main loop debug patches
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: mainloop
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 710721 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-10-23 13:19 UTC by Bastien Nocera
Modified: 2016-06-16 16:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gmain: Print debug of the source timeout calculations (1.10 KB, patch)
2013-10-23 13:19 UTC, Bastien Nocera
none Details | Review
Enable main loop debugging by default (5.54 KB, patch)
2013-10-23 13:19 UTC, Bastien Nocera
none Details | Review
Enable main loop debugging by default (5.55 KB, patch)
2013-10-23 22:29 UTC, Bastien Nocera
none Details | Review
gmain: Print debug of the source timeout calculations (1.10 KB, patch)
2013-10-24 13:10 UTC, Bastien Nocera
reviewed Details | Review

Description Bastien Nocera 2013-10-23 13:19:46 UTC
.
Comment 1 Bastien Nocera 2013-10-23 13:19:49 UTC
Created attachment 257916 [details] [review]
gmain: Print debug of the source timeout calculations

This is useful when hunting for small timeouts to reduce wake-ups.
Comment 2 Bastien Nocera 2013-10-23 13:19:55 UTC
Created attachment 257917 [details] [review]
Enable main loop debugging by default

It's hidden behind an envvar, and as such should have minimal
impact on performance. It's already enabled by default on Windows
(I guess to debug its internals, rather than for application
developers).
Comment 3 Bastien Nocera 2013-10-23 13:20:16 UTC
*** Bug 710721 has been marked as a duplicate of this bug. ***
Comment 4 Bastien Nocera 2013-10-23 22:29:29 UTC
Created attachment 257978 [details] [review]
Enable main loop debugging by default

It's hidden behind an envvar, and as such should have minimal
impact on performance. It's already enabled by default on Windows
(I guess to debug its internals, rather than for application
developers).
Comment 5 Matthias Clasen 2013-10-23 23:38:02 UTC
How about doing this with systemtap instead ?
Comment 6 Bastien Nocera 2013-10-24 13:10:13 UTC
Created attachment 258018 [details] [review]
gmain: Print debug of the source timeout calculations

This is useful when hunting for small timeouts to reduce wake-ups.
Comment 7 Colin Walters 2013-10-24 21:57:16 UTC
Review of attachment 258018 [details] [review]:

The systemtap-based approach is a lot more powerful; one can write scripts which consume/print the data in whatever format, and even better unify it with other data like malloc/free.

You can even start doing it *dynamically* while the system is running, without restarting everything to set an environment variable.  Then when you're done collecting, you just turn it off.

This patch is tiny enough on top of the other one though I'm not going to complain if you really want to land it.  But just having it in Bugzilla and having a few core developers apply it locally and run it might work just as well.
Comment 8 Allison Karlitskaya (desrt) 2013-10-25 12:45:02 UTC
Review of attachment 258018 [details] [review]:

I agree, more or less.
Comment 9 Bastien Nocera 2013-10-25 12:48:39 UTC
systemtap also isn't upstream (is it in Ubuntu's kernel?), and there's no documentation in the GLib docs on how to enable systemtap for GLib applications.

Matthias also had trouble making it use his jhbuilt GTK+ (as opposed to the system installed one), so those changes are not all in vain.
Comment 10 Colin Walters 2013-10-25 13:26:28 UTC
(In reply to comment #9)
> systemtap also isn't upstream

True...and if you look why it's not (unwinding DWARF in kernel space) I have to kind of agree with Linus =/  There are at least plans systemtap side to do more of the heavy lifting in userspace, but it's really complex to do while maintaining the full scripting power.

> and there's no
> documentation in the GLib docs on how to enable systemtap for GLib
> applications.

Matthias should be able to help since he did it more recently, but I can too.

> Matthias also had trouble making it use his jhbuilt GTK+ (as opposed to the
> system installed one), so those changes are not all in vain.

Right...no, they're not but I guess all I wanted was "I tried systemtap and it didn't work" or something =)
Comment 11 Colin Walters 2013-10-25 14:04:01 UTC
FWIW http://blog.verbum.org/2011/03/19/analyzing-memory-use-with-systemtap/ still works here on RHEL7.0 beta machine.  I just ran:

$ stap -v -c gtk-demo ./glib-memtrace2.stp
Comment 12 Philip Withnall 2016-06-16 16:14:19 UTC
Bug #759813 just added a load more SystemTap trace points to GLib, especially around the main context and GSources; I agree with Colin that stap is a more powerful approach.

See also Dunfell (https://github.com/pwithnall/dunfell) which aims to make this easy to use for profiling. A command line client is on the TODO list.
Comment 13 Philip Withnall 2016-06-16 16:17:25 UTC
And given that this has sat untouched since 2013, I think I'll take the liberty of closing it as wontfix. Please reopen if you disagree. :-)