Being able to perform local builds with PGO is important when profiling, but unfortunately `ac_add_options MOZ_PGO=1` is not supported on Android.
The workaround I have been using is to submit a `generate-profile-android-aarch64-shippable/opt` job to try, download and extract the `profdata.tar.xz` artefact, then perform a build with the following in my mozconfig:
```
ac_add_options --enable-lto=cross
ac_add_options --enable-profile-use=cross
ac_add_options --with-pgo-jarlog="${HOME}/Downloads/profdata/en-US.log"
ac_add_options --with-pgo-profile-path="${HOME}/Downloads/profdata/merged.profdata"
```
When using MOZ_PGO=1 locally on desktop, the instrumented build and profile generation are performed [here](https://searchfox.org/mozilla-central/rev/dbd654fa899a56a6a2e92f325c4608020e80afae/python/mozbuild/mozbuild/build_commands.py#171-218). This reuses the same [profileserver.py](https://searchfox.org/mozilla-central/rev/dbd654fa899a56a6a2e92f325c4608020e80afae/build/pgo/profileserver.py) as is used on CI to do the profile generation run. For Android profile generation on CI, however, we use a different script: [android_emulator_pgo.py](https://searchfox.org/mozilla-central/rev/dbd654fa899a56a6a2e92f325c4608020e80afae/testing/mozharness/scripts/android_emulator_pgo.py)
I have in the past successfully modified the android_emulator_pgo.py script to allow it to be ran locally: https://github.com/jamienicol/gecko/commit/d7a40d9494360adff03361127a39dc67046d499a. I'm unsure whether that is the right approach to fix this, though.
Bug 1895854 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Being able to perform local builds with PGO is important when profiling, but unfortunately `ac_add_options MOZ_PGO=1` is not supported on Android.
The workaround I have been using is to submit a `generate-profile-android-aarch64-shippable/opt` job to try, download and extract the `profdata.tar.xz` artefact, then perform a build with the following in my mozconfig:
```
ac_add_options --enable-lto=cross
ac_add_options --enable-profile-use=cross
ac_add_options --with-pgo-jarlog="${HOME}/Downloads/profdata/en-US.log"
ac_add_options --with-pgo-profile-path="${HOME}/Downloads/profdata/merged.profdata"
```
When using MOZ_PGO=1 locally on desktop, the instrumented build and profile generation are performed [here](https://searchfox.org/mozilla-central/rev/dbd654fa899a56a6a2e92f325c4608020e80afae/python/mozbuild/mozbuild/build_commands.py#171-218). This reuses the same [profileserver.py](https://searchfox.org/mozilla-central/rev/dbd654fa899a56a6a2e92f325c4608020e80afae/build/pgo/profileserver.py) as is used on CI to do the profile generation run. For Android profile generation on CI, however, we use a different script: [android_emulator_pgo.py](https://searchfox.org/mozilla-central/rev/dbd654fa899a56a6a2e92f325c4608020e80afae/testing/mozharness/scripts/android_emulator_pgo.py)
This was definitely written with running on taskcluster in mind. I have, however, in the past successfully modified it so it can be ran locally: https://github.com/jamienicol/gecko/commit/d7a40d9494360adff03361127a39dc67046d499a. I'm unsure whether that is the right approach to fix this, though.