
Set up a perf development environment on ubuntu 22.04 with kernel 6.5, compile perf from source, install dependencies, and configure perf_exec_path to enable perf scripting and off cpu analysis.
Master perf stat and performance analysis by learning key metrics such as context switch rate, page fault rate, and cpu utilization, across system-wide and process metrics and hardware counters.
Explore matrix multiplication performance by analyzing cache misses in a row-major layout; swap inner loops to improve memory access for A, B, and C, using perf.
Explore cpu utilization with perf stat to compare single-threaded and multi-threaded matrix multiplication, analyzing time elapsed, user and system time, task clock, cpu utilization, and ipc to optimize performance.
Explore measuring maximum instructions per cycle and CPU frequency with a NOP loop, perf stat, and taskset on specific CPUs. See how frequency affects performance and throughput.
Explore page faults, distinguishing minor and major faults, and see how transparent huge pages reduce memory overhead and improve performance in Linux with perf.
Explore the TMA metric hierarchy and its six layers, including retiring, bad speculation, back end bound, and front end bound, to identify CPU bottlenecks and guide optimizations.
Master micro-architectural performance analysis by applying the top down method to identify retiring, branch misprediction, front end bound bottlenecks, and optimize with vector instructions and branchless programming.
Learn to profile software performance with sampling, instrumentation, and tracing to identify bottlenecks, characterize workloads, and optimize hotspots using perf record and dynamic instrumentation.
Learn to measure function latency with perf by creating a Python template script, placing start and end probes, recording timestamps, and analyzing latency with delta time and a histogram.
Master dynamic instrumentation with perf probe and perf script on Linux to insert probes into running code without recompilation and analyze targeted performance data.
Measure with perf to baseline Linux performance, visualize bottlenecks with flame graphs, then optimize by addressing sequential code, off-CPU waits, and CPU-bound issues using top-down microarchitecture analysis and Amdahl's law.
Welcome to "Mastering Performance Analysis with perf"—the ultimate course to unlock the full power of Linux's official performance tool, perf. This course is designed to guide you to expert-level performance analysis, equipping you to become a true performance guru in Linux systems.
Developed over two years with extensive revisions, this course delivers essential skills and techniques, ensuring you learn the most effective ways to leverage perf for deep system insights.
Throughout the course, we’ll cover a range of essential tools, methodologies, and technologies, including:
Hardware Event Monitoring: Track events like cache misses and branch mispredictions for deeper insights into hardware behavior.
System Event Monitoring: Monitor critical system events such as context switches and page faults.
Top-Down Microarchitecture Analysis (TMA): Master this technique to write efficient code and maximize CPU performance.
Flame Graphs: Learn how to create and interpret flame graphs to pinpoint performance bottlenecks.
Linux Tracing Frameworks: Explore tracing tools like tracepoints, kprobes, and uprobes to capture in-depth performance data.
Kernel Function Tracking: Gain insights into kernel activities and identify points of failure like segmentation faults.
Application Function Tracing: Track application behavior to diagnose and resolve performance issues.
Custom Performance Analysis: Learn to design custom analyses, such as calculating function latency.
Hands-On Examples: Practice with real-world examples to build practical performance engineering skills.
By the end of this course, you’ll have the confidence to identify, diagnose, and optimize performance issues in your applications and systems as part of your daily work.