Ceci est une ancienne révision du document !
perf - Performance analysis tools for Linux
Performance counters for Linux are a new kernel-based subsystem that provide a framework for all things performance analysis. It covers hardware level (CPU/PMU, Performance Monitoring Unit) features and software features (software counters, tracepoints) as well.
Listing Events
$ 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] ... ...
Counting Events
CPU counter statistics for the specified command:
$ perf stat ./matmul Performance counter stats for './ser_matmul': 10617,167685 task-clock # 1,000 CPUs utilized 54 context-switches # 0,005 K/sec 27 CPU-migrations # 0,003 K/sec 6 306 page-faults # 0,594 K/sec 28 119 617 371 cycles # 2,649 GHz [83,34%] 23 887 379 283 stalled-cycles-frontend # 84,95% frontend cycles idle [83,33%] 16 806 041 279 stalled-cycles-backend # 59,77% backend cycles idle [66,65%] 7 586 969 293 instructions # 0,27 insns per cycle # 3,15 stalled cycles per insn [83,33%] 1 085 642 258 branches # 102,253 M/sec [83,34%] 1 188 913 branch-misses # 0,11% of all branches [83,34%] 10,620474819 seconds time elapsed