Skip to content
Scripting to make simpleperf profiling of geckoview_example easier
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
copy_libs.sh
perf_record.sh
report_sample_gecko.py

README.md

Simpleperf for geckoview_example

Scripting to make simpleperf profiling of geckoview_example easier

You will need to build your own geckoview_example from source. i.e.

./mach build
./mach package
./mach android archive-geckoview
./mach android build-geckoview_example
./mach android install-geckoview_example

This is because simpleperf requires the unstripped shared objects which are not kept as build artifacts.

Setup

  • Clone the latest prebuilt of simpleperf:

    • git clone https://android.googlesource.com/platform/prebuilts/simpleperf
  • Add the helper scripts to your clone of the repo

  • Modify copy_libs.sh so that the paths LOCAL_BUILD_PATH and SIMPLEPERF_PATH match your workspace

  • Modify perf_record.sh to refer to the correct android-ndk path for your workspace

Running

  • run perf_record.sh

    • This will start simpleperf and then wait for geckoview_example to be started manually.
    • In perf_record.sh there are alternative codepaths commented out that will launch geckoview_example first and then start profiling
  • Once the capture is complete, you will need to copy your unstripped libraries over by running copy_libs.sh (as it is, simpleperf will copy the stripped libs right from the android device)

    • simpleperf requires the libraries to be in a specific folder relative to the data file. e.g binary_cache/data/app/org.mozilla.geckoview_example-1/lib/arm/libxul.so
    • After running copy_libs.sh verify that the libraries you compiled have been copied to the simpleperf binary_cache folder for your app.
    • Depending on the device and app you may need to manually copy the unstripped libs to the correct binary_cache folder, e.g. binary_cache/data/app/org.mozilla.fenix.debug-cGBgD0-yu6fZrNrmK2DHpw==/lib/arm
    • You can ensure that they are unstripped by running file on them, e.g. file binary_cache/data/app/org.mozilla.geckoview_example-1/lib/arm/libxul.so
  • You will need to run copy_libs.sh or otherwise ensure that the correct libs are in binary_cache each time you capture a profile

  • You can then run python report_html.py to generate the html report

  • There are additional scripts which can be useful such as the report.py or report_sample.py.

    • Note that these scripts require you to explicitly set the symbol path.
    • e.g. python report.py --sort dso --symfs binary_cache or python report_sample.py --symfs binary_cache

Exporting to firefox profiler format

Notes

  • Simpleperf is a rich tool with many more options, described here
  • From the simpleperf tooling: "app_profiler.py isn't supported on Android < N, please switch to use simpleperf binary directly."
You can’t perform that action at this time.