android: Speed up native stack symbol resolution.
When calling the build/android/tombstones.py script, used to extract tombstones and properly resolve symbols for Chromium libraries, 'aapt dump badging' is called repeatedly on all files matching $CHROMIUM_OUTPUT_DIR/apks/*.apk, in order to extract their package names. This patch helps speed up this process considerably by caching the result for each APK (hence each file will be read only once now). Time comparison for the following command (for an Android/x86 build). third_party/android_platform/development/scripts/stack.py \ --arch x86 \ --output-directory out/Emulator \ --more-info \ /tmp/tombstone_08 Before: 1m 48s --> After: 23s (same results) + Rename symbols.GetAapt() to _GetAapt() to make it private, and use constants.ANDROID_SDK_TOOLS to find the location of the 'aapt' binary used to extract package names. Note that the use of the SDK_HOME environment is preserved unchanged at the moment (though is probably not needed). + Rename GetApkPackageName() to _GetApkPackageName() and remove its 'aapt' parameter and speed it with a small cache. + Rename GetCandidateApks() to _GetCandidateApks() and use a small cache to avoid hitting the filesystem everytime this is called, since the result will not change between invokations. + Simplify GetMatchingApks() implementation. + Fix minor typos. NOTE: There are still many many things that are really wrong in this script. In particular, it cannot work properly with component builds, and will fail to work in the future when Chromium will be installed as a set of APK splits. Another point is the reliance on the global ARCH variable which is liberally modified directly by other Python scripts all over the place (ugh...). These will be addressed in future CLs. BUG=774267 R=agrieve@chromium.org,hzl@chromium.org, jbudorick@chromium.org, mattcary@chromium.org Change-Id: If130a668dd592b682d7fa98012745704a74fb850 Reviewed-on: https://chromium-review.googlesource.com/995932 Commit-Queue: David Turner <digit@chromium.org> Reviewed-by:agrieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/master@{#548266}
Showing
Please register or sign in to comment