Debugging & Profiling

Things can go wrong, these tools may help you find the cause. If you know any more tricks please share them.

GObject Instance Count Leak Check

Requires a development (only available in debug mode) version of glib. Jhbuild recommended.

jhbuild shell
GOBJECT_DEBUG=instance-count GTK_DEBUG=interactive ./
  • In the GTK Inspector switch to the “Statistics” tab

  • Sort by “Cumulative” and do the action which you suspect does leak or where you want to make sure it doesn’t repeatedly. Like for example opening and closing a window or switching between media files to present.

  • If something in the “Cumulative” column steadily increases there probably is a leak.

cProfile Performance Profiling

python -m cProfile -s [sort_order] > cprof.txt

where sort_order can one of the following: calls, cumulative, file, line, module, name, nfl, pcalls, stdname, time

Example output:

         885311 function calls (866204 primitive calls) in 12.110 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.002    0.002   12.112   12.112<module>)
        1    0.007    0.007   12.026   12.026
19392/13067    0.151    0.000    4.342    0.000
        1    0.003    0.003    4.232    4.232
        1    0.000    0.000    4.029    4.029
        1    0.002    0.002    4.022    4.022

SnakeViz - cProfile Based Visualization

python -m cProfile -o prof.out
snakeviz prof.out

Sysprof - System-wide Performance Profiler for Linux

sysprof-cli -c "python quodlibet/"
sysprof capture.syscap


gdb --args python quodlibet/
# type "run" and hit enter

Debugging Wayland Issues

mutter --nested --wayland
# start your app, it should show up in the nested mutter
# start your app, it should show up in the nested weston

Debugging HiDPI Issue

GDK_SCALE=2 ./quodlibet/
# start your app, it should show up in the nested mutter