intel / intel/gprofiler

perf: Optionally utilize buildid cache

Open
#707 0 comments 0 reactions 0 assignees View on GitHub
defined-and-prioritized runtime/perf
Dominant language
Python
Stars
826
Forks
79
PR merge metrics
No merged PRs in 30d

Description

perf has a feature called buildid cache - read about it [here](https://perf.wiki.kernel.org/index.php/Tutorial#Binary_identification_with_build-id). The idea is that `perf record` will copy aside all binaries mapped in profiled apps, so even if the apps go down by the time we run `perf script`, we have the binaries and are able to perform symbolication.

We had it in the past and it was removed in #113. It affects when profiling short-lived containers - similarly to the problem described in [this](https://github.com/Granulate/gprofiler/issues/640) ticket. If we're profiling a container and it goes down before we run `perf script`, then `perf script` is unable to access the container files, and it cannot symbolicate, and we end up with `unknown` frames (or frames which are just the DSO name). In a system with very short-lived containers, we end up missing most of the symbols :/

I suggest we allow utilizing buildid cache as an optional feature (e.g `gprofiler --perf-enable-buildid-cache`), also allow limiting its size somehow (if perf allows it then via perf, otherwise by continuously monitoring it and removing excessive files?). We need to modify `perf record` to collect DSOs during record, and `perf script` to use them during scripting.

See [this](https://github.com/torvalds/linux/commit/0c1d46a8796e830) Linux commit for the reason it's disabled by default in switch-output mode (that we added in #113) and how to enable it anyway. Further usage instructions are found in [Linux docs](https://perf.wiki.kernel.org/index.php/Tutorial#Binary_identification_with_build-id).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.