TRT
Sign in

Advanced · Module 9

Performance Profiling, Cache Optimization, and Systems Diagnostics

Diagnose microarchitectural bottlenecks, optimize CPU cache hierarchies and memory bandwidth, audit compiler optimizations, and profile production systems using perf, sanitizers, and eBPF.

Start the modulePro13 lessons · about 214 minutes

Writing correct systems code is only half the battle. High-throughput servers, database storage engines, and low-latency infrastructure operate at the mercy of hardware microarchitectures: L1/L2/L3 cache hit rates, branch prediction pipelines, memory bus saturation, and kernel scheduler latency. When a service experiences degraded throughput or tail-latency spikes, guessing where time is spent leads to futile micro-optimizations.

This module equips you with the empirical tools and architectural insights required to measure, diagnose, and optimize systems software at the silicon and kernel boundary. You will learn to navigate CPU cache topologies, interpret Performance Monitoring Unit (PMU) hardware counters using Linux perf, audit vectorized machine code emitted by optimizing compilers, eliminate cross-socket interconnect penalties on NUMA systems, and dynamically trace live production workloads using AddressSanitizer and kernel eBPF instrumentation.

  1. 1CPU Cache Hierarchy: L1/L2/L3 Topologies, Cache Lines, and Data LocalityPro — members onlyNavigate the hardware memory wall, optimize L1/L2/L3 cache line utilization, leverage hardware prefetchers, and eliminate set-associativity conflict misses via loop tiling.16 min
  2. 2Hardware Performance Counters: PMU Profiling with Linux perf and Flame GraphsPro — members onlySample CPU microarchitectural bottlenecks with hardware Performance Monitoring Units (PMUs), capture call stacks with perf, and visualize execution hot paths using Flame Graphs.16 min
  3. 3Dynamic System Call and Userspace Tracing: strace, ltrace, and kprobesPro — members onlyTrace runtime kernel and library boundaries using ptrace, diagnose blocking system calls with strace, inspect dynamic link calls with ltrace, and attach live kernel probes with kprobes.16 min
  4. 4Memory and Concurrency Sanitizers: ASan, UBSan, TSan, and Valgrind MassifPro — members onlyDetect memory corruption with AddressSanitizer shadow memory, catch undefined behavior with UBSan, trace data races with ThreadSanitizer, and profile heap peaks using Valgrind Massif.16 min
  5. 5Compiler Optimization Internals: Vectorization, Inlining, and Assembly AuditingPro — members onlyAudit compiler-emitted assembly, resolve pointer aliasing with restrict, guide SIMD vectorization across AVX2/AVX-512 registers, and balance function inlining against instruction cache bloat.16 min
  6. 6Cache-Conscious Data Structures: Alignment, False Sharing, and Structure of ArraysPro — members onlyStructure C data layouts for CPU cache lines, eliminate multi-core false sharing with explicit alignment, and transform Array of Structures into Structure of Arrays for SIMD saturation.16 min
  7. 7NUMA Architecture, Memory Interconnects, and CPU PinningPro — members onlyArchitect NUMA-aware multi-threaded systems, manage local vs. remote memory interconnect latency, configure memory allocation policies with libnuma, and bind execution threads with pthread_setaffinity_np.16 min
  8. 8eBPF Performance Diagnostics: Kernel Tracepoints, kretprobes, and bpftracePro — members onlyProfile live production kernels and applications with eBPF, construct low-overhead tracepoints and kretprobes, aggregate kernel histograms, and run one-liner bpftrace diagnostics.16 min
  9. 9Build Systems and Reproducible C ProjectsPro — members onlyOrganize multi-file C programs with dependency-aware builds, separate debug and release settings, and reproducible toolchains.16 min
  10. 10Linux procfs, ptrace, and Core-Dump DebuggingPro — members onlyInspect live process state through procfs, understand debugger tracing with ptrace, and use core dumps for postmortem analysis.16 min
  11. 11Linux Namespaces and cgroupsPro — members onlyUnderstand the isolation and resource-control primitives that form the foundation of Linux containers.18 min
  12. 12Capabilities and seccomp SandboxingPro — members onlyReduce Linux process privilege with capabilities, no-new-privs, and seccomp filters while preserving only required operations.18 min
  13. 13Memory Hardening and Secure Systems CPro — members onlyConnect C memory bugs to exploit mitigations and design safer interfaces for hostile input, integer arithmetic, and object lifetimes.18 min