1. 首先你需要将
adb push out/target/product/hsdroid/obj/KERNEL.xxxxxx/arch/arm/oprofile/oprofile.ko /data/oprofile/oprofile.ko
2. 只统计用户空间--执行如下命令
ash
lop.init
lop.start.user
lop.dump -l
lop.dump -l
....
3. 统计kernel和用户空间--执行如下命令
adb push out/target/product/hsdroid/obj/KERNEL.xxxxxx/vmlinux /sdcard/
ash
lop.init
lop.start.kernel /sdcard/vmlinux
lop.dump -l
lop.dump -l
....
结果示例:
CPU: CPU with timer interrupt, speed 0 MHz (estimated)
Profiling through timer interrupt
samples % app name symbol name
167 33.2008 libdvm.so /system/lib/libdvm.so
59 11.7296 libc.so /system/lib/libc.so
25 4.9702 busybox /system/sps/tools-binary/tools/busybox
25 4.9702 libaudioflinger.so /system/lib/libaudioflinger.so
22 4.3738 libstagefright.so /system/lib/libstagefright.so
19 3.7773 libskia.so /system/lib/libskia.so
15 2.9821 libasound.so /system/lib/libasound.so
10 1.9881 libcutils.so /system/lib/libcutils.so
10 1.9881 vmlinux arm926_flush_user_cache_range
9 1.7893 vmlinux sc8800g_2d_ioctl
8 1.5905 vmlinux schedule
7 1.3917 libandroid_runtime.so /system/lib/libandroid_runtime.so
6 1.1928 libbinder.so /system/lib/libbinder.so
6 1.1928 vmlinux v4wb_copy_user_page
5 0.9940 libutils.so /system/lib/libutils.so
5 0.9940 vmlinux __copy_to_user_std
5 0.9940 vmlinux snd_pcm_period_elapsed
4 0.7952 vmlinux cpu_idle
3 0.5964 vmlinux do_page_fault
2 0.3976 libril_sp.so /system/lib/libril_sp.so
2 0.3976 vmlinux __pollwait
2 0.3976 vmlinux copy_page_range
2 0.3976 vmlinux cpu_arm926_switch_mm
2 0.3976 vmlinux filemap_fault
2 0.3976 vmlinux find_vma
2 0.3976 vmlinux get_page_from_freelist
2 0.3976 vmlinux number
2 0.3976 vmlinux sprd_syscnt_read
2 0.3976 vmlinux vector_swi
1 0.1988 copybit.sprdbp.so /system/lib/hw/copybit.sprdbp.so
1 0.1988 libGLES_android.so /system/lib/egl/libGLES_android.so
1 0.1988 libicuuc.so /system/lib/libicuuc.so
1 0.1988 liblog.so /system/lib/liblog.so
1 0.1988 libsqlite.so /system/lib/libsqlite.so
1 0.1988 libui.so /system/lib/libui.so
1 0.1988 libz.so /system/lib/libz.so
1 0.1988 linker /system/bin/linker
1 0.1988 ophelp /data/oprofile/ophelp
1 0.1988 vmlinux __alloc_pages_nodemask
1 0.1988 vmlinux __copy_from_user
1 0.1988 vmlinux __dabt_svc
1 0.1988 vmlinux __do_fault
1 0.1988 vmlinux __flush_whole_cache
1 0.1988 vmlinux __hrtimer_start_range_ns
1 0.1988 vmlinux __lru_cache_add
1 0.1988 vmlinux __memzero
1 0.1988 vmlinux __strnlen_user
1 0.1988 vmlinux acct_update_integrals
1 0.1988 vmlinux alloc_pid
1 0.1988 vmlinux arm926_dma_flush_range
1 0.1988 vmlinux arm926_flush_kern_dcache_page
1 0.1988 vmlinux binder_insert_free_buffer
1 0.1988 vmlinux binder_thread_read
1 0.1988 vmlinux binder_thread_write
1 0.1988 vmlinux binder_transaction
1 0.1988 vmlinux cgroup_attach_task
1 0.1988 vmlinux cpu_arm926_dcache_clean_area
1 0.1988 vmlinux cpu_arm926_set_pte_ext
1 0.1988 vmlinux do_filp_open
1 0.1988 vmlinux do_mmap_pgoff
1 0.1988 vmlinux do_sys_poll
1 0.1988 vmlinux fget_light
1 0.1988 vmlinux finish_task_switch.clone.0
1 0.1988 vmlinux flush_dcache_page
1 0.1988 vmlinux format_decode
1 0.1988 vmlinux fsnotify
1 0.1988 vmlinux futex_wait
1 0.1988 vmlinux futex_wait_queue_me
1 0.1988 vmlinux get_futex_key
1 0.1988 vmlinux get_user_pages_fast
1 0.1988 vmlinux hrtimer_init
1 0.1988 vmlinux hrtimer_try_to_cancel
1 0.1988 vmlinux inode_permission
1 0.1988 vmlinux kmem_cache_free
1 0.1988 vmlinux lru_add_drain
1 0.1988 vmlinux mem_cgroup_charge_statistics
1 0.1988 vmlinux memcpy
1 0.1988 vmlinux mmc_blk_issue_rq
1 0.1988 vmlinux mmc_wait_for_req
1 0.1988 vmlinux mutex_lock
1 0.1988 vmlinux mutex_lock_interruptible
1 0.1988 vmlinux mutex_unlock
1 0.1988 vmlinux notifier_call_chain
1 0.1988 vmlinux nsec_to_clock_t
1 0.1988 vmlinux page_add_new_anon_rmap
1 0.1988 vmlinux path_get
1 0.1988 vmlinux path_walk
1 0.1988 vmlinux pfn_valid
1 0.1988 vmlinux pipe_release
1 0.1988 vmlinux poll_freewait
1 0.1988 vmlinux poll_schedule_timeout
1 0.1988 vmlinux prepare_to_wait_exclusive
1 0.1988 vmlinux ret_fast_syscall
1 0.1988 vmlinux sha_transform
1 0.1988 vmlinux snd_pcm_common_ioctl1
1 0.1988 vmlinux snd_pcm_sync_ptr
1 0.1988 vmlinux sys_clock_gettime
1 0.1988 vmlinux timespec_trunc
1 0.1988 vmlinux try_to_wake_up
1 0.1988 vmlinux v4wb_clear_user_highpage
1 0.1988 vmlinux v4wb_copy_user_highpage
1 0.1988 vmlinux vsnprintf
adb push out/target/product/hsdroid/obj/KERNEL.xxxxxx/arch/arm/oprofile/oprofile.ko /data/oprofile/oprofile.ko
2. 只统计用户空间--执行如下命令
ash
lop.init
lop.start.user
lop.dump -l
lop.dump -l
....
3. 统计kernel和用户空间--执行如下命令
adb push out/target/product/hsdroid/obj/KERNEL.xxxxxx/vmlinux /sdcard/
ash
lop.init
lop.start.kernel /sdcard/vmlinux
lop.dump -l
lop.dump -l
....
结果示例:
CPU: CPU with timer interrupt, speed 0 MHz (estimated)
Profiling through timer interrupt
samples % app name symbol name
167 33.2008 libdvm.so /system/lib/libdvm.so
59 11.7296 libc.so /system/lib/libc.so
25 4.9702 busybox /system/sps/tools-binary/tools/busybox
25 4.9702 libaudioflinger.so /system/lib/libaudioflinger.so
22 4.3738 libstagefright.so /system/lib/libstagefright.so
19 3.7773 libskia.so /system/lib/libskia.so
15 2.9821 libasound.so /system/lib/libasound.so
10 1.9881 libcutils.so /system/lib/libcutils.so
10 1.9881 vmlinux arm926_flush_user_cache_range
9 1.7893 vmlinux sc8800g_2d_ioctl
8 1.5905 vmlinux schedule
7 1.3917 libandroid_runtime.so /system/lib/libandroid_runtime.so
6 1.1928 libbinder.so /system/lib/libbinder.so
6 1.1928 vmlinux v4wb_copy_user_page
5 0.9940 libutils.so /system/lib/libutils.so
5 0.9940 vmlinux __copy_to_user_std
5 0.9940 vmlinux snd_pcm_period_elapsed
4 0.7952 vmlinux cpu_idle
3 0.5964 vmlinux do_page_fault
2 0.3976 libril_sp.so /system/lib/libril_sp.so
2 0.3976 vmlinux __pollwait
2 0.3976 vmlinux copy_page_range
2 0.3976 vmlinux cpu_arm926_switch_mm
2 0.3976 vmlinux filemap_fault
2 0.3976 vmlinux find_vma
2 0.3976 vmlinux get_page_from_freelist
2 0.3976 vmlinux number
2 0.3976 vmlinux sprd_syscnt_read
2 0.3976 vmlinux vector_swi
1 0.1988 copybit.sprdbp.so /system/lib/hw/copybit.sprdbp.so
1 0.1988 libGLES_android.so /system/lib/egl/libGLES_android.so
1 0.1988 libicuuc.so /system/lib/libicuuc.so
1 0.1988 liblog.so /system/lib/liblog.so
1 0.1988 libsqlite.so /system/lib/libsqlite.so
1 0.1988 libui.so /system/lib/libui.so
1 0.1988 libz.so /system/lib/libz.so
1 0.1988 linker /system/bin/linker
1 0.1988 ophelp /data/oprofile/ophelp
1 0.1988 vmlinux __alloc_pages_nodemask
1 0.1988 vmlinux __copy_from_user
1 0.1988 vmlinux __dabt_svc
1 0.1988 vmlinux __do_fault
1 0.1988 vmlinux __flush_whole_cache
1 0.1988 vmlinux __hrtimer_start_range_ns
1 0.1988 vmlinux __lru_cache_add
1 0.1988 vmlinux __memzero
1 0.1988 vmlinux __strnlen_user
1 0.1988 vmlinux acct_update_integrals
1 0.1988 vmlinux alloc_pid
1 0.1988 vmlinux arm926_dma_flush_range
1 0.1988 vmlinux arm926_flush_kern_dcache_page
1 0.1988 vmlinux binder_insert_free_buffer
1 0.1988 vmlinux binder_thread_read
1 0.1988 vmlinux binder_thread_write
1 0.1988 vmlinux binder_transaction
1 0.1988 vmlinux cgroup_attach_task
1 0.1988 vmlinux cpu_arm926_dcache_clean_area
1 0.1988 vmlinux cpu_arm926_set_pte_ext
1 0.1988 vmlinux do_filp_open
1 0.1988 vmlinux do_mmap_pgoff
1 0.1988 vmlinux do_sys_poll
1 0.1988 vmlinux fget_light
1 0.1988 vmlinux finish_task_switch.clone.0
1 0.1988 vmlinux flush_dcache_page
1 0.1988 vmlinux format_decode
1 0.1988 vmlinux fsnotify
1 0.1988 vmlinux futex_wait
1 0.1988 vmlinux futex_wait_queue_me
1 0.1988 vmlinux get_futex_key
1 0.1988 vmlinux get_user_pages_fast
1 0.1988 vmlinux hrtimer_init
1 0.1988 vmlinux hrtimer_try_to_cancel
1 0.1988 vmlinux inode_permission
1 0.1988 vmlinux kmem_cache_free
1 0.1988 vmlinux lru_add_drain
1 0.1988 vmlinux mem_cgroup_charge_statistics
1 0.1988 vmlinux memcpy
1 0.1988 vmlinux mmc_blk_issue_rq
1 0.1988 vmlinux mmc_wait_for_req
1 0.1988 vmlinux mutex_lock
1 0.1988 vmlinux mutex_lock_interruptible
1 0.1988 vmlinux mutex_unlock
1 0.1988 vmlinux notifier_call_chain
1 0.1988 vmlinux nsec_to_clock_t
1 0.1988 vmlinux page_add_new_anon_rmap
1 0.1988 vmlinux path_get
1 0.1988 vmlinux path_walk
1 0.1988 vmlinux pfn_valid
1 0.1988 vmlinux pipe_release
1 0.1988 vmlinux poll_freewait
1 0.1988 vmlinux poll_schedule_timeout
1 0.1988 vmlinux prepare_to_wait_exclusive
1 0.1988 vmlinux ret_fast_syscall
1 0.1988 vmlinux sha_transform
1 0.1988 vmlinux snd_pcm_common_ioctl1
1 0.1988 vmlinux snd_pcm_sync_ptr
1 0.1988 vmlinux sys_clock_gettime
1 0.1988 vmlinux timespec_trunc
1 0.1988 vmlinux try_to_wake_up
1 0.1988 vmlinux v4wb_clear_user_highpage
1 0.1988 vmlinux v4wb_copy_user_highpage
1 0.1988 vmlinux vsnprintf