Closed Bug 1211839 Opened 9 years ago Closed 9 years ago

Don't allow off the main thread markers to nest under main thread markers

Categories

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

defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
Firefox 44
Tracking Status
firefox44 --- fixed

People

(Reporter: vporof, Assigned: vporof)

Details

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

Attachments

(1 file, 3 obsolete files)

      No description provided.
Attached patch v1 (obsolete) — Splinter Review
Assignee: nobody → vporof
Status: NEW → ASSIGNED
Attachment #8670175 - Flags: review?(jsantell)
Comment on attachment 8670175 [details] [diff] [review]
v1

Oops, wrong patch.
Attachment #8670175 - Attachment is obsolete: true
Attachment #8670175 - Flags: review?(jsantell)
Attached patch v1 (obsolete) — Splinter Review
Attachment #8670239 - Flags: review?(jsantell)
Comment on attachment 8670239 [details] [diff] [review]
v1

Review of attachment 8670239 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with comments addressed and marker docs -- someone else should probably review the platform code, though

::: devtools/client/performance/modules/logic/waterfall-utils.js
@@ +63,5 @@
> +    // A beter solution would be to collapse every marker with its siblings
> +    // from the same thread, but that would require a thread id attached
> +    // to all markers, which is potentially expensive and rather useless at
> +    // the moment, since we don't really have that many OTMT markers.
> +    if (!nestable || !curr.isMainThread) {

Very good comment, for real

@@ +73,5 @@
>      // recursively upwards if this marker is outside their ranges and nestable.
>      while (!finalized && parentNode) {
> +      // If the markers aren't from the same process, attach them to the root
> +      // node as well. Every process has its own main thread.
> +      if (!curr.processType != parentNode.processType) {

nit: !==

::: devtools/client/performance/test/unit/test_waterfall-utils-collapse-05.js
@@ +48,5 @@
> +  // This should never collapse.
> +  { start: 2, end: 3, name: "C", processType: 1, isMainThread: false },
> +
> +  // This should collapse only under A2-mt
> +  { start: 2, end: 3, name: "D", processType: 2, isMainThread: true },

So we collapse markers when they're on the main thread in the same process -- what scenario would we have where we see another process's main threads markers? I think this is "correct", but just trying to understand.

@@ +67,5 @@
> +      { start: 2, end: 3, name: "B" },
> +    ]},
> +    { start: 1, end: 4, name: "A1-otmt"},
> +    { start: 2, end: 3, name: "C"},
> +    { start: 1, end: 4, name: "A2-mt", submarkers: [

Shouldn't this be ordered before "C"? Maybe less of an issue, or no longer a guarantee with OTMT markers?

::: dom/webidl/ProfileTimelineMarker.webidl
@@ +31,5 @@
>    DOMHighResTimeStamp end = 0;
>    object? stack = null;
>  
> +  unsigned short processType;
> +  boolean isMainThread;

Need to add these to marker docs as all markers have them, and was a bit confused about what "processType" was, so it'd be good to list out the enums, atleast what we have right now, referencing the source in `xpcom/build/nsXULAppAPI.h` it looks like.
Attachment #8670239 - Flags: review?(jsantell) → review+
(In reply to Jordan Santell [:jsantell] [@jsantell] from comment #4)
> Comment on attachment 8670239 [details] [diff] [review]
> v1
> 
> Review of attachment 8670239 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> r+ with comments addressed and marker docs -- someone else should probably
> review the platform code, though
> 
> ::: devtools/client/performance/modules/logic/waterfall-utils.js
> @@ +63,5 @@
> > +    // A beter solution would be to collapse every marker with its siblings
> > +    // from the same thread, but that would require a thread id attached
> > +    // to all markers, which is potentially expensive and rather useless at
> > +    // the moment, since we don't really have that many OTMT markers.
> > +    if (!nestable || !curr.isMainThread) {
> 
> Very good comment, for real
> 
> @@ +73,5 @@
> >      // recursively upwards if this marker is outside their ranges and nestable.
> >      while (!finalized && parentNode) {
> > +      // If the markers aren't from the same process, attach them to the root
> > +      // node as well. Every process has its own main thread.
> > +      if (!curr.processType != parentNode.processType) {
> 
> nit: !==
> 
> ::: devtools/client/performance/test/unit/test_waterfall-utils-collapse-05.js
> @@ +48,5 @@
> > +  // This should never collapse.
> > +  { start: 2, end: 3, name: "C", processType: 1, isMainThread: false },
> > +
> > +  // This should collapse only under A2-mt
> > +  { start: 2, end: 3, name: "D", processType: 2, isMainThread: true },
> 
> So we collapse markers when they're on the main thread in the same process
> -- what scenario would we have where we see another process's main threads
> markers? I think this is "correct", but just trying to understand.
> 

There is absolutely no scenario yet. See bug 1200120. However, hypothetically, we may want to see markers originating from some process dealing with Oculus rift inputs, for example. None of that is implemented yet either though, and I'm not even sure it has to be another process. A better example may be the compositor process: currently we're cheating a little bit by piggybacking the IPC protocol back to the main thread and adding markers there, but it'd be really nice if we could just skip all of this madness and just add markers directly near the code they're concerned with. This would require sending over markers through our own IPC protocol, to the TimelineConsumers instance living on the same process where the Performance tool lives.

> @@ +67,5 @@
> > +      { start: 2, end: 3, name: "B" },
> > +    ]},
> > +    { start: 1, end: 4, name: "A1-otmt"},
> > +    { start: 2, end: 3, name: "C"},
> > +    { start: 1, end: 4, name: "A2-mt", submarkers: [
> 
> Shouldn't this be ordered before "C"? Maybe less of an issue, or no longer a
> guarantee with OTMT markers?
> 

All of those markers start and end at exactly the same time. So not really an issue.

> ::: dom/webidl/ProfileTimelineMarker.webidl
> @@ +31,5 @@
> >    DOMHighResTimeStamp end = 0;
> >    object? stack = null;
> >  
> > +  unsigned short processType;
> > +  boolean isMainThread;
> 
> Need to add these to marker docs as all markers have them, and was a bit
> confused about what "processType" was, so it'd be good to list out the
> enums, atleast what we have right now, referencing the source in
> `xpcom/build/nsXULAppAPI.h` it looks like.

Sure.
Whiteboard: [polish-backlog]
Whiteboard: [polish-backlog] → [polish-backlog] [difficulty=hard]
Attached patch v2 (obsolete) — Splinter Review
Rebased.
Attachment #8670239 - Attachment is obsolete: true
Attachment #8678147 - Flags: review+
Attached patch v3Splinter Review
Rebased.
Attachment #8678147 - Attachment is obsolete: true
Attachment #8678149 - Flags: review+
Comment on attachment 8678149 [details] [diff] [review]
v3

Olli can you please take a look at the platform bits?
Attachment #8678149 - Flags: review?(bugs)
Attachment #8678149 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/a5a31b8a5383
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 44
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: