Closed Bug 698644 Opened 13 years ago Closed 2 years ago

Measure event loop latency

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: gal, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

Looks to me that all we need that for these days is to keep XPConnect around, which can do with addref/release just as well.
Never mind, its not just OnDispatch, its also the context pushing.
In which case I can re-purpose this code nicely.
Summary: Why does XPConnect use NS_SetGlobalThreadObserver? → Measure event loop latency
We want to know when an event takes a long time to process, minus processing of content script. I will put some measurement into xpconnect On/AfterProcessNextEvent and cancel the measurement if content script runs.
Attached patch patch (obsolete) — Splinter Review
untested
Assignee: nobody → gal
Comment on attachment 570897 [details] [diff] [review]
patch

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

I know this isn't expecting review or anything but I wanted to point out two things before anyone tries it.

::: js/xpconnect/src/nsXPConnect.cpp
@@ +2355,5 @@
>  nsXPConnect::OnProcessNextEvent(nsIThreadInternal *aThread, bool aMayWait,
>                                  PRUint32 aRecursionDepth)
>  {
> +    EventProcessingTiming timing = { current, PR_Now() };
> +    current = &timing;

This won't work, you're taking address of stack var that you're about to paint over when this function exits.

@@ +2374,5 @@
>  
> +    nsresult rv = Pop(nsnull);
> +
> +    PRTime now = PR_Now();
> +    long ms = (now = current->start) / PR_USEC_PER_MSEC;

Should be |(now - current->start)|
Yeah I have a new patch will upload when I find network.
Attached patch new patchSplinter Review
Attachment #570897 - Attachment is obsolete: true
Note that these global observers only run on *XPCOM* events: the widget thread observer actually does the blocking on native-or-XPCOM events and may dispatch many (or no) native events for each iteration of the main XPCOM event loop (nsThread::ProcessNextEvent). So we really need the instrumentation at the widget layer (or to revamp our main event dispatch mechanism) instead of at the XPCOM layer.

The data here won't be especially useful, I think.

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: gal → nobody

We have other mechanisms like the Background Hang Monitor for measuring event latency nowadays, so I don't think we're going to do anything with this at this point.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: