OLD | NEW |
1 # Linux Profiling | 1 # Linux Profiling |
2 | 2 |
3 How to profile Chromium on Linux. | 3 How to profile Chromium on Linux. |
4 | 4 |
5 See | 5 See |
6 [Profiling Chromium and WebKit](https://sites.google.com/a/chromium.org/dev/deve
lopers/profiling-chromium-and-webkit) | 6 [Profiling Chromium and WebKit](https://sites.google.com/a/chromium.org/dev/deve
lopers/profiling-chromium-and-webkit) |
7 for alternative discussion. | 7 for alternative discussion. |
8 | 8 |
9 ## CPU Profiling | 9 ## CPU Profiling |
10 | 10 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 * "Hooked allocator frame not found": build with `-Dcomponent=static_library`. | 155 * "Hooked allocator frame not found": build with `-Dcomponent=static_library`. |
156 `tcmalloc` gets confused when the allocator routines are in a different | 156 `tcmalloc` gets confused when the allocator routines are in a different |
157 `.so` than the rest of the code. | 157 `.so` than the rest of the code. |
158 | 158 |
159 #### More reading | 159 #### More reading |
160 | 160 |
161 For further information, please refer to | 161 For further information, please refer to |
162 http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html. | 162 http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html. |
163 | 163 |
164 ### Massif | |
165 | |
166 [Massif](http://valgrind.org/docs/manual/mc-manual.html) is a | |
167 [Valgrind](https://www.chromium.org/developers/how-tos/using-valgrind)-based hea
p | |
168 profiler. It is much slower than the heap profiler from google-perftools, but it | |
169 may have some advantages. (In particular, it handles the multi-process | |
170 executables well). | |
171 | |
172 First, you will need to build massif from valgrind-variant project yourself, | |
173 it's [easy](http://code.google.com/p/valgrind-variant/wiki/HowTo). | |
174 | |
175 Then, make sure your Chromium is built using the | |
176 [valgrind instructions](https://www.chromium.org/developers/how-tos/using-valgri
nd). | |
177 Now, you can run massif like this: | |
178 | |
179 ``` | |
180 path-to-valgrind-variant/valgrind/inst/bin/valgrind \ | |
181 --fullpath-after=/chromium/src/ \ | |
182 --trace-children-skip=*npviewer*,/bin/uname,/bin/sh,/usr/bin/which,/bin/ps,/b
in/grep,/usr/bin/linux32 \ | |
183 --trace-children=yes \ | |
184 --tool=massif \ | |
185 out/Release/chrome --noerrdialogs --disable-hang-monitor --other-chrome-flags | |
186 ``` | |
187 | |
188 The result will be stored in massif.out.PID files, which you can post-process | |
189 with [ms_print](http://valgrind.org/docs/manual/mc-manual.html). | |
190 | |
191 TODO(kcc) sometimes when closing a tab the main process kills the tab process | |
192 before massif completes writing it's log file. Need a flag that tells the main | |
193 process to wait longer. | |
194 | |
195 ## Paint profiling | 164 ## Paint profiling |
196 | 165 |
197 You can use Xephyr to profile how chrome repaints the screen. Xephyr is a | 166 You can use Xephyr to profile how chrome repaints the screen. Xephyr is a |
198 virtual X server like Xnest with debugging options which draws red rectangles to | 167 virtual X server like Xnest with debugging options which draws red rectangles to |
199 where applications are drawing before drawing the actual information. | 168 where applications are drawing before drawing the actual information. |
200 | 169 |
201 export XEPHYR_PAUSE=10000 | 170 export XEPHYR_PAUSE=10000 |
202 Xephyr :1 -ac -screen 800x600 & | 171 Xephyr :1 -ac -screen 800x600 & |
203 DISPLAY=:1 out/Debug/chrome | 172 DISPLAY=:1 out/Debug/chrome |
204 | 173 |
205 When ready to start debugging issue the following command, which will tell | 174 When ready to start debugging issue the following command, which will tell |
206 Xephyr to start drawing red rectangles: | 175 Xephyr to start drawing red rectangles: |
207 | 176 |
208 kill -USR1 `pidof Xephyr` | 177 kill -USR1 `pidof Xephyr` |
209 | 178 |
210 For further information, please refer to | 179 For further information, please refer to |
211 http://cgit.freedesktop.org/xorg/xserver/tree/hw/kdrive/ephyr/README. | 180 http://cgit.freedesktop.org/xorg/xserver/tree/hw/kdrive/ephyr/README. |
OLD | NEW |