diff options
author | Nicholas Nethercote <nnethercote@mozilla.com> | 2015-03-10 21:01:05 -0700 |
---|---|---|
committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2015-03-16 18:12:26 -0700 |
commit | ece2711185cffa8ade21b0ab9538bc1be79cadb9 (patch) | |
tree | 5870d8186ce791809ad1afcf65886767ea871a6b /components/layout_traits/lib.rs | |
parent | 5865d5f71776336d8f55dcb326d1fb24279bbf63 (diff) | |
download | servo-ece2711185cffa8ade21b0ab9538bc1be79cadb9.tar.gz servo-ece2711185cffa8ade21b0ab9538bc1be79cadb9.zip |
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.
Diffstat (limited to 'components/layout_traits/lib.rs')
-rw-r--r-- | components/layout_traits/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index 788032169be..d72063383f0 100644 --- a/components/layout_traits/lib.rs +++ b/components/layout_traits/lib.rs @@ -8,6 +8,7 @@ extern crate gfx; extern crate script_traits; extern crate msg; extern crate net; +extern crate url; extern crate util; // This module contains traits in layout used generically @@ -20,6 +21,8 @@ use gfx::paint_task::PaintChan; use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, PipelineExitType}; use net::image_cache_task::ImageCacheTask; use net::resource_task::ResourceTask; +use url::Url; +use util::memory::MemoryProfilerChan; use util::time::TimeProfilerChan; use script_traits::{ScriptControlChan, OpaqueScriptLayoutChannel}; use std::sync::mpsc::{Sender, Receiver}; @@ -38,6 +41,7 @@ pub trait LayoutTaskFactory { // FIXME: use a proper static method fn create(_phantom: Option<&mut Self>, id: PipelineId, + url: Url, chan: OpaqueScriptLayoutChannel, pipeline_port: Receiver<LayoutControlMsg>, constellation_chan: ConstellationChan, @@ -48,5 +52,6 @@ pub trait LayoutTaskFactory { img_cache_task: ImageCacheTask, font_cache_task: FontCacheTask, time_profiler_chan: TimeProfilerChan, + memory_profiler_chan: MemoryProfilerChan, shutdown_chan: Sender<()>); } |