Skip to content

Instantly share code, notes, and snippets.

@LethalMaus
Created March 13, 2026 20:10
Show Gist options
  • Select an option

  • Save LethalMaus/b72e71a1f2f3361737cc9c51a7f7493d to your computer and use it in GitHub Desktop.

Select an option

Save LethalMaus/b72e71a1f2f3361737cc9c51a7f7493d to your computer and use it in GitHub Desktop.
Manual baseline profile fallback snippet for Android app startup article
#!/usr/bin/env bash
set -euo pipefail
PKG="dev.jamescullimore.app"
ACTIVITY="dev.jamescullimore.app/.MainActivity"
RECEIVER="dev.jamescullimore.app/androidx.profileinstaller.ProfileInstallReceiver"
REMOTE_PROFILE="/data/misc/profman/${PKG}-primary.prof.txt"
run_scenario() {
local onboarding="$1"
adb shell am start -S -W -n "$ACTIVITY" --ez perf_onboarding_done "$onboarding" >/dev/null
sleep 5
adb shell am broadcast -a androidx.profileinstaller.action.SAVE_PROFILE "$RECEIVER" >/dev/null
}
run_scenario false
run_scenario true
adb shell pm dump-profiles --dump-classes-and-methods "$PKG" >/dev/null
adb exec-out cat "$REMOTE_PROFILE" >/tmp/app-baseline-raw.prof.txt
python3 scripts/filter_baseline_profile.py /tmp/app-baseline-raw.prof.txt app/src/main/baseline-prof.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment