This repository has been archived by the owner on Jul 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
136 lines (102 loc) · 4.4 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
Dunfell
=======
DEPRECATED: Dunfell is deprecated in favour of using sysprof with the sysprof
marks which ship with GLib 2.65.1 and later versions.
See https://gitlab.gnome.org/GNOME/sysprof
---
Dunfell provides a library for extracting events from GLib main contexts and
visualising them for the purposes of debugging and optimisation. It provides
graphical utilities for this purpose.
See the test programs in libdunfell/tests/ for simple examples of how to use
the code.
libdunfell’s API is currently unstable and is likely to change wildly.
What is the GLib main context
=============================
This is handily written up elsewhere:
https://developer.gnome.org/programming-guidelines/unstable/main-contexts.html.en
Using Dunfell
=============
Dunfell can be used as a set of utility programs or as a library.
Initial setup
-------------
Install systemtap-client and systemtap-server. If you are using a custom
version of GLib, you must add its tapset files to the stap-server include
path:
sudo mkdir -p /etc/stap-server/conf.d
echo "INCLUDE+=/opt/gnome3/build/share/systemtap/tapset" | \
sudo tee /etc/stap-server/conf.d/main.conf
You will also need to add your user to the stapusr group in order for this
configuration to be read (if you have modified the configuration):
sudo usermod -a -G stapusr $USER
Running Dunfell recorder
------------------------
Dunfell has two parts: a recorder, which is used to trace what happens in
your process; and a viewer, which is used afterwards to visualise the
trace. There is currently no way to visualise a process while it is running.
To run the recorder on my-favourite-process with some arguments:
dunfell-record -- my-favourite-process --arguments --to --it
The result will be written to /tmp/dunfell.log.
To view the result:
dunfell-viewer /tmp/dunfell.log
Dependencies
============
• glib-2.0
• gio-2.0
• gtk+-3.0
Design
======
Use cases
---------
Here are the use cases Dunfell was designed to meet, which should give some
insight into its design.
• Detect GSources which are never added to a GMainContext.
• Detect GSources which are dispatched too often (i.e. every main context
iteration).
• Detect GSources whose dispatch function takes too long (and hence blocks
the main context).
• Detect GSources which are never removed from their GMainContext after
being dispatched (but which are never dispatched again).
• Detect GMainContexts which have GSources attached or (especially) events
pending, but which aren’t being iterated.
• Monitor the load on each GMainContext, such as how many GSources it has
attached, and how many events are processed each iteration.
• Monitor ongoing asynchronous calls and GTasks, giving insight into their
nesting and dependencies.
• Monitor unfinished or stalled asynchronous calls.
• Allow users to record logs to send to the developers for debugging on a
different machine. The users may have to install additional software to
record these logs (some component of Dunfell, plus its dependencies),
but should not have to recompile or otherwise modify the program being
debugged.
• Work with programs which purely use GLib, through to programs which use
GLib, GIO and GTK+.
• Allow visualisation of this data, both in a standalone program, and in
an IDE such as GNOME Builder.
• Allow visualising differences between two traces.
• Minimise runtime overhead of logging a program, to reduce the risk of
disturbing race conditions by enabling logging.
• Connecting to an already-running program is not a requirement, since
by the time you’ve decided there’s a problem with a program, it’s
already in the wrong state.
Prior art
---------
• Record and Replay (http://rr-project.org/)
• perf tool
• perfkit (https://github.com/chergert/perfkit)
• G_DEBUG=instance-count
• GTK+ Inspector (https://wiki.gnome.org/Projects/GTK%2B/Inspector)
Deprecation guards
==================
If LIBDUNFELL_DISABLE_DEPRECATED is defined when compiling against
libdunfell, all deprecated API will be removed from included headers.
Licensing
=========
libdunfell is licensed under the LGPL; see COPYING for more details.
Bugs
====
Bug reports and (git formatted) patches should be e-mailed to one of the
addresses listed in the ‘Contact’ section below. Thank you!
Contact
=======
Philip Withnall <philip@tecnocode.co.uk>
https://gitlab.com/pwithnall/dunfell