Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Profiling

Eric Rahm edited this page Apr 29, 2015 · 2 revisions

B2G on Device Profiling

Background Reading

Grabbing a profile

Setup

  • If you don't already have a local checkout of the B2G repo, go ahead and get one:
    git clone https://github.com/mozilla-b2g/B2G.git
  • Attach device, verify you can see it: adb devices
  • Get pid of app you want to profile: adb shell b2g-ps
    Note for startup profiling you want the pid of the Preallocated process

Building B2G and installing

Unfortunately I think this is necessary, it's definitely necessary for useful c++ stacks. I apologize now.

Full details: Building FxOS

wiki wiki details for a Flame:

  1. Do a full image flash of the release you want to test
  2. Make sure your device is plugged in
  3. Sync up, config, and build:
cd $B2G_ROOT
git pull
echo "MOZ_PROFILING=1" >> .userconfig
# If you want to build an existing release:
# BRANCH=v2.1 ./config.sh flame-kk
# -otherwise-
# if you want to build the latest and greatest:
./config.sh flame-kk
./build.sh gecko && ./build.sh gaia
./flash.sh gecko && ./flash.sh gaia

Starting profiling

# This will grab up to 2,000,000 samples at 1 sample per ms.
# You can adjust as needed for longer durations.
$B2G_ROOT/profile.sh start -p <pid_of_preallocated> \
                           -t Compositor,GeckoMain -f js,leaf,stackwalk \
                           -e 2000000 -i 1
  • Remove stackwalk if you don't care about C++ stacks
  • Compositor gives you various graphics related events

Grab the profile

After performing the action you want to profile:

$B2G_ROOT/profile.sh capture

Viewing the profile

  1. Go to: https://people.mozilla.org/~bgirard/cleopatra/
  2. Load the file profile_captured.sym that was generated by profile.sh