Closed Bug 1505522 Opened 7 years ago Closed 6 years ago

Convert MemoryTelemetry.jsm to C++

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: kmag, Assigned: kmag)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [overhead:30K])

Attachments

(3 files)

The existing implementation has memory usage and performance issues which are hard to deal with in JS. By migrating to C++, we could make this code much more memory efficient, and also move the expensive data gathering to a background thread to avoid janking the main thread when we collect data.
Kris, as part of this work can you expand the tests [1] to make sure the values are actually measured? Chris H-C noted anything we gather without expiration should really have a test in bug 1511918, comment 4. [1] https://searchfox.org/mozilla-central/rev/3fdc51e66c9487b39220ad58dcee275fca070ccd/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js#369
Several call sites assume that gatherMemory() does all of its work synchronously. This is not true as it is, and will be even less true after my subsequent patches. This patch changes gatherMemory() to return a promise which resolves when all of its in-process work is done, and changes two call sites to wait for it to resolve before continuing. One remaining call site, unfortunately, needs to return ping data synchronously, and therefore cannot wait for async work to complete.
This has benefits both in terms of performance and memory usage. Aside from the obvious savings of not loading additional JS scripts in every process, this also allows us to move more of our expensive data collection work to a background thread, where it doesn't risk janking both parent and content processes. MozReview-Commit-ID: 2A593R7bIKB
https://hg.mozilla.org/integration/mozilla-inbound/rev/3a91b5014f05907245750d28e49316d783e43492 Bug 1505522: Part 1 - Wait for async reports from gatherMemory() to complete when assembling pings. r=chutten https://hg.mozilla.org/integration/mozilla-inbound/rev/bd8001e1f07efc4b6d512bc2c4e49a9dfd91e1db Bug 1505522: Part 2 - Migrate MemoryTelemetry.jsm to C++. r=erahm,chutten https://hg.mozilla.org/integration/mozilla-inbound/rev/fba99cab2299592c3bb7a055aaa320d35bafe5f1 Bug 1505522: Part 3 - Remove unused getHeapAllocatedAsync method. r=erahm
Blocks: 1513392
Depends on: 1513864
Blocks: 1514372
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: