README.md
1
2# AutoFDO profiles for Android common kernels
3
4## Profile Directory Tree
5
6This directory contains AutoFDO profiles for Android common kernels. These profiles can be used to
7optimize kernel builds for specific architectures and kernel versions. Following is the profile
8directory structure.
9
10```none
11kernel
12|-- README.md
13|-- BUILD.bazel
14|-- aarch64
15| |-- android16-6.12
16| | |-- kernel.afdo
17| | |-- source_info.md
18| +-- ...
19+-- ...
20```
21
22* `kernel` - The root directory for all AutoFDO profiles.
23 * `README.md` - This file.
24 * `BUILD.bazel` - Bazel build file that exports all profiles.
25 * `<arch>/` - A directory containing profiles for a specific architecture (e.g., `aarch64`).
26 * `<kernel_branch>/` - A directory containing profiles for a specific kernel branch
27 (e.g., `android16-6.12`).
28 * `kernel.afdo` - The AutoFDO profile file.
29 * `source_info.md` - A file containing information about the source code used to generate the
30 profile.
31
32## Performance improvements
33
34### android16-6.12 branch
35
36| Benchmark | Improvement |
37|---|---|
38| Boot time | 2.1% |
39| Cold App launch time | 3.1% |
40| Binder-rpc | 7.8% |
41| Binder-addints | 30.2% |
42| Hwbinder | 17.7% |
43| Bionic (syscall_mmap) | 5.0% |
44| Bionic (pthread) | 2.4% |
45| Bionic (stdio) | 3.0% |
46| Bionic (all) | 1.2% |
47
48
49## Steps to reproduce the profile
50
51A kernel profile is generated by running app crawling and app launching for top 100 apps from Google
52Play Store. While running, we collect ETM data for the kernel, which records executed instruction
53stream. Finally, we merge and convert ETM data to one AutoFDO profile.
54
55* 1. Build a kernel image and flash it on an Android device
56 * The source code and test device used to generate each profile are listed in `source_info.md`.
57 * We use a Pixel device. But using other real devices should get a similar profile.
58* 2. Run app crawling and app launching for top 100 apps
59 * Add a gmail account on the test device. Because app crawler can use the account to automatically
60 login some of the apps.
61 * We run app crawler for one app for 3 minutes, and run it twice. App crawler is available at
62 `https://developer.android.com/studio/test/other-testing-tools/app-crawler`.
63 * We run app launching for one app for 3 seconds, and run it 15 times. After each running, the
64 app is killed and cache is cleared. So we get profile for cold app startups.
65* 3. Record ETM data while running app crawling and app launching.
66 * We use cmdline `simpleperf record -e cs-etm:k -a` to record ETM data for the kernel. A document
67 for collecting and converting ETM data is in `https://android.googlesource.com/platform/system/extras/+/master/simpleperf/doc/collect_etm_data_for_autofdo.md`.
68