Firefox OS/Performance/Profiling: Difference between revisions

Jump to navigation Jump to search
no edit summary
m (typo)
No edit summary
Line 1: Line 1:
= Profiling with oprofile =
= Profiling with perf =
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 kernel configuration file. The kernel configuration file will be .config in your linux kernel directory normally. You need to recompile linux kernel after turn on OProfile feature. 
 
<pre>
CONFIG_PROFILING=y
CONFIG_OPROFILE=y
CONFIG_HAVE_OPROFILE=y
</pre>
 
== 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>
you need to install it in your host system.
<pre>
sudo apt-get install oprofile
</pre>
 
== Five Steps to profile your target device ==
To make it easier to use OProfile on B2G project, several Makefile targets have been written.
<pre>
make op_setup        # start up oprofile
make op_start        # start profiling
make op_status      # check status
make op_stop        # stop profiling
make op_pull        # pull profile data from phone
make op_show        # save profiling result in oprofile/oprofile.log
</pre>
===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>
<pre>
opcontrol --setup<br>
opcontrol --vmlinux=/home/vincent/project/B2G_20120217/boot/kernel-android-galaxy-s2/vmlinux --kernel-range=0xc059c000, 0xc0c06000 --event=CPU_CYCLES<br>
</pre>
 
===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>
 
= Profilingwith perf =
The perf utility is a performance analysis tools for Linux.
The perf utility is a performance analysis tools for Linux.


Confirmed users
699

edits

Navigation menu