Port oprofil performance monitoring tool to Android

Source: Internet
Author: User

For oprofile porting, cross-compilation is performed on the Ubuntu Server 10.04 platform and transplanted to Android. After practice, the following steps are correct for cross-compilation, which cannot be properly run in other environments, the following is the compilation environment: build: Ubuntu Server 10.04 host: Android-2.2r2cross compiler: mips-linux-gnu-gcc version: 4.3.2cpu: mips cross-compiled oprofile, dependency (popt, binutils); 1. download Open Source: popt-1.14.tar.gzbinutils-2.21.tar.gzoprofile-0.9.6.tar.gz 2. building environment important: touch env. shvi env. sh Content: export PATH =/home/gzshun/share/mips-4. 3/bin: $ PATH # modify the toolchain PATH to export CC = "mips-linux-gnu-gcc-EL" export CXX = "mips-linux-gnu-g ++-EL "export CFLAGS =-staticexport CXXFLAGS =-staticexport CPPFLAGS =-static source env. sh 3. building popt-1.14.tar.gz tar zxvf popt-1.14.tar.gzcd popt-1.14ac_cv_va_copy = yes. /configure -- with-kernel-support -- host = mips-linux-gnu -- prefix =/home/gzshun/poptmakemake install the following static Compilation: 4. building binutils-2.21.tar.gz t Ar zxvf binutils-2.21.tar.gzcd binutils-2.21. /configure -- with-kernel-support -- host = mips-linux-gnu -- prefix =/home/gzshun/binutils -- enable-sharedmake configure-hostmake LDFLAGS = "-all-static" make install 5. building oprofile-0.9.6.tar.gz tar zxvf oprofile-0.9.6.tar.gzcd oprofile-0.9.6. /configure -- with-kernel-support -- host = mips-linux-gnu -- prefix =/home/gzshun/oprofile/-- with-extra-libs =/home/gzsh Un/popt/lib/-- with-extra-nodes des =/home/gzshun/popt/include/-- with-binutils =/home/gzshun/binutilsmake LDFLAGS = "-all-static -L/home/gzshun/binutils/lib-Xlinker-R-Xlinker/home/gzshun/binutils/lib-L/home/gzshun/popt/lib/"make install 6. add the kernel oprofile module General setup ---> [*] Profiling support (EXPERIMENTAL) <*> OProfile system profiling (EXPERIMENTAL) to compile the oprofile module into the kernel, or you can test the performance of the Development Board of the programming module: 1. note. compile Oprofile generation path:/home/gzshun/oprofile, therefore, the Development Board also needs to establish the corresponding path mkdir-p/home/gzshun/to copy the generated oprofile directory to the Development Board/home/gzshun/directory # cause: compile in ubuntu environment, oprofile will find the required lib library according to the original path in ubuntu. (Set the directory to be generated) B. modify oprofile/bin/opcontrol row 1968th and/usr/bin to/binc. create an mtab file in the/etc directory of the Android system and add the following content: nodev/dev/oprofile oprofilefs rw 0 0d. the environment variable for setting oprofile on the Development Board must be placed before PATH, because the original Android system also has two commands. E. the default address for generating oprofile reports is/var/lib/oprofile 2. performance testing # Android has no kernel, so you need to reference vmlinuxgrep "_ stext"/proc/kallsyms from the virtual address --> result: 84000400 T _ stext # obtain the vmlinux virtual start address grep "_ etext"/proc/kallsyms --> result: 84342a18 A _ etext # Get the vmlinux virtual end address opcontrol -- init --> error prompt, mount oprofilefs to mount-t oprofilefs nodev/dev/oprofile # device information required for mounting oprofile opcontrol -- init # initialize opcontrol -- reset # clear information retained last time echo 0> /data/v Mlinux # generate a virtual vmlinuxopcontrol -- callgraph = 2 -- vmlinux =/data/vmlinux -- kernel-range = 0x84000400, 0x84342a18 # Start address, end address, track the kernel or opcontrol -- setup -- callgraph = 2 -- no-vmlinux # Do not track the kernel opcontrol -- setup -- event = CYCLES: 7500: 0: 0: 1 ## event sampling opcontrol -- start ## start testing performance opcontrol -- status ## view status ..... wait time to test opcontrol -- dump # Write test performance information to the disk. Opreport # print the report opcontrol -- stop # stop opcontrol -- shutdown # disable the detection daemon opcontrol -- deinit # example of how to uninstall the oprofile kernel module opreport: Analysis: % percentage of Samples sample times Symbol name function name Android @ localhost:/# opreportOverflow stats not availableCPU: MIPS 24 K, speed 0 MHz (estimated) Counted CYCLES events (Cycles) with a unit mask of 0x00 (No unit mask) count 7500 CYCLES: 7500samples | % ------------------ 132594 18.2787 opreport103155 14.2204 libdvm. so96514 13.3049 libc. so8846312.1950 libskia. so79213 10.9199 app_processCYCLES: 7500samples | % ------------------ 79213 100.000 [heap] (tgid: 1444 range: 0x83000-0x401000) 77023 10.6180 oprofiled57865 7.9770 libcutils. so19547 2.6946 busybox17571 2.4222 libwebcore. so13223 1.8229 libplayback. so9490 1.3082 libdisplay. so3906 0.5385 libbinder. so3816 0.5261 libutils. so3374 0.4651 ophelp3373 0.4650 libandroid_runtime.so2069 0.2852 libcore. so1816 0.2503 libz. so1648 0.2272 libsqlite. so1342 0.1850 dalvik-jit-code-cache (deleted) 1141 0.1573 vmlinux1110 0.1530 libui. so975 0.1344 libsurfaceflinger. so840 0.1158 libGLES_android.so711 0.0980 libhw. so604 0.0833 example_display591 0.0815 libpixelflinger. so528 0.0728 libsurfaceflinger_client.so522 0.0720 linker494 0.0681 libicuuc. so467 0.0644 libdcchd_android.so293 0.0404 libnativehelper. so169 0.0233 libm. so158 0.0218 uinput132 0.0182 gralloc. smp86xx. so117 0.0161 libicui18n. so98 0.0135 copybit. smp86xx. so75 0.0103 libstdc ++. so58 0.0080 libEGL. so58 0.0080 libhardware. so57 0.0079 libGLESv1_CM.so46 0.0063 librmlibplay_default_plugin.so35 0.0048 opjitconv32 0.0044 libandroid_servers.so22 0.0030 libhardware_legacy.so15 0.0021 liblog. so11 0.0015 servicemanager10 0.0014 libmedia. so9 0.0012 adbd8 0.0011 logwrapper5 6.9e-04 libmediaplayerservice. sulfate 5.5e-04 libmedia_jni.o3 4.1e-04 libsysutils. so1 1.4e-04 init1 1.4e-04 libemoji. so

Related Article

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.