Add memory reporting infrastructure and use it to measure the display list.

This changeset implements the beginnings of fine-grained measurement of
Servo's data structures.

- It adds a new `SizeOf` trait, which is used to measure the memory used
  by heap data structures, and implements it for some std types: Box,
  String, Option, Arc, Vec, and DList.

- It adds a new `MemoryReporter` trait which is used to report memory
  measurements from other threads to the memory profiler. Reporters are
  registered and unregistered with the memory profiler, and the memory
  profiler makes measurement requests of reporters when necessary.

- It plumbs a MemoryProfilerChan through to the layout task so it can
  register a memory reporter.

- It implements the `SizeOf` trait for `DisplayList` and associated
  types, and adds a memory reporter that uses it.

The display list hits 14.77 MiB when viewing
tests/html/perf-rainbow.html, and 2.51 MiB when viewing the Guardians of
the Galaxy Wikipedia page from servo-static-suite. Example output:

  0.29: display-list::http://www.reddit.com/
  0.00: display-list::http://static.adzerk.net/reddit/ads.html?sr=-reddit.com,loggedout&bust2#http://www.reddit.com
  0.00: display-list::http://www.reddit.com/static/createadframe.html

There are a number of FIXME comments indicating sub-optimal things. This
is a big enough change for now that doing them as follow-ups seems best.
This commit is contained in:
Nicholas Nethercote 2015-03-10 21:01:05 -07:00
parent 5865d5f717
commit ece2711185
14 changed files with 453 additions and 14 deletions

View file

@ -82,6 +82,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
let opts_clone = opts.clone();
let time_profiler_chan_clone = time_profiler_chan.clone();
let memory_profiler_chan_clone = memory_profiler_chan.clone();
let (result_chan, result_port) = channel();
let compositor_proxy_for_constellation = compositor_proxy.clone_compositor_proxy();
@ -109,6 +110,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
image_cache_task,
font_cache_task,
time_profiler_chan_clone,
memory_profiler_chan_clone,
devtools_chan,
storage_task);