Perf is a profiler tool for Linux 2.6+ based systems that abstracts away CPU hardware differences in Linux performance measurementsand presents a simple commandline interface. Perf is based on the perf_events interface exported by recent versions of the Linux kernel. This article demonstrates the perf tool through example runs.

最初的时候,它叫做 Performance counter,在 2.6.31 中第一次亮相。此后他成为内核开发最为活跃的一个领域。在 2.6.32 中它正式
改名为 Performance Event,因为 perf 已不再仅仅作为 PMU 的抽象,而是能够处理所有的性能相关的事件。

使用 perf,您可以分析程序运行期间发生的硬件事件,比如 instructions retired ,processor clock cycles 等;您也可以分析软件
事件比如 Page Fault 和进程切换。

这使得 Perf 拥有了众多的性能分析能力,举例来说,使用 Perf 可以计算每个时钟周期内的指令数,称为 IPC,IPC 偏低表明代码没有
很好地利用 CPU。Perf 还可以对程序进行函数级别的采样,从而了解程序的性能瓶颈究竟在哪里等等。Perf 还可以替代 strace,可以添
加动态内核 probe 点,还可以做 benchmark 衡量调度器的好坏.

Subcommands:

perf stat: obtain event counts

perf record: record events for later reporting

perf report: break down events by process, function, etc.

perf annotate: annotate assembly or source code with event counts

perf top: see live event count

perf sched: tracing/measuring of scheduler actions and latencies

perf list: list available events

relative link:
linux-performance-analysis-and-tools

Perf — Linux下的系统性能调优工具介绍

http://en.wikipedia.org/wiki/Perf_(Linux)

perf relation with oracle:

linux-perf-utility-with-el-6 by Hoogland p1

linux-perf-utility-with-el-6 by Hoogland p2