firefox-devtools / profiler

Firefox Profiler — Web app for Firefox performance analysis
https://profiler.firefox.com
Mozilla Public License 2.0
1.2k stars 391 forks source link

Make it easy to find the line that calls a function #4948

Open mstange opened 7 months ago

mstange commented 7 months ago

Profile: https://share.firefox.dev/3VKdfIO

In this profile, the function MOZ_Z_adler32 is called by the function MOZ_Z_inflate. However, MOZ_Z_inflate also calls memcpy from a different spot in the function and spends more samples there. This means that double-clicking the MOZ_Z_inflate function only shows the call to memcpy in the source view. The call to MOZ_Z_adler32 is somewhere else and you can't easily find it.

I'd like there to be a way to easily see the line of code in the source view where MOZ_Z_adler32 was called from MOZ_Z_inflate. (It's line 1191, by the way; the call is via the the UPDATE_CHECK macro.)

Maybe we could have a "go to caller" button in the source view which takes the currently selected call node into account. It would select the parent call node, and open the parent call node's source file in the source view, and scroll to the line which is heaviest among the samples in the previously selected child call node.

┆Issue is synchronized with this Jira Task

julienw commented 7 months ago

I like the idea of "go to caller" but it's not perfect either.

I imagine that when selecting a call node, we could have an horizontally scrollable list of all its callees in the source view header, ordered by sample count. For each of these callees, there would be a button: Click once => scroll to the line where its called; click twice => go into this callee. Or one different button for each of these actions. Or just the action for scrolling, the action for "go into" would be somewhere else (directly on the highlighted line could be a better UI).