Closed Bug 1152839 Opened 9 years ago Closed 7 years ago

Identify idle nodes in performance tool

Categories

(DevTools :: Performance Tools (Profiler/Timeline), defect, P3)

37 Branch
x86
macOS
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jsantell, Unassigned)

References

Details

(Whiteboard: [devtools-platform][polish-backlog][difficulty=hard])

Attachments

(1 file)

Startup::XRE_InitChildProcess (e10s) and Startup::XRE_Main (non e10s) frames should be translated to "(idle)", as these take up the majority of the time when no explicit events occur.

We should probably get confirmation that this is the case for these frames as well.
Summary: Translate Startup frames to idle frames in call tree → Identify idle nodes in performance tool
Pinging for info to see if the above functions can be considered "idle" when visualizing profiler data, and if you're aware of other functions that can be considered idle. Thanks!
Flags: needinfo?(khuey)
Flags: needinfo?(bugs)
What does "idle" mean here?  I assume you mean that we're blocked in something like pthread_cond_wait or WaitMessageW?
Flags: needinfo?(khuey)
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #2)
> What does "idle" mean here?  I assume you mean that we're blocked in
> something like pthread_cond_wait or WaitMessageW?

I think we are looking for what C++ frames we will see from the SPS profiler when the event queue is empty and just waiting for user input or some runnable or whatever.

Startup::XRE_Main is what I see most time being attributed to when I open a blank tab and profile nothing for a few seconds.
We should probably put in a specific frame for "waiting for events" then, because Startup::XRE_Main will be on the stack for everything.
We would only consider time idle if this was the youngest frame.
Sure, but do we have a guarantee that something else will be on the stack?
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #6)
> Sure, but do we have a guarantee that something else will be on the stack?

I'm not sure what you're getting at?

If nothing is on the stack, then the process can't be running, can it?

If the youngest frame is Startup::XRE_main, then we will consider it idle (assuming that is the waiting-for-stuff frame).

If the youngest frame is not Startup::XRE_main, then we attribute the time to that youngest frame's function.

Am I missing something?
My question is whether we know that there will be something else on the SPS stack when we are in fact not idle.  Do we push something onto the stack for all events, or only "interesting" ones?
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #8)
> My question is whether we know that there will be something else on the SPS
> stack when we are in fact not idle.  Do we push something onto the stack for
> all events, or only "interesting" ones?

We have a catchall grouping for C++ frames that aren't known to be part of layout or graphics or whatever called "Gecko". Right now, idle time gets grouped into "Gecko", but the goal of this bug is to split it out.

The only tricky scenario I can think of is if there are many multiple functions that when they are the younggest frame on the stack mean "we are idle". Any C++ frames we haven't explicitly labeled idle and don't belong to another category will fall under "Gecko" by default.
Do you actually see the C stack, or just the psuedostack?  If you see the real C stack then my concerns are probably moot.
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #10)
> Do you actually see the C stack, or just the psuedostack?  If you see the
> real C stack then my concerns are probably moot.

I'm not familiar enough with the profiler. ni djvj
Flags: needinfo?(kvijayan)
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #10)
> Do you actually see the C stack, or just the psuedostack?  If you see the
> real C stack then my concerns are probably moot.

No, you don't see the C stack.  Just the pseudostack + js stack.
Flags: needinfo?(kvijayan)
(In reply to Kannan Vijayan [:djvj] from comment #13)
> (In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #10)
> > Do you actually see the C stack, or just the psuedostack?  If you see the
> > real C stack then my concerns are probably moot.
> 
> No, you don't see the C stack.  Just the pseudostack + js stack.

Talking with Jordan on IRC, I came to the opposite conclusion: IIUC we are grouping by C stack but displaying with the psuedo stack label b/c we don't do symbolication yet (so you could get "duplicate" frames with the same psuedo stack label but for different native frames).
(In reply to Kannan Vijayan [:djvj] from comment #13)
> (In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #10)
> > Do you actually see the C stack, or just the psuedostack?  If you see the
> > real C stack then my concerns are probably moot.
> 
> No, you don't see the C stack.  Just the pseudostack + js stack.

What is the context of "see" here? Visually, in the Performance Tool, or whether or not C stacks are visible in the underlying JSON data of the profile?

With "stackwalk", we would have C stacks, no?
My point, in case it hasn't been clear, is that if you are looking at the psuedostack it may be possible that there are things that simply have not been marked for SPS that will not add any pseudostack entries when they are running but are still not idle.
(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #16)
> My point, in case it hasn't been clear, is that if you are looking at the
> psuedostack it may be possible that there are things that simply have not
> been marked for SPS that will not add any pseudostack entries when they are
> running but are still not idle.

Right, that's a legit concern. I am under the impression we actually have C stack walking and report such stacks if the right features in nsProfiler are requested when starting to profile. Without these I don't see how it's possible to approximate % idle.
(In reply to Shu-yu Guo [:shu] from comment #15)
> What is the context of "see" here? Visually, in the Performance Tool, or
> whether or not C stacks are visible in the underlying JSON data of the
> profile?
> 
> With "stackwalk", we would have C stacks, no?

Yeah, they'd be included in the JSON when the 'stackwalk' option is passed to the profiler start API.  However the builtin tool won't visualize it.

(In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #16)
> My point, in case it hasn't been clear, is that if you are looking at the
> psuedostack it may be possible that there are things that simply have not
> been marked for SPS that will not add any pseudostack entries when they are
> running but are still not idle.

If we push an "Idle" SPS entry when waiting for events on the event loop, that should be reliable, no?
(In reply to Kannan Vijayan [:djvj] from comment #18)
> (In reply to Kyle Huey [:khuey] (khuey@mozilla.com) from comment #16)
> > My point, in case it hasn't been clear, is that if you are looking at the
> > psuedostack it may be possible that there are things that simply have not
> > been marked for SPS that will not add any pseudostack entries when they are
> > running but are still not idle.
> 
> If we push an "Idle" SPS entry when waiting for events on the event loop,
> that should be reliable, no?

Yes.  See comment 4.
Flags: needinfo?(bugs)
So what's the verdict for this? SPS will generate idle entries? Who can help with that?

We'd like to have this for the 40.1 release, or we can do what Nick mentioned with relabeling the XRE_Main leaf frames as "idle" on the front end for a quicker (?) result -- less accurate than what we have now, but arguably more correct.
No longer blocks: 1153473
No longer blocks: perf-tool-papercuts
Priority: -- → P3
Some discussion in faking this on the front in bug 1167976#c5; resolving to continue to want to handle this on the profiler end
Whiteboard: [devtools-platform]
Whiteboard: [devtools-platform] → [devtools-platform][polish-backlog]
Whiteboard: [devtools-platform][polish-backlog] → [devtools-platform][polish-backlog][difficulty=hard]
I believe this discussion is no longer relevant, and idle issues have been discussed on the perf.html project. Here is one particular one to track: https://github.com/devtools-html/perf.html/issues/598
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: