How to Write a Heap Memory Profiler - Milian Wolff - CppCon 2019

preview_player
Показать описание


How to Write a Heap Memory Profiler

Have you ever wondered how profilers work? Did you ever run into a situation where you wanted to write your own custom profiler, but didn't know how to go about it? Then this talk is for you.

We will build a proof-of-concept heap profiler on Linux that implements the most important aspects of a custom tracing profiler: Intercepting function calls, runtime injection, call stack unwinding and debug symbol resolution. All of these concepts are generic and don't only apply to a heap profiler, we will just use that as a motivating example.

The talk will also touch on some of the lessons learned creating a productionized heap profiler called heaptrack: What data format should you use? How can you compress the data? What needs to be taken into account to support profiling on embedded platforms?

Combined, this talk will teach you about some of the layers behind the scenes of a standardized C++ application. Sadly, these layers tend to be platform dependent. For that reason, this talk concentrates on Linux, but the core principles apply to other platforms too.


Milian Wolff

Milian Wolff is a Senior Software Engineer at KDAB, Milian leads the R&D in tooling and profiling in which he has a special interest. Milian created Massif-Visualizer, heaptrack and hotspot, all of which are now used regularly to improve the performance of C++ and Qt applications. When not applying his knowledge to improving code base performance for KDAB’s customers, Milian maintains QtWebChannel for the Qt Project and is co-maintainer of the KDevelop IDE. In 2015, Milian won KDE’s Akademy Award for his work on Clang integration. He has a Masters Degree in Physics.


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

I dont know if there is some value-add of doing this stuff by hand, and not using a standard profiler like valgrind? (apart from great learning ofcourse)

sourabhforu
Автор

The malloc wrapper cannot possibly be so simple :D dlsym can actually call malloc inside, which makes it a bit annoying.