I will describe two approaches to profiling: instrumentation, using PGO as an example, and sampling, using perf. I will briefly describe hardware support of profiling in some processors.
MCST
PVS-Studio
Yandex