Am 25.11.24 um 23:59 schrieb Andrii Nakryiko:
[...] DWARF's .eh_frame-based stack unwinding tables. The latter is actually doesn't land itself well to system-wide profiling, and involved compromises in memory usage, CPU usage, and just plain reliability (no one will guarantee you that you captured all of the stack, for example).
The first two arguments are problematic: remember that we're talking about frame pointers, which cost CPU for all users. On one hand you're arguing that DWARF profiling costs CPU for users that want to profile shipped packages, but at the same time you wave aside the CPU cost that this has for all users. Tumbleweed isn't just a distribution for server farms, it's a distribution used for desktops as well, even by non-programmers. I work for a software company as well. But we might not be representative of all users. (And at my company, or at least in my team, we don't profile shipped packages but our own binaries.) Reliability is certainly a problem: "perf" limits the size of the captured portion of the stack, and it affects the overhead. There seems to be some kind of maximum for that limit. But: * Sometimes the result is still good enough and allows drawing conclusions. With less frequent samples you can drive up the captured stack size significantly. * Some profilers aren't limited by BPF and can collect the entire stack, no matter how big it is. Their overhead is higher, so you need a lower sampling frequency, but if you're not profiling a lot you might be willing to pay that price. The overhead can also hide issues, but that's a "can". * If I want to profile a specific application, I can build it myself. You can always do this two-level profiling: first figure out the problematic binaries, then zoom into them. Of course this takes more time, but it's not made impossible by distribution choices. To summarize: DWARF profiling doesn't work perfectly, but it might work well enough in a large enough number of cases, and in the remaining cases it's not made impossible. You just have to invest a bit more time.