Commit d4147e6c authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Added document for describing callgrind profiling.

Change-Id: I1b823c2ec2c99c48fb7cac8c80a73b97bf07d0b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2153048Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: default avatarDominik Röttsches <drott@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760145}
parent 2473edff
...@@ -125,6 +125,54 @@ Open devtools, and in the console, use `chrome.gpuBenchmarking.startProfiling` a ...@@ -125,6 +125,54 @@ Open devtools, and in the console, use `chrome.gpuBenchmarking.startProfiling` a
> chrome.gpuBenchmarking.startProfiling('perf.data'); chrome.gpuBenchmarking.smoothScrollBy(1000, () => { chrome.gpuBenchmarking.stopProfiling() }); > chrome.gpuBenchmarking.startProfiling('perf.data'); chrome.gpuBenchmarking.smoothScrollBy(1000, () => { chrome.gpuBenchmarking.stopProfiling() });
### Profiling content_shell with callgrind
This section contains instructions on how to do profiling using the callgrind/cachegrind tools provided by valgrind. This is not a sampling profiler, but a profiler based on running on a simulated CPU. The instructions are Linux-centered, but might work on other platforms too.
#### GN configuration
As with the other options you typically profile a release build with symbols. In order to do so, add enable_profiling to `args.gn`:
```
enable_profiling = true
```
#### Install valgrind
```
sudo apt-get install valgrind
```
#### Profile
Run `content_shell` with callgrind to create a profile. A `callgrind.<pid>` file will be dumped when exiting the browser or stopped with CTRL-C:
```
valgrind --tool=callgrind content_shell --single-process --no-sandbox <url>
```
Alternatively use cachegrind which will give you CPU cycles per code line:
```
valgrind --tool=cachegrind content_shell --single-process --no-sandbox <url>
```
Using single-process is for simple profiling of the renderer. It should be possible to run in multi-process and attach to a renderer process.
#### Install KCachegrind
Warning: this will install a bunch of KDE dependencies.
```
sudo apt-get install kcachegrind
```
#### Explore with KCachegrind
```
kcachegrind callgrind.<pid>
```
## Profiling on Android ## Profiling on Android
Android (Nougat and later) supports profiling using the [simpleperf](https://developer.android.com/ndk/guides/simpleperf) tool. Android (Nougat and later) supports profiling using the [simpleperf](https://developer.android.com/ndk/guides/simpleperf) tool.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment