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

http://os.51cto.com/art/201105/265133.htm

在LINUX 源代码中安装perf

[root@localhost perf]# pwd
/usr/src/kernels/linux-2.6.32/tools/perf

[root@localhost perf]# yum install binutils-devel

[root@localhost perf]# make

[root@localhost perf]# make install
install -d -m 755 '/root/bin'
install perf '/root/bin'

[root@localhost perf]# mount   -t  debugfs none  /sys/kernel/debug/

[root@localhost perf]# perf list

List of pre-defined events (to be used in -e):

  cpu-cycles OR cycles                       [Hardware event]
instructions [Hardware event]
cache-references [Hardware event]
cache-misses [Hardware event]
branch-instructions OR branches [Hardware event]
branch-misses [Hardware event]
bus-cycles [Hardware event] cpu-clock [Software event]
task-clock [Software event]
page-faults OR faults [Software event]
minor-faults [Software event]
major-faults [Software event]
context-switches OR cs [Software event]
cpu-migrations OR migrations [Software event] L1-dcache-loads [Hardware cache event]
L1-dcache-load-misses [Hardware cache event]
L1-dcache-stores [Hardware cache event]
L1-dcache-store-misses [Hardware cache event]
L1-dcache-prefetches [Hardware cache event]
L1-dcache-prefetch-misses [Hardware cache event]
L1-icache-loads [Hardware cache event]
L1-icache-load-misses [Hardware cache event]
L1-icache-prefetches [Hardware cache event]
L1-icache-prefetch-misses [Hardware cache event]
LLC-loads [Hardware cache event]
LLC-load-misses [Hardware cache event]
LLC-stores [Hardware cache event]
LLC-store-misses [Hardware cache event]
LLC-prefetches [Hardware cache event]
LLC-prefetch-misses [Hardware cache event]
dTLB-loads [Hardware cache event]
dTLB-load-misses [Hardware cache event]
dTLB-stores [Hardware cache event]
dTLB-store-misses [Hardware cache event]
dTLB-prefetches [Hardware cache event]
dTLB-prefetch-misses [Hardware cache event]
iTLB-loads [Hardware cache event]
iTLB-load-misses [Hardware cache event]
branch-loads [Hardware cache event]
branch-load-misses [Hardware cache event] rNNN [raw hardware event descriptor]
  skb:kfree_skb                              [Tracepoint event]
skb:skb_copy_datagram_iovec [Tracepoint event]
block:block_rq_abort [Tracepoint event]
block:block_rq_insert [Tracepoint event]
block:block_rq_issue [Tracepoint event]
block:block_rq_requeue [Tracepoint event]
block:block_rq_complete [Tracepoint event]
block:block_bio_bounce [Tracepoint event]
block:block_bio_complete [Tracepoint event]
block:block_bio_backmerge [Tracepoint event]
block:block_bio_frontmerge [Tracepoint event]
block:block_bio_queue [Tracepoint event]
block:block_getrq [Tracepoint event]
block:block_sleeprq [Tracepoint event]
block:block_plug [Tracepoint event]
block:block_unplug_timer [Tracepoint event]
block:block_unplug_io [Tracepoint event]
block:block_split [Tracepoint event]
block:block_remap [Tracepoint event]
block:block_rq_remap [Tracepoint event]
kmem:kmalloc [Tracepoint event]
kmem:kmem_cache_alloc [Tracepoint event]
kmem:kmalloc_node [Tracepoint event]
kmem:kmem_cache_alloc_node [Tracepoint event]
kmem:kfree [Tracepoint event]
kmem:kmem_cache_free [Tracepoint event]
kmem:mm_page_free_direct [Tracepoint event]
kmem:mm_pagevec_free [Tracepoint event]
kmem:mm_page_alloc [Tracepoint event]
kmem:mm_page_alloc_zone_locked [Tracepoint event]
kmem:mm_page_pcpu_drain [Tracepoint event]
kmem:mm_page_alloc_extfrag [Tracepoint event]
power:power_start [Tracepoint event]
power:power_end [Tracepoint event]
power:power_frequency [Tracepoint event]
module:module_load [Tracepoint event]
module:module_free [Tracepoint event]
module:module_get [Tracepoint event]
module:module_put [Tracepoint event]
module:module_request [Tracepoint event]
workqueue:workqueue_insertion [Tracepoint event]
workqueue:workqueue_execution [Tracepoint event]
workqueue:workqueue_creation [Tracepoint event]
workqueue:workqueue_destruction [Tracepoint event]
timer:timer_init [Tracepoint event]
timer:timer_start [Tracepoint event]
timer:timer_expire_entry [Tracepoint event]
timer:timer_expire_exit [Tracepoint event]
timer:timer_cancel [Tracepoint event]
timer:hrtimer_init [Tracepoint event]
timer:hrtimer_start [Tracepoint event]
timer:hrtimer_expire_entry [Tracepoint event]
timer:hrtimer_expire_exit [Tracepoint event]
timer:hrtimer_cancel [Tracepoint event]
timer:itimer_state [Tracepoint event]
timer:itimer_expire [Tracepoint event]
irq:irq_handler_entry [Tracepoint event]
irq:irq_handler_exit [Tracepoint event]
irq:softirq_entry [Tracepoint event]
irq:softirq_exit [Tracepoint event]
sched:sched_kthread_stop [Tracepoint event]
sched:sched_kthread_stop_ret [Tracepoint event]
sched:sched_wait_task [Tracepoint event]
sched:sched_wakeup [Tracepoint event]
sched:sched_wakeup_new [Tracepoint event]
sched:sched_switch [Tracepoint event]
sched:sched_migrate_task [Tracepoint event]
sched:sched_process_free [Tracepoint event]
sched:sched_process_exit [Tracepoint event]
sched:sched_process_wait [Tracepoint event]
sched:sched_process_fork [Tracepoint event]
sched:sched_signal_send [Tracepoint event]
sched:sched_stat_wait [Tracepoint event]
sched:sched_stat_runtime [Tracepoint event]
sched:sched_stat_sleep [Tracepoint event]
sched:sched_stat_iowait [Tracepoint event]
syscalls:sys_enter [Tracepoint event]
syscalls:sys_exit [Tracepoint event]
[root@localhost perf]# perf --help

 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
list List all symbolic event types
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)
stat Run a command and gather performance counter statistics
timechart Tool to visualize total system behavior during a workload
top System profiling tool.
trace Read perf.data (created by perf record) and display trace output See 'perf help COMMAND' for more information on a specific command
usage: perf stat [<options>] <command>

    -e, --event <event>   event selector. use 'perf list' to list available events
-i, --inherit child tasks inherit counters
-p, --pid <n> stat events on existing pid
-a, --all-cpus system-wide collection from all CPUs
-c, --scale scale/normalize counters
-v, --verbose be more verbose (show counter open errors, etc)
-r, --repeat <n> repeat command and print average + stddev (max: 100)
-n, --null null run - dont start any counters
[root@localhost perf]# perf stat  dd if=/dev/zero of=/dev/null count= + records in
+ records out
bytes ( MB) copied, 0.522033 seconds, MB/s Performance counter stats for 'dd if=/dev/zero of=/dev/null count=1000000': 514.982845 task-clock-msecs # 0.978 CPUs
context-switches # 0.000 M/sec
CPU-migrations # 0.000 M/sec
page-faults # 0.000 M/sec
cycles # 0.000 M/sec
instructions # 0.000 IPC
cache-references # 0.000 M/sec
cache-misses # 0.000 M/sec 0.526756322 seconds time elapsed
[root@localhost perf]# perf stat -e r1a8 -a sleep 

 Performance counter stats for 'sleep 1':

                raw 0x1a8                #      0.000 M/sec

    1.003503666  seconds time elapsed
[root@localhost perf]# perf stat -r  sleep 

 Performance counter stats for 'sleep 1' ( runs):

       3.083876  task-clock-msecs         #      0.003 CPUs    ( +-  13.690% )
context-switches # 0.000 M/sec ( +- 0.000% )
CPU-migrations # 0.000 M/sec ( +- nan% )
page-faults # 0.046 M/sec ( +- 0.171% )
cycles # 0.000 M/sec ( +- nan% )
instructions # 0.000 IPC ( +- nan% )
cache-references # 0.000 M/sec ( +- nan% )
cache-misses # 0.000 M/sec ( +- nan% ) 1.005166673 seconds time elapsed ( +- 0.050% )

