Closed Bug 1627443 Opened 5 years ago Closed 4 years ago

OS X startup profiles show the main thread as both janky and idle while running OS code

Categories

(Core :: Gecko Profiler, defect, P3)

defect

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: florian, Assigned: mstange)

References

Details

Attachments

(1 file)

See this profile: https://perfht.ml/2wa4gqK (no symbols for XUL because this is from a try server build)

Markus, when spinning the native event loop like this, would there be a way to detect that we are no longer idle, and change the category?

Flags: needinfo?(mstange)

Markus' bug 1616642 seems to be about the same issue, and you did respond there -- but it was 1 month ago, an eternity in this strange new world!
(Though in bug 1616642 comment 1 there, I said the idle label was not present in the Mac event processor, maybe I was wrong?)

Priority: -- → P3
See Also: → 1616642

Because this bug's Severity has not been changed from the default since it was filed, and it's Priority is P3 (Backlog,) indicating it has been triaged, the bug's Severity is being updated to S3 (normal.)

Severity: normal → S3

The problem in this profile is that we don't have a function on the stack when the native event loop runs certain types of work, for example "CFRunLoop observers". So we don't have a function that could push a profiler label. But I think CFRunLoop has a way to listen for notifications when it changes between modes, for example when it starts and stops running observers. We could flip some state in those callback functions and somehow respect it during sampling (maybe by pushing a fake stack label?).

Flags: needinfo?(mstange.moz)

Actually, we can do the inverse: There are kCFRunLoopBeforeWaiting and kCFRunLoopAfterWaiting notifications, so we can remove our current IDLE label, and push/pop it from those notifications instead.

Assignee: nobody → mstange.moz
Status: NEW → ASSIGNED

Florian, can you test the attached patch?

Flags: needinfo?(florian)

(In reply to Markus Stange [:mstange] from comment #7)

Florian, can you test the attached patch?

Seems much better, thanks for working on this! Example profile.

Flags: needinfo?(florian)
Pushed by mstange@themasta.com: https://hg.mozilla.org/integration/autoland/rev/4e216423006e Use a CFRunLoopObserver to notify the profiler of native event loop idleness. r=gerald
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: