Closed Bug 1240786 Opened 9 years ago Closed 3 years ago

The BHR should be able to inject Timeline events

Categories

(Core :: Gecko Profiler, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Yoric, Unassigned)

References

Details

Attachments

(2 files)

We are attempting to find out whether BHR is behaving correctly (with strong suspicion that it's not). It would be useful if BHR was able to inject Timeline markers at the start/end of each period of suspected hang. This would help us investigate these periods using the profiler.
If I read TimelineMarker.h correctly, I think that this should not be too difficult, assuming that we don't need a stack.
Well, it looks like the main difficulty will be porting the code from PRIntervalTime to TimeStamp. Might take a little finesse.
BenWa, what's the best way to inject a profiler Timeline event from xpcom/? Something like that? https://dxr.mozilla.org/mozilla-central/source/xpcom/base/nsCycleCollector.cpp#2839
Flags: needinfo?(bgirard)
Call 'PROFILER_MARKER' form the thread that owns the timeline you want to post it on.
Flags: needinfo?(bgirard)
Assignee: nobody → dteller
Comment on attachment 8710935 [details] MozReview Request: Bug 1240786 - Converting BHR to TimeStamp/TimeDuration;r?ehsan Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31917/diff/1-2/
Comment on attachment 8710936 [details] MozReview Request: Bug 1240786 - Letting BHR inject timeline events;r?benwa Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31919/diff/1-2/
Comment on attachment 8710936 [details] MozReview Request: Bug 1240786 - Letting BHR inject timeline events;r?benwa Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31919/diff/2-3/
Comment on attachment 8710936 [details] MozReview Request: Bug 1240786 - Letting BHR inject timeline events;r?benwa https://reviewboard.mozilla.org/r/31919/#review28745 r+ with the following super minor stuff fixed. ::: xpcom/threads/BackgroundHangMonitor.cpp:76 (Diff revision 3) > + if (profiler_is_active()) { You don't need profiler_is_active again here. If it's inactive the marker will just be free'ed. ::: xpcom/threads/BackgroundHangMonitor.cpp:455 (Diff revision 3) > +#ifdef MOZ_ENABLE_PROFILER_SPS You don't need an ifdef here. It's not saving a lot of work and with the stub implementation of the profiler you'll be fine. the if() branch here is fine cause it will save a non trivial ammount of work when the profiler is inactive.
Attachment #8710936 - Flags: review?(bgirard) → review+
TimelineMarker.h is used by the devtools performance/timeline. PROFILER_MARKER calls add markers to the Gecko profiler add-on. Yoric, which one exactly do you want to use?
(In reply to Victor Porof [:vporof][:vp] from comment #11) > TimelineMarker.h is used by the devtools performance/timeline. > > PROFILER_MARKER calls add markers to the Gecko profiler add-on. > > Yoric, which one exactly do you want to use? Gecko Profiler.
BenWa, with these patches, I don't see my markers in Cleopatra, even though I have checked that the code is executed and the timestamps are correct. Am I forgetting something, either in code or in Cleopatra?
Flags: needinfo?(bgirard)
Comment on attachment 8710935 [details] MozReview Request: Bug 1240786 - Converting BHR to TimeStamp/TimeDuration;r?ehsan https://reviewboard.mozilla.org/r/31917/#review28773
Attachment #8710935 - Flags: review?(ehsan) → review+
IRC: I think custom events might be filtered by default IRC: most of them have their own custom presentation code in cleopatra If you just want text marker then remove the payload. If you care about denoting the start/end point then you'll need to modify the cleopatra DOM to display the start/end in some way.
Flags: needinfo?(bgirard)
(In reply to Benoit Girard (:BenWa) from comment #16) > If you just want text marker then remove the payload. If you care about > denoting the start/end point then you'll need to modify the cleopatra DOM to > display the start/end in some way. I can't find a good entry point for this in Cleopatra. Who could give me a hand?
Flags: needinfo?(bgirard)
Comment on attachment 8710936 [details] MozReview Request: Bug 1240786 - Letting BHR inject timeline events;r?benwa Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31919/diff/3-4/
Too many communication channels involved here, we are losing messages. As mentioned in https://github.com/bgirard/cleopatra/issues/66, it looks like my markers never actually make it to Cleopatra. Moreover, the C++ json serialization code in this patch is never triggered, which is weird. What am I missing?
Flags: needinfo?(bgirard)
I'm not sure? Make sure the marker is still in the circular buffer when you're saving the data.
Flags: needinfo?(bgirard)
How do I do that?
Flags: needinfo?(bgirard)
set profiler.interval to 100 Then cause something to insert the marker and save the profile immediately.
Flags: needinfo?(bgirard)
Assignee: dteller → nobody

The profiler marker API has changed a lot since 2016, and I believe should work from almost anywhere, including BHR, if that's still needed now.
Please reopen/file if you do have issues.

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

Attachment

General

Created:
Updated:
Size: