Application effectiveness Analysis-use perf to walk the World (reprint)

Source: Internet
Author: User

Reprint: Http://tech.mozilla.com.tw/posts/1803/application-%E6%95%88%E8%83%BD%E5%88%86%E6%9E%90-%E4%BD%BF%E7%94%A8-perf

On a mobile phone, application's reality often affects how bad it is and whether it is power saving, and application CPU usage is a very key factor.

Here's an example of a mobile phone using the Firefox OS, first through the top command below, you can see the CPU usage of the whole system and application, which helps to understand the system or application load.

[Email protected]:~$ adb shell top-s cpu-mTen-D1User the%, System -%, IOW2%, IRQ0%User $+ Nice -+ Sys at+ Idle2+ IOW3+ IRQ0+ SIRQ0=123PID PR CPU%S #THR VSS RSS PCY UID Name108  0   -% R -180304K 60156K FG root/system/b2g/B2G483  0   -% R One85824K 34104K FG app_483/system/b2g/plugin-Container563  0   4% R11056K 408K FG Root Top

To further analyze application's potency bottle décolleté, you can use the tools analyzed on Linux, perf (Download from Tegra Android Toolkit).
Perf is a process used by Linux Kernel to define the perf_event, so as long as the Linux based system can be supported, including the Android/firefox OS phone. Currently perf_event is set to be activated on Linux Kernel, so use perf as long as the application debug symbols is ready for analysis. Interested friends can take part in Perf kernel support to make sure your phone has a startup perf_event.

Perf also has a similar top command, you can see the entire System of the load, such as the following results, you can see that Webglcontext::conver occupies the most CPU resources.

[Email protected]:~$ adb shell perf Top-------------------------------------------------------------------------------Perftop:325Irqs/sec kernel:24.9% exact:0.0% [1000Hz cycles], (all,1CPUs)-------------------------------------------------------------------------------samples pcnt function DSO _______ _____ _____________________________ ________ ______________           697.00 50.6% mozilla::webglcontext::conver/system/b2g/libxul.so424.00 30.8%yamato_tile_texture libglesv2_adreno200.so124.00  9.0%yamato_untile_texture libglesv2_adreno200.so26.00  1.9%Rb_surface_read libglesv2_adreno200.so11.00  0.8% mozilla::gl::swaprandbcompone/system/b2g/libxul.so5.00  0.4% yamato_texfmt_to_pixfmt_for_m libglesv2_adreno200.so

can also through Perf Record/perf report, to the specific application to do load analysis. Prior to the analysis, it was necessary to prepare the debug symbols for the Gecko modules and the response. In the case of Firefox OS, make the following changes, and then re-edit and replace the Gecko modules on the hand machine, this is to put the debug symbols to the Good gecko modules, then get the detailed analysis results.

[Email protected]:~/b2g/gonk-misc$ git diff./default-gecko-Configdiff--git A/default-gecko-config b/default-gecko-Configindex c14919a. 9a18176100644---A/default-gecko-Config+ + + bdefault-gecko-config@@- -,6+ -,7@@ Ac_add_options--enable-debug-symbolsif["${b2g_debug:-0}"!="0" ]; Thenac_add_options--enable-Debugfi+ac_add_options--enable-Profilingif["${b2g_noopt:-0}"!="0"]; Then

The debug symbols is stored below the TMP folder through the following instructions.

out/target/product/device_name/system//tmp/b2g_perf/system/out/target/product/ device_name/symbols/system//tmp/b2g_perf/system/-pr objdir-gecko/dist/bin/b2g/tmp/b2g_perf/system/b2g/  -PR objdir-gecko/dist/lib/*. so/tmp/b2g_perf/system/b2g/

Next, you can start analyzing the bottle décolleté on the application.
The Perf record notes the 20-second movement of application, and then downloads the records from the phone.
At the end of the perf report, you can see the function name that uses the most CPU resources, and the next thing you can do is start evaluating whether there's an improvement plan that will make application faster and more power-saving.

 - [email protected]:~$ adb pull/data/local/perf.data/tmp/b2g_perf/ [email protected]:~$ perf Report-- symfs=/tmp/b2g_perf/system/--71.38%  libxul.so                 [.] Mozilla::webglcontext::conver  15.28%  [Ath6kl_sdio]             0x106fd7c  7.40%  libglesv2_ Adreno200.so    [.] yamato_tile_texture  1.81%  libc.so                   [.] memcpy ...

Perf also has more features, and interested readers can join in the following links.

Https://perf.wiki.kernel.org/index.php/Tutorial

Application effectiveness Analysis-use perf to walk the World (reprint)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.