/***************************************************************************** * Linux/Android 性能优化工具 perf * 说明: * 之前一直在找Android上的性能优化工具,但是一直不知道应该找哪方面的关键字, * 今天在看Android源代码目录的时候看到linux-tools-perf,查了点相关资料,最后 * 发现这好像就是我一直在找的查看系统性能的工具,目前没有验证任何东西,先记录 * 下这些东西。 * * 2016-06-06 深圳 南山平山村 曾剑锋 ****************************************************************************/ 一、参考文章: Linux 性能优化工具 perf top http://www.68idc.cn/help/server/linux/20151119591702.html Perf -- Linux下的系统性能调优工具,第 2 部分 http://www.ibm.com/developerworks/cn/linux/l-cn-perf2/index.html 二、Android perf源码目录情况: [email protected]:~/myandroid/external$ ls -al linux-tools-perf total 564 drwxrwxr-x 12 myzr myzr 4096 Jun 6 11:05 . drwxrwxr-x 171 myzr myzr 4096 Mar 31 10:32 .. -rw-rw-r-- 1 myzr myzr 6083 Apr 11 2014 Android.mk -rw-rw-r-- 1 myzr myzr 42956 Apr 11 2014 android.patch drwxrwxr-x 8 myzr myzr 4096 Apr 30 2013 arch drwxrwxr-x 2 myzr myzr 4096 Apr 11 2014 bench -rw-rw-r-- 1 myzr myzr 7607 Apr 11 2014 builtin-annotate.c -rw-rw-r-- 1 myzr myzr 4952 Apr 11 2014 builtin-bench.c -rw-rw-r-- 1 myzr myzr 3225 Apr 11 2014 builtin-buildid-cache.c -rw-rw-r-- 1 myzr myzr 1508 Apr 11 2014 builtin-buildid-list.c -rw-rw-r-- 1 myzr myzr 6473 Apr 11 2014 builtin-diff.c -rw-rw-r-- 1 myzr myzr 1249 Apr 11 2014 builtin-evlist.c -rw-rw-r-- 1 myzr myzr 2045 Apr 11 2014 builtin.h -rw-rw-r-- 1 myzr myzr 11439 Apr 11 2014 builtin-help.c -rw-rw-r-- 1 myzr myzr 5702 Apr 11 2014 builtin-inject.c -rw-rw-r-- 1 myzr myzr 17676 Apr 11 2014 builtin-kmem.c -rw-rw-r-- 1 myzr myzr 3746 Apr 11 2014 builtin-kvm.c -rw-rw-r-- 1 myzr myzr 1387 Apr 11 2014 builtin-list.c -rw-rw-r-- 1 myzr myzr 23756 Apr 11 2014 builtin-lock.c -rw-rw-r-- 1 myzr myzr 11159 Apr 11 2014 builtin-probe.c -rw-rw-r-- 1 myzr myzr 23259 Apr 11 2014 builtin-record.c -rw-rw-r-- 1 myzr myzr 14754 Apr 11 2014 builtin-report.c -rw-rw-r-- 1 myzr myzr 45433 Apr 11 2014 builtin-sched.c -rw-rw-r-- 1 myzr myzr 28629 Apr 11 2014 builtin-script.c -rw-rw-r-- 1 myzr myzr 33129 Apr 11 2014 builtin-stat.c -rw-rw-r-- 1 myzr myzr 16940 Apr 11 2014 builtin-test.c -rw-rw-r-- 1 myzr myzr 24003 Apr 11 2014 builtin-timechart.c -rw-rw-r-- 1 myzr myzr 29062 Apr 11 2014 builtin-top.c -rw-rw-r-- 1 myzr myzr 2599 Apr 11 2014 CleanSpec.mk -rw-rw-r-- 1 myzr myzr 814 Apr 11 2014 command-list.txt -rw-rw-r-- 1 myzr myzr 1536 Apr 11 2014 common-cmds.h drwxrwxr-x 2 myzr myzr 4096 Apr 11 2014 config -rw-rw-r-- 1 myzr myzr 603 Apr 11 2014 CREDITS -rw-rw-r-- 1 myzr myzr 17723 Apr 11 2014 design.txt drwxrwxr-x 2 myzr myzr 4096 Apr 11 2014 Documentation drwxrwxr-x 2 myzr myzr 4096 Apr 11 2014 .git drwxrwxr-x 2 myzr myzr 4096 Apr 11 2014 host-darwin-fixup drwxrwxr-x 2 myzr myzr 4096 Apr 11 2014 host-linux-fixup -rw-rw-r-- 1 myzr myzr 29895 Apr 11 2014 Makefile -rw-rw-r-- 1 myzr myzr 288 Apr 11 2014 MANIFEST -rw-rw-r-- 1 myzr myzr 29 Apr 11 2014 mm.c -rw-rw-r-- 1 myzr myzr 1229 Apr 11 2014 perf-archive.sh -rw-rw-r-- 1 myzr myzr 12418 Apr 11 2014 perf.c -rw-rw-r-- 1 myzr myzr 536 Apr 11 2014 PERF-CFLAGS -rw-rw-r-- 1 myzr myzr 4880 Apr 11 2014 perf.h -rw-rw-r-- 1 myzr myzr 21 Apr 11 2014 PERF-VERSION-FILE drwxrwxr-x 2 myzr myzr 4096 Apr 11 2014 python drwxrwxr-x 4 myzr myzr 4096 Apr 30 2013 scripts drwxrwxr-x 6 myzr myzr 4096 Apr 11 2014 util [email protected]:~/myandroid/external$ 三、Android perf [email protected]:/ # perf usage: perf [--version] [--help] COMMAND [ARGS] The most commonly used perf commands are: annotate Read perf.data (created by perf record) and display annotated code archive Create archive with object files with build-ids found in perf.data file bench General framework for benchmark suites buildid-cache Manage build-id cache. buildid-list List the buildids in a perf.data file diff Read two perf.data files and display the differential profile evlist List the event names in a perf.data file inject Filter to augment the events stream with additional information kmem Tool to trace/measure kernel memory(slab) properties kvm Tool to trace/measure kvm guest os list List all symbolic event types lock Analyze lock events probe Define new dynamic tracepoints record Run a command and record its profile into perf.data report Read perf.data (created by perf record) and display the profile sched Tool to trace/measure scheduler properties (latencies) script Read perf.data (created by perf record) and display trace output stat Run a command and gather performance counter statistics test Runs sanity tests. timechart Tool to visualize total system behavior during a workload top System profiling tool. See ‘perf help COMMAND‘ for more information on a specific command. [email protected]:/ # perf --version perf version perf.3.0.8_android [email protected]:/ #
时间: 2024-10-06 11:00:51