perf 工具介绍1的更多相关文章

  1. perf 工具介绍3

    http://blog.chinaunix.net/uid-10540984-id-3854969.html http://blog.csdn.net/zhangskd/article/details ...

  2. perf 工具介绍2

    [root@localhost ~]# cat test1.c void longa() { int i,j; ; i < ; i++) j=i; //am I silly or crazy? ...

  3. 《连载 | 物联网框架ServerSuperIO教程》- 14.配制工具介绍,以及设备驱动、视图驱动、服务实例的挂载

    注:ServerSuperIO二次开发套件授权码申请---截止到:2016-12-09 1.C#跨平台物联网通讯框架ServerSuperIO(SSIO)介绍 <连载 | 物联网框架Server ...

  4. json、javaBean、xml互转的几种工具介绍

    json.javaBean.xml互转的几种工具介绍 转载至:http://blog.csdn.net/sdyy321/article/details/7024236 工作中经常要用到Json.Jav ...

  5. Linux性能工具介绍

    l  Linux性能工具介绍 p  CPU高 p  磁盘I/O p  网络 p  内存 p  应用程序跟踪 l  操作系统与应用程序的关系比喻为“唇亡齿寒”一点不为过 l  应用程序的性能问题/功能问 ...

  6. Android APP压力测试(一)之Monkey工具介绍

    Android APP压力测试(一) 之Monkey工具介绍 前言 本文主要介绍Monkey工具.Monkey测试是Android平台自动化测试的一种手段,通过Monkey程序模拟用户触摸屏幕.滑动. ...

  7. Android系统性能调优工具介绍

    http://blog.csdn.net/innost/article/details/9008691 经作者授权,发表Tieto某青年牛的一篇<程序员>大作. Android系统性能调优 ...

  8. 简要介绍Apache、php、mysql安装和工具介绍

    1 安装Apache 网站:www.Apache.org下载相应的Apache,目前下载了近期的:httpd-2.2.15-win32-x86-openssl-0.9.8msi 安装简要步骤如下图: ...

  9. [原创]Java静态代码检查工具介绍

    [原创]Java静态代码检查工具介绍 一  什么是静态代码检查? 静态代码分析是指无需运行被测代码,仅通过分析或检查源程序的语法.结构.过程.接口等来检查程序的正确性,找出代码隐藏的错误和缺陷,如参数 ...

随机推荐

  1. 你竟然在公钥中下毒!——如何在RSA公钥中添加后门

    原文:http://www.hackdig.com/?01/hack-17893.htm 分享到: 当我知道它是如何运行时,我惊得下巴都掉了.这是一个非常简单的手法,但这篇文章会颠覆你之前对RSA的看 ...

  2. CNN细节

    1.各层作用 输入层 输入层是整个神经网络的输入,一般代表的是图片的像素矩阵(一般为三维矩阵,即像素x像素x通道) 卷积层 每一层卷积都会提取数据特征,再经过组合和抽象形成更高阶的特征. 池化层 保留 ...

  3. Extjs 代码拾穗

    1.tree grid 添加一行 var rootNode = store.getRootNode(); var newRecord = Ext.create('MatrixDlv',{"s ...

  4. PHP session 写入数据库中的方法

    首先解释下为什么要把session 写到数据库中呢,session 一般默认是以文件的形式放在php.ini 配置的目录中的, 如果你的网站实现了多台服务器负载均衡,这样用户访问你的网站,可能进入的服 ...

  5. tp5总结(四)

    数据库 1.数据库配置 1-1.配置文件配置[http://ww:7070/tp5-3/public/] 1-2.Db::connect配置[数组和字符串方式][http://ww:7070/tp5- ...

  6. linux中shell,awk,sed截取字符串方法总结

    转自:http://www.cnblogs.com/kinga/p/5772566.html Shell 第一种: ${parameter%word} 最小限度从后面截掉word${parameter ...

  7. java 代理设计模式

    首先代理(deleration)是什么,在日常生活中我们有很多这种的例子,比如你上个QQ,各种空间被什么代理刷屏,对的,代理不是生产产品的商家,也不是进购产品的卖家,他们只是帮别人卖东西,这就相当于一 ...

  8. 让ORM支持多结果集

    在现有的ORM框架中,都支持查询单个结果集.比如查询用户表,传入语句,返回一个用户对象的集合.虽然一次性查询多个结果集的情况不多,而且也可以通过多次查询得到,但是从写框架的角度来说,我们并不清楚客户( ...

  9. POJ 3254 & POJ 1185(状压DP入门)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 16773   Accepted: 8860 Desc ...

  10. PHP反序列漏洞学习

    0x00 序列化和反序列化 在PHP中,序列化和反序列化对应的函数分别为serialize()和unserialize(). 序列化:serialize()将对象转换为字符串以便存储传输的一种方式. ...