| 162 | |
| 163 | |
| 164 | = Profiling Performance Tests = |
| 165 | |
| 166 | {{{run-perf-tests --profile}}} can be used to attach and run the default platform CPU profiler against the provided test(s). |
| 167 | |
| 168 | Additionally, the {{{--profiler=PROFILER}}} option can select which profiler to use from the built-in profilers: |
| 169 | |
| 170 | || perf || linux (default) || |
| 171 | || iprofiler || mac (default) || |
| 172 | || sample || mac || |
| 173 | || pprof || mac, linux (chromium-only, requires using tcmalloc) || |
| 174 | |
| 175 | For perf and pprof profilers {{{--profile}}} provides per-test "10 hottest functions" output, which is useful for obtaining a high level overview of where the test is spending it's time. This has been surprisingly helpful for finding hot non-inlined functions, or other low-hanging fruit. |
| 176 | |
| 177 | {{{ |
| 178 | % run-perf-tests --profile |
| 179 | Running 113 tests |
| 180 | Running Animation/balls.html (1 of 113) |
| 181 | Finished: 3.079851 s |
| 182 | |
| 183 | [ perf record: Woken up 3 times to write data ] |
| 184 | [ perf record: Captured and wrote 0.678 MB /src/WebKit/Source/WebKit/chromium/webkit/Release/layout-test-results/test-44.data (~29642 samples) ] |
| 185 | 5.99% DumpRenderTree perf-5981.map [.] 0x250f5ef06321 |
| 186 | 2.46% DumpRenderTree DumpRenderTree [.] v8::internal::FastDtoa(double, v8::internal::FastDtoaMode, int, v8::internal::Vector<char>, int*, int*) |
| 187 | 1.86% DumpRenderTree DumpRenderTree [.] WebCore::Length::initFromLength(WebCore::Length const&) |
| 188 | 1.74% DumpRenderTree DumpRenderTree [.] WebCore::RenderStyle::diff(WebCore::RenderStyle const*, unsigned int&) const |
| 189 | 1.69% DumpRenderTree libfreetype.so.6.8.0 [.] 0x493ab |
| 190 | 1.35% DumpRenderTree DumpRenderTree [.] tc_free |
| 191 | 1.30% DumpRenderTree [kernel.kallsyms] [k] 0xffffffff8103b51a |
| 192 | 1.27% DumpRenderTree DumpRenderTree [.] tc_malloc |
| 193 | 1.25% DumpRenderTree DumpRenderTree [.] v8::internal::JSObject::SetPropertyWithInterceptor(v8::internal::String*, v8::internal::Object*, PropertyAttributes, v8::internal::StrictModeFlag) |
| 194 | 1.22% DumpRenderTree DumpRenderTree [.] WTF::double_conversion::Strtod(WTF::double_conversion::Vector<char const>, int) |
| 195 | |
| 196 | To view the full profile, run: |
| 197 | perf report -i /src/WebKit/Source/WebKit/chromium/webkit/Release/layout-test-results/test-44.data |
| 198 | }}} |
| 199 | (Note: perf prints out a bunch of kernel-related warnings which I've stripped from the above output sample.) |
| 200 | |
| 201 | For more in-depth analysis, all profilers print instructions after profiling as to how to explore the full sample data, as shown above. |