Unleashing the power of frame pointers for profiling pt.2 - Writing a basic profiler

In the previous blog about the program execution environment, we introduced the concept of stack unwinding with frame pointers as one of the techniques leveraged for profiling a program. In this blog, we’ll see practically how we can build a basic sampling-based continuous profiler. Since we don’t want the application to necessarily be instrumented, we can use the Linux kernel instrumentation. Thanks to eBPF we’re able to dynamically load and attach the profiler program to specific kernel entry points, limiting the introduced overhead by exchanging data with userspace through eBPF maps....

August 18, 2024 · 12 min

Unleashing the power of frame pointers pt.1 - The execution environment

Profiling the CPU allows us to analyze the program’s performance, identify bottlenecks, and optimize its efficiency. Have you ever wondered what happens behind the scenes when you run a program and how to account for CPU time for the actual program functions? And even more, how to write such a tool to profile the program? Even though great open-source projects provide continuous profiling with vast support for compiled, JITed, and interpreted, languages, with or without debug info, with or without frame pointers, etc....

June 23, 2024 · 15 min