Confirmed users
507
edits
(6 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
Java code can be effectively profiled with traceview, included in the Android SDK. See http://developer.android.com/guide/developing/tools/traceview.html | Java code can be effectively profiled with traceview, included in the Android SDK. See http://developer.android.com/guide/developing/tools/traceview.html | ||
* The Fennec build needs to be "[http://developer.android.com/guide/topics/manifest/application-element.html#debug debuggable]". Nightlies are not, but local developer builds are. | |||
* For profiling pageload, you can generally use [http://developer.android.com/tools/debugging/debugging-tracing.html Monitor/DDMS]. Just press the "start method tracing" button, load a page, wait, press the "stop method tracing" button. | |||
* For profiling startup time, you really need to add Debug.startMethodTracing(...) and Debug.stopMethodTracing(). [http://people.mozilla.org/~mfinkle/fennec/profiles/startup-tracing.patch Sample patch] | |||
* Or use the "am start" -P option, e.g. | |||
adb shell am start -n org.mozilla.fennec_$USER/.App -S -P /data/local/tmp/fennec.trace | |||
# wait for Fennec launch | |||
adb pull /data/local/tmp/fennec.trace | |||
# in Monitor, File > Open File > fennec.trace | |||
= Built-in Profiler = | |||
See https://developer.mozilla.org/en/Performance/Profiling_with_the_Built-in_Profiler#Profiling_Firefox_mobile | |||
= oprofile = | = oprofile = | ||
Line 376: | Line 389: | ||
== Using oprofile on Galaxy Nexus == | == Using oprofile on Galaxy Nexus == | ||
See also bug730900. | |||
There is no oprofile support in the factory / production Android build on the Galaxy Nexus. The engineering build (ie. full_maguro-eng configuration) includes user-mode support for oprofile (opcontrol, etc.), but no kernel support for oprofile (/dev/oprofilefs is not present). | There is no oprofile support in the factory / production Android build on the Galaxy Nexus. The engineering build (ie. full_maguro-eng configuration) includes user-mode support for oprofile (opcontrol, etc.), but no kernel support for oprofile (/dev/oprofilefs is not present). | ||
Line 442: | Line 455: | ||
mylinux$ adb shell dmesg | grep oprofile | mylinux$ adb shell dmesg | grep oprofile | ||
<6>[ 2.772705] oprofile: using arm/armv7-ca9 | <6>[ 2.772705] oprofile: using arm/armv7-ca9 | ||
</nowiki> | |||
Now everything appears to be working, but I cannot seem to collect samples! | |||
<nowiki> | |||
root@android:/data/local # opcontrol --reset --kernel-range=0xc004d000,0xc0752000 --event=CPU_CYCLES:1 --setup --status --verbose-log=all --verbose | |||
list_events = 0 | |||
setup = 1 | |||
Configure /dev/oprofile/0/user (1) | |||
Configure /dev/oprofile/0/kernel (1) | |||
Configure /dev/oprofile/0/unit_mask (0) | |||
Configure /dev/oprofile/0/enabled (1) | |||
Configure /dev/oprofile/0/count (1) | |||
Configure /dev/oprofile/0/event (255) | |||
Configure /dev/oprofile/1/enabled (0) | |||
Configure /dev/oprofile/2/enabled (0) | |||
Configure /dev/oprofile/3/enabled (0) | |||
Configure /dev/oprofile/4/enabled (0) | |||
Starting oprofiled... | |||
command: oprofiled --session-dir=/data/oprofile --events=CPU_CYCLES:255:0:1:0:1:1 --no-vmlinux -r 0xc004d000,0xc0752000 --verbose=all | |||
Events: CPU_CYCLES:255:0:1:0:1:1 | |||
Using 2.6+ OProfile kernel interface. | |||
Using log file /data/oprofile/samples/oprofiled.log | |||
Ready | |||
Driver directory: /dev/oprofile | |||
Session directory: /data/oprofile | |||
Counter 0: | |||
name: CPU_CYCLES | |||
count: 1 | |||
Counter 1 disabled | |||
Counter 2 disabled | |||
Counter 3 disabled | |||
Counter 4 disabled | |||
oprofiled pid: 1528 | |||
profiler is not running | |||
cpu1 0 samples received | |||
cpu1 0 samples lost overflow | |||
cpu1 0 samples invalid eip | |||
cpu1 0 backtrace aborted | |||
cpu0 0 samples received | |||
cpu0 0 samples lost overflow | |||
cpu0 0 samples invalid eip | |||
cpu0 0 backtrace aborted | |||
root@android:/data/local # | |||
root@android:/data/local # opcontrol --start | |||
root@android:/data/local # opcontrol --status --verbose | |||
list_events = 0 | |||
setup = 0 | |||
Driver directory: /dev/oprofile | |||
Session directory: /data/oprofile | |||
Counter 0: | |||
name: CPU_CYCLES | |||
count: 1 | |||
Counter 1 disabled | |||
Counter 2 disabled | |||
Counter 3 disabled | |||
Counter 4 disabled | |||
oprofiled pid: 1528 | |||
profiler is running | |||
cpu1 0 samples received | |||
cpu1 0 samples lost overflow | |||
cpu1 0 samples invalid eip | |||
cpu1 0 backtrace aborted | |||
cpu0 0 samples received | |||
cpu0 0 samples lost overflow | |||
cpu0 0 samples invalid eip | |||
cpu0 0 backtrace aborted | |||
root@android:/data/local # opcontrol --stop | |||
root@android:/data/local # ls -lR /data/oprofile | |||
/data/oprofile: | |||
-rw-rw-rw- root root 724 2012-03-07 16:43 abi | |||
-rw-rw-rw- root root 2 2012-03-07 16:46 complete_dump | |||
-rw-rw-rw- root root 4 2012-03-07 16:43 lock | |||
prw-rw-rw- root root 2012-03-07 16:43 opd_pipe | |||
drwxr-xr-x root root 2012-03-07 16:43 samples | |||
/data/oprofile/samples: | |||
-rw-r--r-- root root 57424 2012-03-07 16:46 oprofiled.log | |||
root@android:/data/local # tail /data/oprofile/samples/oprofiled.log | |||
... | |||
CPU_SWITCH to 1 | |||
CPU_SWITCH to 0 | |||
CPU_SWITCH to 1 | |||
CPU_SWITCH to 0 | |||
CPU_SWITCH to 1 | |||
</nowiki> | </nowiki> | ||