Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upWire up the JS engine's memory reporting. #6572
Conversation
highfive
commented
Jul 8, 2015
hoppipolla-critic-bot
commented
Jul 8, 2015
|
Critic review: https://critic.hoppipolla.co.uk/r/5487 This is an external review system which you may optionally use for the code review of your pull request. In order to help critic track your changes, please do not make in-place history rewrites (e.g. via |
|
@jdm, this review has your name all over it :) I'm actually going to have to land patches in four repositories before this is done.
I'm putting this change up for review first because it's driving the other changes. If any modifications are needed here it'll be best to work them out here first and then back-propagate them as necessary. I'm a little worried about testing all this. I can do a certain amount of local testing (e.g. I've done Linux and Mac) but I'm worried about the following case.
That would be truly painful, but I can't see a way to CI-test all of my changes in advance. Hopefully it won't come to that. |
|
I'd like to see the rust-mozjs changes. |
This is https://bugzilla.mozilla.org/show_bug.cgi?id=1181452.
This is servo/mozjs#49
This is servo/rust-mozjs#177
|
|
It would be useful to hook up the worker threads to the memory reporting, too: http://mxr.mozilla.org/servo/source/components/script/dom/dedicatedworkerglobalscope.rs and http://mxr.mozilla.org/servo/source/components/script/dom/workerglobalscope.rs are where those are implemented. -S-awaiting-review +S-needs-code-changes Reviewed 6 of 6 files at r1. components/script/script_task.rs, line 286 [r1] (raw file): components/script/script_task.rs, line 295 [r1] (raw file): components/script/script_task.rs, line 528 [r1] (raw file): components/script/script_task.rs, line 731 [r1] (raw file): components/script_traits/lib.rs, line 149 [r1] (raw file): Comments from the review on Reviewable.io |
|
Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. components/script/script_task.rs, line 295 [r1] (raw file): Comments from the review on Reviewable.io |
Hmm, the same simplification could be applied to the existing reporters for the Layout and Paint tasks. I'll add that to my todo list. |
|
I've pushed my in-progress changes. I addressed all the comments except the one about hooking up workers; I'll do that tomorrow. And @jdm requested compartment-level reporting which I will consider (I'll need to think about compartments vs. zones...) |
|
I've hooked up workers now. I still haven't done anything about compartment-level reporting; my enthusiasm level for doing that is low. |
|
-S-awaiting-review +S-needs-code-changes Reviewed 4 of 5 files at r2, 6 of 6 files at r3. components/script/dom/bindings/global.rs, line 90 [r3] (raw file): components/script/script_task.rs, line 1030 [r3] (raw file): components/script/script_task.rs, line 1031 [r3] (raw file): Comments from the review on Reviewable.io |
|
Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. components/script/script_task.rs, line 1030 [r3] (raw file): Comments from the review on Reviewable.io |
|
Ok! All review comments are addressed. But this still needs to wait for the mozjs and rust-mozjs changes to land first. |
Wire up the JS engine's memory reporting. SpiderMonkey provides an extremely fine-grained breakdown of memory usage, but for Servo we aggregate the measurements into a small number of coarse buckets, which seems appropriate for the current level of detail provided by Servo's memory profiler. Sample output: ``` | 17.41 MiB -- url(file:///home/njn/moz/servo/../servo-static-suite/wikipedia/Guardians%20of%20the%20Galaxy%20(film)%20-%20Wikipedia,%20the%20free%20encyclopedia.html) | 7.32 MiB -- js | 3.07 MiB -- malloc-heap | 3.00 MiB -- gc-heap | 2.48 MiB -- used | 0.34 MiB -- decommitted | 0.09 MiB -- unused | 0.09 MiB -- admin | 1.25 MiB -- non-heap ``` Most of the changes are plumbing to get the script task communicating with the memory profiler task. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6572) <!-- Reviewable:end -->
|
|
Whoops, we should probably fix that. Let's use the worker id (http://mxr.mozilla.org/servo/source/components/script/dom/worker.rs#86) and append that to the pipeline id so we get globally-unique names. |
|
Actually, that's probably not good enough, since we've got separate "next_worker_id" values in Window and WorkerGlobalScope, so a name like "worker-reporter-{pipeline}-{worker_id}" yields "worker-reporter-0-0" for a toplevel worker, then "worker-reporter-0-0" for the first subworker too. |
SpiderMonkey provides an extremely fine-grained breakdown of memory usage, but for Servo we aggregate the measurements into a small number of coarse buckets, which seems appropriate for the current level of detail provided by Servo's memory profiler. Sample output: ``` | 10.99 MiB -- pages | 7.75 MiB -- url(http://html5demos.com/worker) | 4.63 MiB -- js | 2.00 MiB -- gc-heap | 0.94 MiB -- decommitted | 0.92 MiB -- used | 0.09 MiB -- unused | 0.05 MiB -- admin | 1.44 MiB -- malloc-heap | 1.19 MiB -- non-heap | [...] | 3.24 MiB -- url(http://html5demos.com/js/worker-cruncher.js) | 3.24 MiB -- js | 1.17 MiB -- malloc-heap | 1.06 MiB -- non-heap | 1.00 MiB -- gc-heap | 0.69 MiB -- used | 0.19 MiB -- decommitted | 0.09 MiB -- unused | 0.03 MiB -- admin ``` Most of the changes are plumbing to get the script and worker tasks communicating with the memory profiler task.
|
@bors-servo: r+ |
|
|
Wire up the JS engine's memory reporting. SpiderMonkey provides an extremely fine-grained breakdown of memory usage, but for Servo we aggregate the measurements into a small number of coarse buckets, which seems appropriate for the current level of detail provided by Servo's memory profiler. Sample output: ``` | 17.41 MiB -- url(file:///home/njn/moz/servo/../servo-static-suite/wikipedia/Guardians%20of%20the%20Galaxy%20(film)%20-%20Wikipedia,%20the%20free%20encyclopedia.html) | 7.32 MiB -- js | 3.07 MiB -- malloc-heap | 3.00 MiB -- gc-heap | 2.48 MiB -- used | 0.34 MiB -- decommitted | 0.09 MiB -- unused | 0.09 MiB -- admin | 1.25 MiB -- non-heap ``` Most of the changes are plumbing to get the script task communicating with the memory profiler task. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6572) <!-- Reviewable:end -->
|
|
|
websockets/constructor/004.html failed with "thread 'LayoutTask PipelineId(0)' panicked at 'could not initialize thread_rng: Too many open files (os error 24)', src/libstd/rand/mod.rs:161" Although my latest revision did add calls to rand::random() this doesn't feel like it's fundamentally my fault :( |
|
Looks like taht thread_rng panic has been seen before in #6350. |
|
@bors-servo retry |
nnethercote commentedJul 8, 2015
SpiderMonkey provides an extremely fine-grained breakdown of memory
usage, but for Servo we aggregate the measurements into a small number
of coarse buckets, which seems appropriate for the current level of
detail provided by Servo's memory profiler. Sample output:
Most of the changes are plumbing to get the script task communicating
with the memory profiler task.