Closed Bug 1659872 Opened 4 years ago Closed 3 years ago

Remove profiler-specific leaf functions from backtraces

Categories

(Core :: Gecko Profiler, enhancement, P3)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1705258

People

(Reporter: mozbugz, Assigned: mozbugz)

References

Details

Captured backtraces contain some functions showing internal profiler functions that do the work of capturing the stack, e.g.:

Registers::SyncPopulate()libxul.so
locked_profiler_get_backtrace(PSAutoLock const&) [clone .llvm] [clone .14070526456920750423]libxul.so
nsObserverService::NotifyObservers(nsISupports*, char const*, char16_t const*)
...

The first two lines are from the profiler, and are not related to what is being captured, so it would be nice if we could discard them.

I'm guessing that the number of such functions may be dependent on a few things (OS, compiler, compiler options...), so it's probably not as trivial as always removing 2 levels.
A possible solution would be to record the address of a stack variable that cannot be inlined through RVO, when entering the first profiler function (probably profiler_get_backtrace() in the above example), and use that address to discard the first few stack levels above it. TBC...

(Idea by :florian)

One other idea, that I haven't fully thought through, would be to insert a frame label for profiler internals, then either in the MergeStack function, or in the front-end, we could remove stacks that are in the profiler internals.

e.g. something like.

AUTO_PROFILER_LABEL("", PROFILER);

Even though this bug was filed first, I'm marking it as duplicate of new bug 1705258, because the stack-walking functions have changed, so the proposed solutions above are not applicable anymore.

Assignee: nobody → gsquelart
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.