Debian Codegraph @

docs/guide/debug_profile.rst

raw
1 =====================
2 Debugging & Profiling
3 =====================
4
5 Things can go wrong, these tools may help you find the cause. If you know any
6 more tricks please share them.
7
8
9 GObject Instance Count Leak Check
10 ---------------------------------
11
12 Requires a development (only available in debug mode) version of glib. Jhbuild
13 recommended.
14
15 ::
16
17 jhbuild shell
18 GOBJECT_DEBUG=instance-count GTK_DEBUG=interactive ./quodlibet.py
19
20 * In the GTK Inspector switch to the "Statistics" tab
21 * Sort by "Cumulative" and do the action which you suspect does leak or where
22 you want to make sure it doesn't repeatedly. Like for example opening
23 and closing a window or switching between media files to present.
24 * If something in the "Cumulative" column steadily increases there probably
25 is a leak.
26
27 cProfile Performance Profiling
28 ------------------------------
29
30 * https://docs.python.org/2/library/profile.html
31 * bundled with python
32
33 ::
34
35 python -m cProfile -s [sort_order] quodlibet.py > cprof.txt
36
37
38 where ``sort_order`` can one of the following:
39 calls, cumulative, file, line, module, name, nfl, pcalls, stdname, time
40
41 Example output::
42
43 885311 function calls (866204 primitive calls) in 12.110 seconds
44
45 Ordered by: cumulative time
46
47 ncalls tottime percall cumtime percall filename:lineno(function)
48 1 0.002 0.002 12.112 12.112 quodlibet.py:11(<module>)
49 1 0.007 0.007 12.026 12.026 quodlibet.py:25(main)
50 19392/13067 0.151 0.000 4.342 0.000 __init__.py:639(__get__)
51 1 0.003 0.003 4.232 4.232 quodlibetwindow.py:121(__init__)
52 1 0.000 0.000 4.029 4.029 quodlibetwindow.py:549(select_browser)
53 1 0.002 0.002 4.022 4.022 albums.py:346(__init__)
54 ...
55 ...
56
57 SnakeViz - cProfile Based Visualization
58 ---------------------------------------
59
60 * https://jiffyclub.github.io/snakeviz/
61 * ``pip install snakeviz``
62
63 ::
64
65 python -m cProfile -o prof.out quodlibet.py
66 snakeviz prof.out
67
68
69 Sysprof - System-wide Performance Profiler for Linux
70 ----------------------------------------------------
71
72 * https://www.sysprof.com/
73
74 ::
75
76 sysprof-cli -c "python quodlibet/quodlibet.py"
77 sysprof capture.syscap
78
79 GDB
80 ---
81
82 ::
83
84 gdb --args python quodlibet/quodlibet.py
85 # type "run" and hit enter
86
87
88 Debugging Wayland Issues
89 ------------------------
90
91 ::
92
93 mutter --nested --wayland
94 # start your app, it should show up in the nested mutter
95
96 ::
97
98 weston
99 # start your app, it should show up in the nested weston
100
101
102 Debugging HiDPI Issue
103 ---------------------
104
105 ::
106
107 GDK_SCALE=2 ./quodlibet/quodlibet.py
108
109 ::
110
111 MUTTER_DEBUG_NUM_DUMMY_MONITORS=2 MUTTER_DEBUG_DUMMY_MONITOR_SCALES=1,2 mutter --nested --wayland
112 # start your app, it should show up in the nested mutter