Skip to content
Advertisement

Is there any profiler that works with -fomit-frame-pointer on x86_64?

SysProf doesn’t properly generate call stack without it, GProf isn’t accurate at all. And also, are profilers that work without -fno-omit-frame-pointer as accurate as those that rely on it?

Advertisement

Answer

There are none that I’m aware of. With frame pointers, walking a stack is a fairly simple exercise. You simply dereference the frame pointer to find the old frame pointer, stack pointer, and instruction pointer, and repeat until you’re done. Without frame pointers you cannot reliably walk a stack without additional information, which on ELF platforms generally means DWARF CFI. DWARF is fairly complex to parse, and requires you to read in a fair amount of additional information which is tricky to do in the time constraints that profilers need to work in.

One plausible method for implementing this would be to simply save the stack memory at every sample and then walk it offline using the CFI to unwind properly. Depending on the depth of the stack this could require quite a bit of storage, and the copying could be prohibitive. I’ve never heard of a profiler using this technique, but Julian Seward floated it as a potential implementation strategy for Firefox’s built-in profiler.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement