Closed Bug 1646453 Opened 4 months ago Closed 3 months ago

Add profiler markers for MSCOM IPC

Categories

(Core :: IPC: MSCOM, enhancement)

Unspecified
Windows
enhancement

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: aklotz, Assigned: aklotz)

References

Details

Attachments

(1 file)

I've noticed code being added to our Windows builds that perform synchronous COM calls on the main thread of the browser process. Since synchronous IPC is banned, we should be showing that in the profiler.

Part of the issue here is probably that CLSCTX_LOCAL_SERVER is not a clear indicator that the server is going to be out of process, so developers go ahead and CoCreateInstance without considering the implications.

The way we can do this is to call CoRegisterChannelHook, which tells the COM runtime to call our provided interface every time there is a send and receive.

Adding Jamie for the COM bits, Gerald to take a look at the markers.

To intercept COM IPC, we provide an IChannelHook interface to
CoRegisterChannelHook, which gives us notifications about COM IPC that we can
use to insert profiler markers. Note that IChannelHook is not documented on
MSDN, however it is defined in the SDK header files.

When the profiler is available, once XPCOM is up:

  • If the profiler is active, we immediately register the channel hook;
  • Otherwise we register an observer and hold off on registering the hook until
    the profiler is started, at which point we register the hook and remove the
    observer.
Assignee: nobody → aklotz
Status: NEW → ASSIGNED

(In reply to Aaron Klotz [:aklotz] from comment #0)

I've noticed code being added to our Windows builds that perform synchronous COM calls on the main thread of the browser process. Since synchronous IPC is banned

The Windows e10s a11y implementation relies heavily on sync COM. I assume this will show up for that? I guess we just need to make the perf team aware that a11y is a necessary exception here.

Yep. Maybe as a future enhancement we can filter out the relevant IIDs...

Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c7984ec2a543
Add MSCOM channel hook to enable profiler markers for COM IPC; r=Jamie,gerald

Grrr...

Flags: needinfo?(aklotz)
Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8be12844b538
Add MSCOM channel hook to enable profiler markers for COM IPC; r=Jamie,gerald
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
Regressions: 1648086
You need to log in before you can comment on or make changes to this bug.