Main Page

From Perf Wiki
(Difference between revisions)
Jump to: navigation, search
(add perf-bench entry)
(update main page to summarize the added tracing features)
Line 4: Line 4:
 
=== Introduction ===
 
=== Introduction ===
  
This is the wiki page for the <tt>perf</tt> performance counters subsystem in Linux.
+
This is the wiki page for the Linux <tt>perf</tt> command, also called perf_events. <tt>perf</tt> is powerful: it can instrument CPU performance counters, tracepoints, kprobes, and uprobes (dynamic tracing). It is capable of lightweight profiling. It is also included in the Linux kernel, under tools/perf, and is frequently updated and enhanced.
Performance counters are CPU hardware registers that
+
count hardware events such
+
as instructions executed, cache-misses suffered, or branches mispredicted. They form
+
a basis for profiling applications to trace dynamic control flow and identify hotspots.
+
+
<tt>perf</tt> provides rich generalized abstractions over hardware specific
+
capabilities. Among others, it provides per task, per CPU and per-workload counters,
+
sampling on top of these and source code event annotation.
+
  
The userspace <tt>perf tools</tt> present a simple to use interface with commands like
+
<tt>perf</tt> began as a tool for using the performance counters subsystem in Linux, and has had various enhancements to add tracing capabilities.
 +
 
 +
Performance counters are CPU hardware registers that count hardware events such as instructions executed, cache-misses suffered, or branches mispredicted. They form a basis for profiling applications to trace dynamic control flow and identify hotspots. <tt>perf</tt> provides rich generalized abstractions over hardware specific capabilities. Among others, it provides per task, per CPU and per-workload counters, sampling on top of these and source code event annotation.
 +
 
 +
Tracepoints are instrumentation points placed at logical locations in code, such as for system calls, TCP/IP events, file system operations, etc. These have negligible overhead when not in use, and can be enabled by the <tt>perf</tt> command to collect information including timestamps and stack traces. <tt>perf</tt> can also dynamically create tracepoints using the kprobes and uprobes frameworks, for kernel and userspace dynamic tracing. The possibilities with these are endless.
 +
 
 +
The userspace <tt>perf</tt> command present a simple to use interface with commands like
  
 
* <tt>[[Tutorial#Counting_with_perf_stat| perf stat</tt>]]: obtain event counts
 
* <tt>[[Tutorial#Counting_with_perf_stat| perf stat</tt>]]: obtain event counts
Line 33: Line 31:
  
 
=== References/Useful links ===
 
=== References/Useful links ===
* <tt>[http://indico.cern.ch/materialDisplay.py?contribId=20&sessionId=4&materialId=slides&confId=141309 Roberto Vitillo's presentation on Perf events]
+
* [http://indico.cern.ch/materialDisplay.py?contribId=20&sessionId=4&materialId=slides&confId=141309 Roberto Vitillo's presentation on Perf events]
 +
* [http://www.brendangregg.com/perf.html Brendan Gregg's perf examples]

Revision as of 06:30, 18 June 2014

Contents

perf: Linux profiling with performance counters

...More than just counters...

Introduction

This is the wiki page for the Linux perf command, also called perf_events. perf is powerful: it can instrument CPU performance counters, tracepoints, kprobes, and uprobes (dynamic tracing). It is capable of lightweight profiling. It is also included in the Linux kernel, under tools/perf, and is frequently updated and enhanced.

perf began as a tool for using the performance counters subsystem in Linux, and has had various enhancements to add tracing capabilities.

Performance counters are CPU hardware registers that count hardware events such as instructions executed, cache-misses suffered, or branches mispredicted. They form a basis for profiling applications to trace dynamic control flow and identify hotspots. perf provides rich generalized abstractions over hardware specific capabilities. Among others, it provides per task, per CPU and per-workload counters, sampling on top of these and source code event annotation.

Tracepoints are instrumentation points placed at logical locations in code, such as for system calls, TCP/IP events, file system operations, etc. These have negligible overhead when not in use, and can be enabled by the perf command to collect information including timestamps and stack traces. perf can also dynamically create tracepoints using the kprobes and uprobes frameworks, for kernel and userspace dynamic tracing. The possibilities with these are endless.

The userspace perf command present a simple to use interface with commands like

To learn more, see the examples in the Tutorial.

Wiki Contents

References/Useful links

Personal tools