Closed Bug 1563053 Opened 1 year ago Closed 1 year ago

Investigate setting LLVM_PROFILE_FILE to include pid for Android


(Firefox Build System :: General, task)

Not set


(firefox70 fixed)

Tracking Status
firefox70 --- fixed


(Reporter: mshal, Assigned: mshal)




(3 files)

As of bug 1196094, desktop PGO writes out separate profraw files for each PID. Android however still writes out to a single "default.profraw" file. We should investigate whether it helps to use the same mechanism in Android and merge them all.

This is slightly complicated by the fact that we have to pull the profraw files from the emulator, and we don't necessarily know when they finish getting written out. We currently poll based on default.profraw's existence, but perhaps that should be updated to just check if the process is still running.

I took a look at this - even with '%p' in LLVM_PROFILE_FILE, we still only generate a single profraw file for Android. However, adding support for it doesn't look too difficult so I'll submit the patches anyway.

The code that polls for 'default.profraw' needed to be changed since the mozharness script won't know the full filename ahead of time. It seems like it should be more stable in any case to check for the Android process completing rather than looking at files that may not be fully written out (perhaps this is an alternate solution to bug 1560755, but we can keep that as a failsafe).

Assignee: nobody → mshal

After execute_script() returns, the Android process may not be fully
shutdown, so the profile data may not exist yet. The initial
implementation waited for this by checking if the profraw file existed
and was non-zero length, but this may be contributing to issues with
getting partial profraw files.

Instead we can wait for the whole process to exit by using
process_exist(), so the profraw file should be completely written out
by then. In the event that the profraw file is truncated for some
reason, the merge step will fail and the process will be retried (per
bug 1560755).

If we end up generating multiple profraw files in the future, it will
help to have them all in a separate directory so that we can just 'adb
pull' the whole directory at once.

Depends on D36839

This adds support for the Android process writing out multiple profraw
files and pulling them all from the device. We currently only generate a
single profraw file, but if that changes in the future we should be able
to get a PGO build using the full set of files now.

Depends on D36840

Pushed by
Poll Android PGO based on process existence, not file existence; r=snorp
Put all Android PGO outputs in a separate directory; r=firefox-build-system-reviewers,chmanchester
Wildcard profraw files for Android PGO; r=firefox-build-system-reviewers,chmanchester
You need to log in before you can comment on or make changes to this bug.