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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
Before 1.0:
- grep FIXME
- Need to make "make install" work (how do you know where to install
kernel modules?)
- Find out what distributions it actually works on
(ask for sucess stories in 0.9.x releases)
- hook up about box
- Need an icon
- Add busy cursors,
- when you hit "Profile"
- when you click something in the main list and we don't respond
within 50ms (or perhaps when we expect to not be able to do
so (can we know the size in advance?))
- Sould just install the kernel module if it running as root, pop up
a dialog if not. Note we must be able to start without module now, since
it is useful to just load profiles from disk.
- hook up menu items view/start etc (or possibly get rid of them or move
them)
- give profiles on the command line
- autoconfuscate?
- .desktop file
- Consider expanding a few more levels of a new descendants tree
Before 1.2:
- Reorganise stackstash and profile
- stackstash should just take traces of addresses without knowing
anything about what those addresses mean
- stacktraces should then begin with a process
- profile should take traces of pointers to presentation
objects without knowing anything about these presentation
objects.
- Creating a profile is then
- For each stack node, compute a presentation object
(probably need to export opaque stacknode objects
with set/get_user_data)
- Send each stack trace to the profile module, along with
presentation objects
- Charge 'self' properly to processes that don't get any stack trace at all
(probably we get that for free with stackstash reorganisation)
- Add ability to show more than one function at a time. Algorithm:
Find all relevant nodes;
For each relevant node
best_so_far = relevant node
walk towards root
if node is relevant,
best_so_far = relevant
add best_so_far to interesting
for each interesting
list leaves
for each leaf
add trace to tree (leaf, interesting)
- Consider adding KDE-style nested callgraph view
- Add support for line numbers within functions
- consider caching [filename => bin_file]
- Have kernel module report the file the address was found in
Should avoid a lot of potential broken/raciness with dlopen etc.
- Make things faster
- Can I get it to profile itself?
- speedprof seems to report that lots of time is spent in
stack_stash_foreach() and also in generate_key()
- add an 'everything' object. It is really needed for a lot of things
- make profile.c more agnostic to processes and functions etc. Ideally
it should just take a set of stack traces containing "presentation
objects" and do something sensible with it.
- Non-GUI version that can save in a format the GUI can understand.
Could be used for profiling startup etc. Would preferably be able to
dump the data to a network socket. Should be able to react to eg.
SIGUSR1 by dumping the data.
- hide internal stuff in ProfileDescendant
- kernel module should put process to sleep before sampling. Should get us
more accurate data
Later:
- Figure out how Google's pprof script works. Then add real call graph
drawing.
- Find out how to hack around gtk+ bug causing multiple double clicks
to get eaten.
- Figure out what a 'disk profiler' is.
- Consider what it would take to take stacktraces of other languages
- perl,
- python
- java
- bash
Possible solution is for the script binaries to have a function
called something like
__sysprof__generate_stacktrace (char **functions, int n_functions);
that the sysprof kernel module could call (and make return to the kernel).
This function would behave essentially like a signal handler: couldn't
call malloc(), couldn't call printf(), etc.
- figure out a way to deal with both disk and CPU. Need to make sure that
things that are UNINTERRUPTIBLE while there are RUNNING tasks is not
consider bad.
Not entirely clear that the sysprof visualization is right for disk.
Maybe assign a size of n to traces with n *unique* disk access (ie.
disk accesses that are not made by any other stack trace).
Or assign values to nodes in the calltree based on how many diskaccesses
are contained in that tree. Ie., if I get rid of this branch, how many
disk accesses would that get rid of.
Or turn it around and look at individual disk accesses and see what it
would take to get rid of it. Ie., a number of traces are associated with
any given diskaccess. Just show those.
Or for a given tree with contained disk accesses, figure out what *other*
traces has the same diskaccesses.
Or visualize a set of squares with a color that is more saturated depending
on the number of unique stack traces that access it. The look for the
lightly saturated ones.
The input to the profiler would basically be
(stack trace, badness, cookie)
For CPU: badness=10ms, cookie=<a new one always>
For Disk: badness=<calculated based on previous disk accesses>, cookie=<the accessed disk block>
For Memory: badness=<cache line size not in cache>, cookie=<the address>
Cookies are use to figure out whether an access is really the same, ie., for two identical
cookies, the size is still just one, however
Memory is different from disk because you can't reasonably assume that stuff that has
been read will stay in cache (for short profile runs you can assume that with disk,
but not for long ones).
DONE:
- Make sure samples label shows correct nunber after Open
- Move "samples" label to the toolbar, then get rid of statusbar.
- crashes when you ctrl-click the selected item in the top left pane
<ian__> ssp: looks like it doesn't handle the none-selected case
- loading and saving
- consider making ProfileObject more of an object.
- make an "everything" object
maybe not necessary -- there is a libc_ctors_something()
- make presentation strings nicer
four different kinds of symbols:
a) I know exactly what this is
b) I know in what library this is
c) I know only the process that did this
d) I know the name, but there is another similarly named one
(a) is easy, (b) should be <in ...> (c) should just become "???"
(d) not sure
- processes with a cmdline of "" should get a [pid = %d] instead.
- make an "n samples" label
Process stuff:
- make threads be reported together
(simply report pids with similar command lines together)
(note: it seems separating by pid is way too slow (uses too much memory),
so it has to be like this)
- stack stash should allow different pids to refer to the same root
(ie. there is no need to create a new tree for each pid)
The *leaves* should contain the pid, not the root. You could even imagine
a set of processes, each referring to a set of leaves.
- when we see a new pid, immediately capture its mappings
Road map:
- new object Process
- hashable by pointer
- contains list of maps
- process_from_pid (pid_t pid, gboolean join_threads)
- new processes are gets their maps immediately
- resulting pointer must be unref()ed, but it is possible it
just points to an existing process
- processes with identical cmdlines are taken together
- method lookup_symbol()
- method get_name()
- ref/unref
- StackStash stores map from process to leaves
- Profile is called with processes
It is possible that we simply need a better concept of Process:
If two pids have the same command line, consider them the same, period.
This should save considerable amounts of memory.
The assumptions:
"No pids are reused during a profiling run"
"Two processes with the same command line have the same mappings"
are somewhat dubious, but probably necessary.
(More complex kernel:
have the module report
- new pid arrived (along with mappings)
- mapping changed for pid
- stacktrace)
- make symbols in executable work
- the hashtables used in profile.c should not accept NULL as the key
- make callers work
- autoexpand descendant tree
- make double clicks work
- fix leaks
|