| OLD | NEW |
| 1 # Profiling Content Shell on Android | 1 # Profiling Content Shell on Android |
| 2 | 2 |
| 3 Below are the instructions for setting up profiling for Content Shell on | 3 Below are the instructions for setting up profiling for Content Shell on |
| 4 Android. This will let you generate profiles for ContentShell. This will require | 4 Android. This will let you generate profiles for ContentShell. This will require |
| 5 linux, building an userdebug Android build, and wiping the device. | 5 linux, building an userdebug Android build, and wiping the device. |
| 6 | 6 |
| 7 [TOC] | 7 [TOC] |
| 8 | 8 |
| 9 ## Prepare your device. | 9 ## Prepare your device. |
| 10 | 10 |
| 11 You need an Android 4.2+ device (Galaxy Nexus, Nexus 4, 7, 10, etc.) which you | 11 You need an Android 4.2+ device (Galaxy Nexus, Nexus 4, 7, 10, etc.) which you |
| 12 don’t mind erasing all data, rooting, and installing a userdebug build on. | 12 don’t mind erasing all data, rooting, and installing a userdebug build on. |
| 13 | 13 |
| 14 ## Get and build `content_shell_apk` for Android | 14 ## Get and build `content_shell_apk` for Android |
| 15 | 15 |
| 16 (These instructions have been carefully distilled from the | 16 (These instructions have been carefully distilled from the |
| 17 [Android Build Instructions](android_build_instructions.md).) | 17 [Android Build Instructions](android_build_instructions.md).) |
| 18 | 18 |
| 19 1. Get the code! You’ll want a second checkout as this will be | 19 1. Get the code! You’ll want a second checkout as this will be |
| 20 android-specific. You know the drill: | 20 Android-specific. You know the drill: |
| 21 https://www.chromium.org/developers/how-tos/get-the-code | 21 https://www.chromium.org/developers/how-tos/get-the-code |
| 22 1. Append this to your `.gclient` file: `target_os = ['android']` | 22 1. Append this to your `.gclient` file: `target_os = ['android']` |
| 23 1. Create `chromium.gyp_env` next to your `.gclient` file: | 23 1. Create `chromium.gyp_env` next to your `.gclient` file: |
| 24 `echo "{ 'GYP_DEFINES': 'OS=android', }" > chromium.gyp_env` | 24 `echo "{ 'GYP_DEFINES': 'OS=android', }" > chromium.gyp_env` |
| 25 1. (Note: All these scripts assume you’re using "bash" (default) as your | 25 1. (Note: All these scripts assume you’re using "bash" (default) as your |
| 26 shell.) | 26 shell.) |
| 27 1. Sync and runhooks (be careful not to run hooks on the first sync): | 27 1. Sync and runhooks (be careful not to run hooks on the first sync): |
| 28 | 28 |
| 29 ``` | 29 ``` |
| 30 gclient sync --nohooks | 30 gclient sync --nohooks |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 automatically push binaries and pull the profile data for you. | 105 automatically push binaries and pull the profile data for you. |
| 106 | 106 |
| 107 build/android/adb_profile_chrome --browser=content_shell --perf | 107 build/android/adb_profile_chrome --browser=content_shell --perf |
| 108 | 108 |
| 109 While you still have to build, install and launch the APK yourself, Catapult | 109 While you still have to build, install and launch the APK yourself, Catapult |
| 110 will take care of creating the symfs etc. (i.e. you can skip the "not needed for | 110 will take care of creating the symfs etc. (i.e. you can skip the "not needed for |
| 111 Telemetry" steps below). | 111 Telemetry" steps below). |
| 112 | 112 |
| 113 ## Install `/system/bin/perf` on your device (not needed for Telemetry) | 113 ## Install `/system/bin/perf` on your device (not needed for Telemetry) |
| 114 | 114 |
| 115 # From inside the android source tree (not inside Chromium) | 115 # From inside the Android source tree (not inside Chromium) |
| 116 mmm external/linux-tools-perf/ | 116 mmm external/linux-tools-perf/ |
| 117 adb remount # (allows you to write to the system image) | 117 adb remount # (allows you to write to the system image) |
| 118 adb sync | 118 adb sync |
| 119 adb shell perf top # check that perf can get samples (don’t expect symbols) | 119 adb shell perf top # check that perf can get samples (don’t expect symbols) |
| 120 | 120 |
| 121 ## Install ContentShell | 121 ## Install ContentShell |
| 122 | 122 |
| 123 Install with the following: | 123 Install with the following: |
| 124 | 124 |
| 125 build/android/adb_install_apk.py \ | 125 build/android/adb_install_apk.py \ |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 ``` | 206 ``` |
| 207 adb pull /proc/kallsyms symbols/kallsyms | 207 adb pull /proc/kallsyms symbols/kallsyms |
| 208 ``` | 208 ``` |
| 209 | 209 |
| 210 1. Now add --kallsyms to your perfhost\_linux command: | 210 1. Now add --kallsyms to your perfhost\_linux command: |
| 211 ``` | 211 ``` |
| 212 ./perfhost_linux report -g -i perf.data --symfs symbols/ \ | 212 ./perfhost_linux report -g -i perf.data --symfs symbols/ \ |
| 213 --kallsyms=symbols/kallsyms | 213 --kallsyms=symbols/kallsyms |
| 214 ``` | 214 ``` |
| OLD | NEW |