Inbug 1862556 <https://bugzilla.mozilla.org/show_bug.cgi?id=1862556> I
landed support for thread-specific LongTask markers. You can do this
when creating an nsThread by setting the longTaskLength field in the new
thread options , like this:
nsresult rv = NS_NewNamedThread("Socket Thread",
getter_AddRefs(thread), nullptr,
{nsIThreadManager::DEFAULT_STACK_SIZE,
false, false,
Some(SOCKET_THREAD_LONGTASK_MS)});
In the profiler, if the thread in question was being profiled, there
will be a row in the Markers tab where LongTask markers will appear.
These appear anytime an event takes longer than the specified time to
run. Once you have one of these markers it's easy to drill down and
figure out why the event took so long.
Note that if the thread doesn't use the default event loop (such as the
SocketTransport thread, which calls Poll(), etc), you may need to make
some adjustments and manually insert some markers; you can look at
nsSocketTransportService2.cpp for examples.
MainThread now uses this mechanism to insert markers for any event
taking longer than 50ms (which is also the W3 LongTask API threshold).
Any timing-sensitive threads may find this useful (Media threads, UI
threads, backend operation threads to find causes of unexpected
processing delay, etc.
--
Randell Jesup, Mozilla
--
You received this message because you are subscribed to the Google Groups
"[email protected]" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/75bd4dd8-1545-4fdd-b11c-8ede2afb056d%40mozilla.com.