Open Bug 1149324 Opened 8 years ago Updated 4 months ago
[meta] Instrument Gecko to provide data on which Web pages are using CPU
There is ongoing work (see, e.g., bug 1132498, bug bug 674779) on a tool to show CPU usage for addons and webpages. There is currently instrumentation for work done in the JS engine, but not for other parts of Gecko. This bug is about instrumenting other parts of Gecko as needed. In theory, instrumenting Gecko would mean instrumenting nsIRunnable implementations and timer callbacks that run off of the event loop of the main thread and other threads, and associating these with the appropriate Web page. However, this might not be practical, both because it might be difficult to associate some of them with tabs / docshells / whatever, and because some of them might be doing work that needs to count towards multiple pages. Given that we're already instrumenting JS, probably the most important things to instrument in Gecko are: * the refresh driver (in nsRefreshDriver::Tick, separately for each of its mObservers in the loop over them) * the places where we do painting and compositing. It's possible a bunch of this happens in nsViewManager::DispatchEvent, although I'm not sure if that's still true. (There might also be other useful stuff to count there.) I have some ancient work-in-progress on starting to instrument Gecko at: https://hg.mozilla.org/users/dbaron_mozilla.com/patches/raw-file/f576041bf4ae/top-perf-backend though there's probably not a whole lot there that's reusable. (There might be a nonzero amount, though.) That said, it may be worth going through the list of runnables and timer callbacks and seeing what the list looks like and whether it's worth instrumenting. Also, when we think things are "done", it might be worth having a mode in the Gecko Profiler that shows time that is unattributed to pages.
Summary: instrument Gecko to provide data on which Web pages are using CPU → [meta] Instrument Gecko to provide data on which Web pages are using CPU
4 months ago
You need to log in before you can comment on or make changes to this bug.