Firefox OS/Performance/Profiling: Difference between revisions

(Replaced content with "= Profiling with oprofile = TODO = Profiling with perf = The perf utility is a performance analysis tools for Linux.<br>Please read about [[B2G/Profiling/perf|profiling B2G ...")
Line 1: Line 1:
= Profiling with oprofile =
= Profiling with oprofile =
TODO
OProfile is a system-wide profiler for Linux systems. The detail description about OProfile please refer to below url<br>
http://oprofile.sourceforge.net/news/
 
OProfile consists of three portions, linux kernel driver, userspace applications and collected profiling samplings.<br>
 
== Prepare the Linux Kernel ==
Please make sure you have turned on below features in kerenl configuration file. The kerenl configuration file will be .config in your linux kernel directory normally. You need to recompile linux kernel after turn on OProfile feature. 
 
CONFIG_PROFILING=y<br>
CONFIG_OPROFILE=y<br>
CONFIG_HAVE_OPROFILE=y<br>
 
== userspace applications ==
Userspace applications of OProfile includes opcontrol and oprofiled. You can find source code of OProfile in glue/gonk/external/oprofile.<br>
 
== host application ==
use host utility opreport to analysis profiling samples<br>
use sudo apt-get install oprofile to install it in your host system
 
 
To make it easier to use OProfile, several targets have been written in Makefile under B2G directory.
== Five Steps to profile your target device ==
===make op_setup===
prepare opsetup script file and push it to target device. <br>
opsetup script will wake up oprofiled and setup trigger event.<br>
The snapshot of opsetup is listed below<br>
opcontrol --setup<br>
opcontrol --vmlinux=/home/vincent/project/B2G_20120217/boot/kernel-android-galaxy-s2/vmlinux --kernel-range=0xc059c000, 0xc0c06000 --event=CPU_CYCLES<br>
===make op_start===
We use "adb shell opcontrol --start" to start profiling and collect samples in target device<br>
===make op_status===
We use "adb shell opcontrol --status" to check profiling status<br>
<pre>
Driver directory: /dev/oprofile
Session directory: /data/oprofile
Counter 0:
    name: CPU_CYCLES
    count: 150000
Counter 1 disabled
Counter 2 disabled
Counter 3 disabled
Counter 4 disabled
oprofiled pid: 3074
profiler is running
      5621 samples received
          0 samples lost overflow
</pre>
===make op_stop===
we use "adb shell opcontrol --stop" to stop profiling<br>
===make op_pull===
pull profiling samples from target device to host PC and copy the related binary files to correlate symbols and memory address
===make op_show===
use opreport to analysis profiling samples<br>
use sudo apt-get install oprofile to install it in your host system
<pre>
CPU: ARM Cortex-A9, speed 0 MHz (estimated)
Counted CPU_CYCLES events (Number of CPU cycles) with a unit mask of 0x00 (No unit mask) count 150000
samples  %        image name              app name                symbol name
5438      9.9701  libmozglue.so            libmozglue.so            __aeabi_idiv
2811      5.1537  libGLESv2_mali.so        libGLESv2_mali.so        /system/lib/egl/libGLESv2_mali.so
2348      4.3049  libc.so                  libc.so                  __aeabi_idiv
2083      3.8190  libxul.so                libxul.so                pixman_composite_over_8888_8_8888_asm_neon
1556      2.8528  libxul.so                libxul.so                pixman_composite_over_8888_8888_asm_neon
1337      2.4513  libxul.so                libxul.so                pixman_scaled_bilinear_scanline_8888_8888_OVER_asm_neon
594      1.0890  libc.so                  libc.so                  timesub
578      1.0597  libxul.so                libxul.so                __aeabi_l2f
547      1.0029  libmozglue.so            libmozglue.so            __aeabi_uidiv
421      0.7719  libc.so                  libc.so                  localsub
383      0.7022  libc.so                  libc.so                  memset
357      0.6545  libxul.so                libxul.so                pixman_composite_over_n_8888_asm_neon
341      0.6252  libxul.so                libxul.so                pixman_composite_over_n_8_8888_asm_neon
308      0.5647  libxul.so                libxul.so                pixman_composite_src_8888_8888_asm_neon
304      0.5574  libm.so                  libm.so                  floor
211      0.3869  libc.so                  libc.so                  __findenv
208      0.3814  libc.so                  libc.so                  pthread_mutex_lock
201      0.3685  libmozglue.so            libmozglue.so            arena_malloc
193      0.3538  libmozglue.so            libmozglue.so            arena_dalloc
180      0.3300  libm.so                  libm.so                  fmod
177      0.3245  libxul.so                libxul.so                nsIFrame::FinishAndStoreOverflow(nsOverflowAreas&, nsSize)
176      0.3227  libc.so                  libc.so                  __system_property_find
174      0.3190  libxul.so                libxul.so                gfx3DMatrix::Transform3D(gfxPoint3D const&) const
171      0.3135  libxul.so                libxul.so                pixman_composite_src_n_8888_asm_neon
162      0.2970  libc.so                  libc.so                  time2sub.clone.2
161      0.2952  libxul.so                libxul.so                PL_DHashTableOperate
</pre>


= Profiling with perf =
= Profiling with perf =
The perf utility is a performance analysis tools for Linux.<br>Please read about [[B2G/Profiling/perf|profiling B2G with perf]].
The perf utility is a performance analysis tools for Linux.<br>Please read about [[B2G/Profiling/perf|profiling B2G with perf]].
Confirmed users
373

edits