Closed Bug 1672256 Opened 5 years ago Closed 5 years ago

Profiler markers showing stacks of thread creations happening off main thread would be useful

Categories

(Core :: XPCOM, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: florian, Assigned: florian)

References

Details

Attachments

(1 file)

In bug 1670786 I added a marker showing the stacks of new threads created on the main thread. I was also interested in stacks of threads created off main thread but couldn't record them easily because the new marker API didn't support that yet. This has been fixed in bug 1670954.

I think

PROFILER_MARKER_TEXT(
      "NewThread (non-main thread)", OTHER,
      MarkerOptions({MarkerStack::Capture(),
                     MarkerThreadId::MainThread(),
                     MarkerTiming::IntervalUntilNowFrom(startTime)}),
                     aName);

is the correct code to add this marker, but when I do this, the markers don't have a stack. Example profile: https://share.firefox.dev/3lXGUsO

If instead I use the old API and do this:

    profiler_add_marker_for_mainthread(
        JS::ProfilingCategoryPair::OTHER, "NewThread (non-main thread)",
        TextMarkerPayload(aName, startTime, TimeStamp::Now(),
                          mozilla::Nothing(), profiler_get_backtrace()));

the markers have stacks. Example profile: https://share.firefox.dev/2IQ1PzN

What you've written should work (there is no special treatment around capturing stacks, depending on a given thread id), so it's a bug if that doesn't work. I will have a look, and file a bug as needed...

Severity: -- → N/A
Priority: -- → P3

(In reply to Gerald Squelart [:gerald] (he/him) from comment #3)

Profile with bug 1672310 (WIP) applied: https://share.firefox.dev/3kiGmxh

The native stack frames in this profile (both in marker stacks and in the call tree) don't seem to have a library or file name associated with them, and the front-end treat them all as label frames (they are displayed in grey). Is this a side effect of using MOZ_PROFILER_SYMBOLICATE?

(In reply to Florian Quèze [:florian] from comment #4)

The native stack frames in this profile (both in marker stacks and in the call tree) don't seem to have a library or file name associated with them, and the front-end treat them all as label frames (they are displayed in grey). Is this a side effect of using MOZ_PROFILER_SYMBOLICATE?

That's very possible! It's that, or no symbols on my local builds. 😢

Pushed by fqueze@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e268681dd7b3 Record thread creation markers for threads created off main thread, r=gerald.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: