aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2015-03-22 15:20:31 -0700
committerNicholas Nethercote <nnethercote@mozilla.com>2015-03-25 16:00:23 -0700
commitce36e574f4f404d7b0c8d15d3d55ea62fca8deb6 (patch)
treef414f6c9095ccebaa241bac7a030cc41f8bd5b52 /components
parent7f587f6cb56b1dae1a56dec36754007ef4d376ac (diff)
downloadservo-ce36e574f4f404d7b0c8d15d3d55ea62fca8deb6.tar.gz
servo-ce36e574f4f404d7b0c8d15d3d55ea62fca8deb6.zip
Rename lots of profiling-related things.
------------------------------------------------------------------------ BEFORE AFTER ------------------------------------------------------------------------ util::memory util::mem - heap_size_of - heap_size_of (unchanged) - SizeOf - HeapSizeOf - size_of_excluding_self - heap_size_of_children prof::mem prof::mem - MemoryProfilerChan - ProfilerChan - MemoryReport - Report - MemoryReportsChan - ReportsChan - MemoryReporter - Reporter - MemoryProfilerMsg - ProfilerMsg - {R,UnR}egisterMemoryReporter - {R,UnR}egisterReporter - MemoryProfiler - Prof - ReportsForest - ReportsForest (unchanged) - ReportsTree - ReportsTree (unchanged) - SystemMemoryReporter - SystemReporter prof::time prof::time - TimeProfilerChan - ProfilerChan - TimerMetadata - TimerMetadata (unchanged) - Formatable - Formattable [spelling!] - TimeProfilerMsg - ProfilerMsg - TimeProfilerCategory - ProfilerCategory - TimeProfilerBuckets - ProfilerBuckets - TimeProfiler - Profiler - TimerMetadataFrameType - TimerMetadataFrameType (unchanged) - TimerMetadataReflowType - TimerMetadataReflowType (unchanged) - ProfilerMetadata - ProfilerMetadata (unchanged) In a few places both prof::time and prof::mem are used, and so module-qualification is needed to avoid overlap, e.g. time::Profiler and mem::Profiler. Likewise with std::mem and prof::mem. This is not a big deal.
Diffstat (limited to 'components')
-rw-r--r--components/compositing/compositor.rs26
-rw-r--r--components/compositing/compositor_task.rs12
-rw-r--r--components/compositing/constellation.rs16
-rw-r--r--components/compositing/headless.rs22
-rw-r--r--components/compositing/pipeline.rs10
-rw-r--r--components/gfx/display_list/mod.rs114
-rw-r--r--components/gfx/paint_task.rs16
-rw-r--r--components/layout/layout_task.rs69
-rw-r--r--components/layout/parallel.rs10
-rw-r--r--components/layout_traits/lib.rs8
-rw-r--r--components/net/image_cache_task.rs16
-rw-r--r--components/profile/mem.rs98
-rw-r--r--components/profile/time.rs124
-rw-r--r--components/script/layout_interface.rs12
-rw-r--r--components/servo/lib.rs12
-rw-r--r--components/util/lib.rs2
-rw-r--r--components/util/mem.rs (renamed from components/util/memory.rs)64
-rw-r--r--components/util/opts.rs8
18 files changed, 315 insertions, 324 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs
index 8a80947f1cf..02f749eb5d8 100644
--- a/components/compositing/compositor.rs
+++ b/components/compositing/compositor.rs
@@ -34,9 +34,7 @@ use msg::constellation_msg::Msg as ConstellationMsg;
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{PipelineId, WindowSizeData};
use profile::mem;
-use profile::mem::{MemoryProfilerChan};
-use profile::time;
-use profile::time::{TimeProfilerCategory, profile, TimeProfilerChan};
+use profile::time::{self, ProfilerCategory, profile};
use std::cmp;
use std::collections::HashMap;
use std::collections::hash_map::Entry::{Occupied, Vacant};
@@ -119,10 +117,10 @@ pub struct IOCompositor<Window: WindowMethods> {
constellation_chan: ConstellationChan,
/// The channel on which messages can be sent to the time profiler.
- time_profiler_chan: TimeProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
/// The channel on which messages can be sent to the memory profiler.
- memory_profiler_chan: MemoryProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan,
/// Pending scroll to fragment event, if any
fragment_point: Option<Point2D<f32>>,
@@ -184,8 +182,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
sender: Box<CompositorProxy+Send>,
receiver: Box<CompositorReceiver>,
constellation_chan: ConstellationChan,
- time_profiler_chan: TimeProfilerChan,
- memory_profiler_chan: MemoryProfilerChan)
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan)
-> IOCompositor<Window> {
// Create an initial layer tree.
//
@@ -217,7 +215,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
got_set_frame_tree_message: false,
constellation_chan: constellation_chan,
time_profiler_chan: time_profiler_chan,
- memory_profiler_chan: memory_profiler_chan,
+ mem_profiler_chan: mem_profiler_chan,
fragment_point: None,
outstanding_paint_msgs: 0,
last_composite_time: 0,
@@ -229,15 +227,15 @@ impl<Window: WindowMethods> IOCompositor<Window> {
sender: Box<CompositorProxy+Send>,
receiver: Box<CompositorReceiver>,
constellation_chan: ConstellationChan,
- time_profiler_chan: TimeProfilerChan,
- memory_profiler_chan: MemoryProfilerChan)
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan)
-> IOCompositor<Window> {
let mut compositor = IOCompositor::new(window,
sender,
receiver,
constellation_chan,
time_profiler_chan,
- memory_profiler_chan);
+ mem_profiler_chan);
// Set the size of the root layer.
compositor.update_zoom_transform();
@@ -1109,7 +1107,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
gl::bind_texture(gl::TEXTURE_2D, 0);
}
- profile(TimeProfilerCategory::Compositing, None, self.time_profiler_chan.clone(), || {
+ profile(ProfilerCategory::Compositing, None, self.time_profiler_chan.clone(), || {
debug!("compositor: compositing");
// Adjust the layer dimensions as necessary to correspond to the size of the window.
self.scene.viewport = Rect {
@@ -1356,8 +1354,8 @@ impl<Window> CompositorEventListener for IOCompositor<Window> where Window: Wind
while self.port.try_recv_compositor_msg().is_some() {}
// Tell the profiler, memory profiler, and scrolling timer to shut down.
- self.time_profiler_chan.send(time::TimeProfilerMsg::Exit);
- self.memory_profiler_chan.send(mem::MemoryProfilerMsg::Exit);
+ self.time_profiler_chan.send(time::ProfilerMsg::Exit);
+ self.mem_profiler_chan.send(mem::ProfilerMsg::Exit);
self.scrolling_timer.shutdown();
}
diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs
index a9b4fb68475..f940ad820c5 100644
--- a/components/compositing/compositor_task.rs
+++ b/components/compositing/compositor_task.rs
@@ -21,8 +21,8 @@ use msg::compositor_msg::{Epoch, LayerId, LayerMetadata, ReadyState};
use msg::compositor_msg::{PaintListener, PaintState, ScriptListener, ScrollPolicy};
use msg::constellation_msg::{ConstellationChan, PipelineId};
use msg::constellation_msg::{Key, KeyState, KeyModifiers};
-use profile::mem::MemoryProfilerChan;
-use profile::time::TimeProfilerChan;
+use profile::mem;
+use profile::time;
use std::sync::mpsc::{channel, Sender, Receiver};
use std::fmt::{Error, Formatter, Debug};
use std::rc::Rc;
@@ -265,8 +265,8 @@ impl CompositorTask {
sender: Box<CompositorProxy+Send>,
receiver: Box<CompositorReceiver>,
constellation_chan: ConstellationChan,
- time_profiler_chan: TimeProfilerChan,
- memory_profiler_chan: MemoryProfilerChan)
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan)
-> Box<CompositorEventListener + 'static>
where Window: WindowMethods + 'static {
match window {
@@ -276,14 +276,14 @@ impl CompositorTask {
receiver,
constellation_chan.clone(),
time_profiler_chan,
- memory_profiler_chan)
+ mem_profiler_chan)
as Box<CompositorEventListener>
}
None => {
box headless::NullCompositor::create(receiver,
constellation_chan.clone(),
time_profiler_chan,
- memory_profiler_chan)
+ mem_profiler_chan)
as Box<CompositorEventListener>
}
}
diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs
index 45dd597b413..02692cb68f0 100644
--- a/components/compositing/constellation.rs
+++ b/components/compositing/constellation.rs
@@ -25,8 +25,8 @@ use msg::constellation_msg::Msg as ConstellationMsg;
use net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use net::resource_task::{self, ResourceTask};
use net::storage_task::{StorageTask, StorageTaskMsg};
-use profile::mem::MemoryProfilerChan;
-use profile::time::TimeProfilerChan;
+use profile::mem;
+use profile::time;
use util::cursor::Cursor;
use util::geometry::PagePx;
use util::opts;
@@ -91,10 +91,10 @@ pub struct Constellation<LTF, STF> {
pending_frames: Vec<FrameChange>,
/// A channel through which messages can be sent to the time profiler.
- pub time_profiler_chan: TimeProfilerChan,
+ pub time_profiler_chan: time::ProfilerChan,
/// A channel through which messages can be sent to the memory profiler.
- pub memory_profiler_chan: MemoryProfilerChan,
+ pub mem_profiler_chan: mem::ProfilerChan,
phantom: PhantomData<(LTF, STF)>,
@@ -173,8 +173,8 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
resource_task: ResourceTask,
image_cache_task: ImageCacheTask,
font_cache_task: FontCacheTask,
- time_profiler_chan: TimeProfilerChan,
- memory_profiler_chan: MemoryProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan,
devtools_chan: Option<DevtoolsControlChan>,
storage_task: StorageTask)
-> ConstellationChan {
@@ -199,7 +199,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
root_frame_id: None,
next_frame_id: FrameId(0),
time_profiler_chan: time_profiler_chan,
- memory_profiler_chan: memory_profiler_chan,
+ mem_profiler_chan: mem_profiler_chan,
window_size: WindowSizeData {
visible_viewport: opts::get().initial_window_size.as_f32() * ScaleFactor::new(1.0),
initial_viewport: opts::get().initial_window_size.as_f32() * ScaleFactor::new(1.0),
@@ -242,7 +242,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.resource_task.clone(),
self.storage_task.clone(),
self.time_profiler_chan.clone(),
- self.memory_profiler_chan.clone(),
+ self.mem_profiler_chan.clone(),
initial_window_rect,
script_channel,
load_data,
diff --git a/components/compositing/headless.rs b/components/compositing/headless.rs
index 3f38099d83b..27cac151f31 100644
--- a/components/compositing/headless.rs
+++ b/components/compositing/headless.rs
@@ -10,9 +10,7 @@ use geom::size::TypedSize2D;
use msg::constellation_msg::Msg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, WindowSizeData};
use profile::mem;
-use profile::mem::MemoryProfilerChan;
use profile::time;
-use profile::time::TimeProfilerChan;
/// Starts the compositor, which listens for messages on the specified port.
///
@@ -24,34 +22,34 @@ pub struct NullCompositor {
/// A channel to the constellation.
constellation_chan: ConstellationChan,
/// A channel to the time profiler.
- time_profiler_chan: TimeProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
/// A channel to the memory profiler.
- memory_profiler_chan: MemoryProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan,
}
impl NullCompositor {
fn new(port: Box<CompositorReceiver>,
constellation_chan: ConstellationChan,
- time_profiler_chan: TimeProfilerChan,
- memory_profiler_chan: MemoryProfilerChan)
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan)
-> NullCompositor {
NullCompositor {
port: port,
constellation_chan: constellation_chan,
time_profiler_chan: time_profiler_chan,
- memory_profiler_chan: memory_profiler_chan,
+ mem_profiler_chan: mem_profiler_chan,
}
}
pub fn create(port: Box<CompositorReceiver>,
constellation_chan: ConstellationChan,
- time_profiler_chan: TimeProfilerChan,
- memory_profiler_chan: MemoryProfilerChan)
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan)
-> NullCompositor {
let compositor = NullCompositor::new(port,
constellation_chan,
time_profiler_chan,
- memory_profiler_chan);
+ mem_profiler_chan);
// Tell the constellation about the initial fake size.
{
@@ -120,8 +118,8 @@ impl CompositorEventListener for NullCompositor {
// another task from finishing (i.e. SetIds)
while self.port.try_recv_compositor_msg().is_some() {}
- self.time_profiler_chan.send(time::TimeProfilerMsg::Exit);
- self.memory_profiler_chan.send(mem::MemoryProfilerMsg::Exit);
+ self.time_profiler_chan.send(time::ProfilerMsg::Exit);
+ self.mem_profiler_chan.send(mem::ProfilerMsg::Exit);
}
fn pinch_zoom_level(&self) -> f32 {
diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs
index b5fcebb578a..227621bd118 100644
--- a/components/compositing/pipeline.rs
+++ b/components/compositing/pipeline.rs
@@ -19,8 +19,8 @@ use msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType};
use net::image_cache_task::ImageCacheTask;
use net::resource_task::ResourceTask;
use net::storage_task::StorageTask;
-use profile::mem::MemoryProfilerChan;
-use profile::time::TimeProfilerChan;
+use profile::mem;
+use profile::time;
use std::sync::mpsc::{Receiver, channel};
use url::Url;
use util::geometry::{PagePx, ViewportPx};
@@ -64,8 +64,8 @@ impl Pipeline {
font_cache_task: FontCacheTask,
resource_task: ResourceTask,
storage_task: StorageTask,
- time_profiler_chan: TimeProfilerChan,
- memory_profiler_chan: MemoryProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan,
window_rect: Option<TypedRect<PagePx, f32>>,
script_chan: Option<ScriptControlChan>,
load_data: LoadData,
@@ -150,7 +150,7 @@ impl Pipeline {
image_cache_task,
font_cache_task,
time_profiler_chan,
- memory_profiler_chan,
+ mem_profiler_chan,
layout_shutdown_chan);
Pipeline::new(id,
diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs
index 398bd4d81b8..995d01f1ff9 100644
--- a/components/gfx/display_list/mod.rs
+++ b/components/gfx/display_list/mod.rs
@@ -37,7 +37,7 @@ use net::image::base::Image;
use util::cursor::Cursor;
use util::linked_list::prepend_from;
use util::geometry::{self, Au, MAX_RECT, ZERO_RECT};
-use util::memory::SizeOf;
+use util::mem::HeapSizeOf;
use util::range::Range;
use util::smallvec::{SmallVec, SmallVec8};
use std::fmt;
@@ -197,14 +197,14 @@ impl DisplayList {
}
}
-impl SizeOf for DisplayList {
- fn size_of_excluding_self(&self) -> usize {
- self.background_and_borders.size_of_excluding_self() +
- self.block_backgrounds_and_borders.size_of_excluding_self() +
- self.floats.size_of_excluding_self() +
- self.content.size_of_excluding_self() +
- self.outlines.size_of_excluding_self() +
- self.children.size_of_excluding_self()
+impl HeapSizeOf for DisplayList {
+ fn heap_size_of_children(&self) -> usize {
+ self.background_and_borders.heap_size_of_children() +
+ self.block_backgrounds_and_borders.heap_size_of_children() +
+ self.floats.heap_size_of_children() +
+ self.content.heap_size_of_children() +
+ self.outlines.heap_size_of_children() +
+ self.children.heap_size_of_children()
}
}
@@ -530,9 +530,9 @@ impl StackingContext {
}
}
-impl SizeOf for StackingContext {
- fn size_of_excluding_self(&self) -> usize {
- self.display_list.size_of_excluding_self()
+impl HeapSizeOf for StackingContext {
+ fn heap_size_of_children(&self) -> usize {
+ self.display_list.heap_size_of_children()
// FIXME(njn): other fields may be measured later, esp. `layer`
}
@@ -593,10 +593,10 @@ impl BaseDisplayItem {
}
}
-impl SizeOf for BaseDisplayItem {
- fn size_of_excluding_self(&self) -> usize {
- self.metadata.size_of_excluding_self() +
- self.clip.size_of_excluding_self()
+impl HeapSizeOf for BaseDisplayItem {
+ fn heap_size_of_children(&self) -> usize {
+ self.metadata.heap_size_of_children() +
+ self.clip.heap_size_of_children()
}
}
@@ -725,14 +725,14 @@ impl ClippingRegion {
}
}
-impl SizeOf for ClippingRegion {
- fn size_of_excluding_self(&self) -> usize {
- self.complex.size_of_excluding_self()
+impl HeapSizeOf for ClippingRegion {
+ fn heap_size_of_children(&self) -> usize {
+ self.complex.heap_size_of_children()
}
}
-impl SizeOf for ComplexClippingRegion {
- fn size_of_excluding_self(&self) -> usize {
+impl HeapSizeOf for ComplexClippingRegion {
+ fn heap_size_of_children(&self) -> usize {
0
}
}
@@ -768,8 +768,8 @@ impl DisplayItemMetadata {
}
}
-impl SizeOf for DisplayItemMetadata {
- fn size_of_excluding_self(&self) -> usize {
+impl HeapSizeOf for DisplayItemMetadata {
+ fn heap_size_of_children(&self) -> usize {
0
}
}
@@ -784,9 +784,9 @@ pub struct SolidColorDisplayItem {
pub color: Color,
}
-impl SizeOf for SolidColorDisplayItem {
- fn size_of_excluding_self(&self) -> usize {
- self.base.size_of_excluding_self()
+impl HeapSizeOf for SolidColorDisplayItem {
+ fn heap_size_of_children(&self) -> usize {
+ self.base.heap_size_of_children()
}
}
@@ -815,9 +815,9 @@ pub struct TextDisplayItem {
pub blur_radius: Au,
}
-impl SizeOf for TextDisplayItem {
- fn size_of_excluding_self(&self) -> usize {
- self.base.size_of_excluding_self()
+impl HeapSizeOf for TextDisplayItem {
+ fn heap_size_of_children(&self) -> usize {
+ self.base.heap_size_of_children()
// We exclude `text_run` because it is non-owning.
}
}
@@ -845,9 +845,9 @@ pub struct ImageDisplayItem {
pub image_rendering: image_rendering::T,
}
-impl SizeOf for ImageDisplayItem {
- fn size_of_excluding_self(&self) -> usize {
- self.base.size_of_excluding_self()
+impl HeapSizeOf for ImageDisplayItem {
+ fn heap_size_of_children(&self) -> usize {
+ self.base.heap_size_of_children()
// We exclude `image` here because it is non-owning.
}
}
@@ -868,15 +868,15 @@ pub struct GradientDisplayItem {
pub stops: Vec<GradientStop>,
}
-impl SizeOf for GradientDisplayItem {
- fn size_of_excluding_self(&self) -> usize {
+impl HeapSizeOf for GradientDisplayItem {
+ fn heap_size_of_children(&self) -> usize {
use libc::c_void;
- use util::memory::heap_size_of;
+ use util::mem::heap_size_of;
- // We can't measure `stops` via Vec's SizeOf implementation because GradientStop isn't
- // defined in this module, and we don't want to import GradientStop into util::memory where
- // the SizeOf trait is defined. So we measure the elements directly.
- self.base.size_of_excluding_self() +
+ // We can't measure `stops` via Vec's HeapSizeOf implementation because GradientStop isn't
+ // defined in this module, and we don't want to import GradientStop into util::mem where
+ // the HeapSizeOf trait is defined. So we measure the elements directly.
+ self.base.heap_size_of_children() +
heap_size_of(self.stops.as_ptr() as *const c_void)
}
}
@@ -903,9 +903,9 @@ pub struct BorderDisplayItem {
pub radius: BorderRadii<Au>,
}
-impl SizeOf for BorderDisplayItem {
- fn size_of_excluding_self(&self) -> usize {
- self.base.size_of_excluding_self()
+impl HeapSizeOf for BorderDisplayItem {
+ fn heap_size_of_children(&self) -> usize {
+ self.base.heap_size_of_children()
}
}
@@ -953,9 +953,9 @@ pub struct LineDisplayItem {
pub style: border_style::T
}
-impl SizeOf for LineDisplayItem {
- fn size_of_excluding_self(&self) -> usize {
- self.base.size_of_excluding_self()
+impl HeapSizeOf for LineDisplayItem {
+ fn heap_size_of_children(&self) -> usize {
+ self.base.heap_size_of_children()
}
}
@@ -984,9 +984,9 @@ pub struct BoxShadowDisplayItem {
pub clip_mode: BoxShadowClipMode,
}
-impl SizeOf for BoxShadowDisplayItem {
- fn size_of_excluding_self(&self) -> usize {
- self.base.size_of_excluding_self()
+impl HeapSizeOf for BoxShadowDisplayItem {
+ fn heap_size_of_children(&self) -> usize {
+ self.base.heap_size_of_children()
}
}
@@ -1152,16 +1152,16 @@ impl fmt::Debug for DisplayItem {
}
}
-impl SizeOf for DisplayItem {
- fn size_of_excluding_self(&self) -> usize {
+impl HeapSizeOf for DisplayItem {
+ fn heap_size_of_children(&self) -> usize {
match *self {
- SolidColorClass(ref item) => item.size_of_excluding_self(),
- TextClass(ref item) => item.size_of_excluding_self(),
- ImageClass(ref item) => item.size_of_excluding_self(),
- BorderClass(ref item) => item.size_of_excluding_self(),
- GradientClass(ref item) => item.size_of_excluding_self(),
- LineClass(ref item) => item.size_of_excluding_self(),
- BoxShadowClass(ref item) => item.size_of_excluding_self(),
+ SolidColorClass(ref item) => item.heap_size_of_children(),
+ TextClass(ref item) => item.heap_size_of_children(),
+ ImageClass(ref item) => item.heap_size_of_children(),
+ BorderClass(ref item) => item.heap_size_of_children(),
+ GradientClass(ref item) => item.heap_size_of_children(),
+ LineClass(ref item) => item.heap_size_of_children(),
+ BoxShadowClass(ref item) => item.heap_size_of_children(),
}
}
}
diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs
index 8548161d165..470bea78e7b 100644
--- a/components/gfx/paint_task.rs
+++ b/components/gfx/paint_task.rs
@@ -25,7 +25,7 @@ use msg::compositor_msg::{LayerMetadata, PaintListener, ScrollPolicy};
use msg::constellation_msg::Msg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use msg::constellation_msg::PipelineExitType;
-use profile::time::{TimeProfilerChan, TimeProfilerCategory, profile};
+use profile::time::{self, profile};
use skia::SkiaGrGLNativeContextRef;
use std::mem;
use std::thread::Builder;
@@ -101,7 +101,7 @@ pub struct PaintTask<C> {
constellation_chan: ConstellationChan,
/// A channel to the time profiler.
- time_profiler_chan: TimeProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
/// The native graphics context.
native_graphics_context: Option<NativePaintingGraphicsContext>,
@@ -141,7 +141,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
constellation_chan: ConstellationChan,
font_cache_task: FontCacheTask,
failure_msg: Failure,
- time_profiler_chan: TimeProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
shutdown_chan: Sender<()>) {
let ConstellationChan(c) = constellation_chan.clone();
spawn_named_with_send_on_failure("PaintTask", task_state::PAINT, move || {
@@ -336,7 +336,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
mut tiles: Vec<BufferRequest>,
scale: f32,
layer_id: LayerId) {
- profile(TimeProfilerCategory::Painting, None, self.time_profiler_chan.clone(), || {
+ profile(time::ProfilerCategory::Painting, None, self.time_profiler_chan.clone(), || {
// Bail out if there is no appropriate stacking context.
let stacking_context = if let Some(ref stacking_context) = self.root_stacking_context {
match display_list::find_stacking_context_with_layer_id(stacking_context,
@@ -419,7 +419,7 @@ struct WorkerThreadProxy {
impl WorkerThreadProxy {
fn spawn(native_graphics_metadata: Option<NativeGraphicsMetadata>,
font_cache_task: FontCacheTask,
- time_profiler_chan: TimeProfilerChan)
+ time_profiler_chan: time::ProfilerChan)
-> Vec<WorkerThreadProxy> {
let thread_count = if opts::get().gpu_painting {
1
@@ -472,7 +472,7 @@ struct WorkerThread {
receiver: Receiver<MsgToWorkerThread>,
native_graphics_context: Option<NativePaintingGraphicsContext>,
font_context: Box<FontContext>,
- time_profiler_sender: TimeProfilerChan,
+ time_profiler_sender: time::ProfilerChan,
}
impl WorkerThread {
@@ -480,7 +480,7 @@ impl WorkerThread {
receiver: Receiver<MsgToWorkerThread>,
native_graphics_metadata: Option<NativeGraphicsMetadata>,
font_cache_task: FontCacheTask,
- time_profiler_sender: TimeProfilerChan)
+ time_profiler_sender: time::ProfilerChan)
-> WorkerThread {
WorkerThread {
sender: sender,
@@ -559,7 +559,7 @@ impl WorkerThread {
paint_context.clear();
// Draw the display list.
- profile(TimeProfilerCategory::PaintingPerTile, None,
+ profile(time::ProfilerCategory::PaintingPerTile, None,
self.time_profiler_sender.clone(), || {
stacking_context.optimize_and_draw_into_context(&mut paint_context,
&tile_bounds,
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index 2c15e643b9c..aeaa4d87fcc 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -43,9 +43,9 @@ use msg::constellation_msg::{ConstellationChan, Failure, PipelineExitType, Pipel
use net::image_cache_task::{ImageCacheTask, ImageResponseMsg};
use net::local_image_cache::{ImageResponder, LocalImageCache};
use net::resource_task::{ResourceTask, load_bytes_iter};
-use profile::mem::{MemoryProfilerChan, MemoryProfilerMsg, MemoryReport, MemoryReportsChan};
-use profile::time::{TimeProfilerCategory, ProfilerMetadata, TimeProfilerChan};
-use profile::time::{TimerMetadataFrameType, TimerMetadataReflowType, profile};
+use profile::mem::{self, Report, ReportsChan};
+use profile::time::{self, ProfilerCategory, ProfilerMetadata, profile};
+use profile::time::{TimerMetadataFrameType, TimerMetadataReflowType};
use script::dom::bindings::js::LayoutJS;
use script::dom::element::ElementTypeId;
use script::dom::htmlelement::HTMLElementTypeId;
@@ -59,7 +59,7 @@ use script_traits::{ConstellationControlMsg, CompositorEvent, OpaqueScriptLayout
use script_traits::{ScriptControlChan, UntrustedNodeAddress};
use std::borrow::ToOwned;
use std::cell::Cell;
-use std::mem;
+use std::mem::transmute;
use std::ops::{Deref, DerefMut};
use std::ptr;
use std::sync::mpsc::{channel, Sender, Receiver, Select};
@@ -73,7 +73,7 @@ use url::Url;
use util::cursor::Cursor;
use util::geometry::Au;
use util::logical_geometry::LogicalPoint;
-use util::memory::{SizeOf};
+use util::mem::HeapSizeOf;
use util::opts;
use util::smallvec::{SmallVec, SmallVec1, VecLike};
use util::task::spawn_named_with_send_on_failure;
@@ -143,13 +143,13 @@ pub struct LayoutTask {
pub paint_chan: PaintChan,
/// The channel on which messages can be sent to the time profiler.
- pub time_profiler_chan: TimeProfilerChan,
+ pub time_profiler_chan: time::ProfilerChan,
/// The channel on which messages can be sent to the memory profiler.
- pub memory_profiler_chan: MemoryProfilerChan,
+ pub mem_profiler_chan: mem::ProfilerChan,
/// The name used for the task's memory reporter.
- pub memory_reporter_name: String,
+ pub reporter_name: String,
/// The channel on which messages can be sent to the resource task.
pub resource_task: ResourceTask,
@@ -204,8 +204,8 @@ impl LayoutTaskFactory for LayoutTask {
resource_task: ResourceTask,
img_cache_task: ImageCacheTask,
font_cache_task: FontCacheTask,
- time_profiler_chan: TimeProfilerChan,
- memory_profiler_chan: MemoryProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan,
shutdown_chan: Sender<()>) {
let ConstellationChan(con_chan) = constellation_chan.clone();
spawn_named_with_send_on_failure("LayoutTask", task_state::LAYOUT, move || {
@@ -225,7 +225,7 @@ impl LayoutTaskFactory for LayoutTask {
img_cache_task,
font_cache_task,
time_profiler_chan,
- memory_profiler_chan);
+ mem_profiler_chan);
layout.start();
}
shutdown_chan.send(()).unwrap();
@@ -276,8 +276,8 @@ impl LayoutTask {
resource_task: ResourceTask,
image_cache_task: ImageCacheTask,
font_cache_task: FontCacheTask,
- time_profiler_chan: TimeProfilerChan,
- memory_profiler_chan: MemoryProfilerChan)
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan)
-> LayoutTask {
let local_image_cache =
Arc::new(Mutex::new(LocalImageCache::new(image_cache_task.clone())));
@@ -296,8 +296,7 @@ impl LayoutTask {
// Register this thread as a memory reporter, via its own channel.
let reporter = Box::new(chan.clone());
let reporter_name = format!("layout-reporter-{}", id.0);
- memory_profiler_chan.send(MemoryProfilerMsg::RegisterMemoryReporter(reporter_name.clone(),
- reporter));
+ mem_profiler_chan.send(mem::ProfilerMsg::RegisterReporter(reporter_name.clone(), reporter));
LayoutTask {
id: id,
@@ -309,8 +308,8 @@ impl LayoutTask {
constellation_chan: constellation_chan.clone(),
paint_chan: paint_chan,
time_profiler_chan: time_profiler_chan,
- memory_profiler_chan: memory_profiler_chan,
- memory_reporter_name: reporter_name,
+ mem_profiler_chan: mem_profiler_chan,
+ reporter_name: reporter_name,
resource_task: resource_task,
image_cache_task: image_cache_task.clone(),
font_cache_task: font_cache_task,
@@ -444,7 +443,7 @@ impl LayoutTask {
Box<LayoutRPC + Send>).unwrap();
},
Msg::Reflow(data) => {
- profile(TimeProfilerCategory::LayoutPerform,
+ profile(time::ProfilerCategory::LayoutPerform,
self.profiler_metadata(&*data),
self.time_profiler_chan.clone(),
|| self.handle_reflow(&*data, possibly_locked_rw_data));
@@ -454,8 +453,8 @@ impl LayoutTask {
self.handle_reap_layout_data(dead_layout_data)
}
},
- Msg::CollectMemoryReports(reports_chan) => {
- self.collect_memory_reports(reports_chan, possibly_locked_rw_data);
+ Msg::CollectReports(reports_chan) => {
+ self.collect_reports(reports_chan, possibly_locked_rw_data);
},
Msg::PrepareToExit(response_chan) => {
debug!("layout: PrepareToExitMsg received");
@@ -472,18 +471,17 @@ impl LayoutTask {
true
}
- fn collect_memory_reports<'a>(&'a self,
- reports_chan: MemoryReportsChan,
- possibly_locked_rw_data:
- &mut Option<MutexGuard<'a, LayoutTaskData>>) {
+ fn collect_reports<'a>(&'a self,
+ reports_chan: ReportsChan,
+ possibly_locked_rw_data: &mut Option<MutexGuard<'a, LayoutTaskData>>) {
let mut reports = vec![];
// FIXME(njn): Just measuring the display tree for now.
let rw_data = self.lock_rw_data(possibly_locked_rw_data);
let stacking_context = rw_data.stacking_context.as_ref();
- reports.push(MemoryReport {
+ reports.push(Report {
path: path!["pages", format!("url({})", self.url), "display-list"],
- size: stacking_context.map_or(0, |sc| sc.size_of_excluding_self() as u64),
+ size: stacking_context.map_or(0, |sc| sc.heap_size_of_children() as u64),
});
reports_chan.send(reports);
@@ -532,9 +530,8 @@ impl LayoutTask {
LayoutTask::return_rw_data(possibly_locked_rw_data, rw_data);
}
- let unregister_msg =
- MemoryProfilerMsg::UnregisterMemoryReporter(self.memory_reporter_name.clone());
- self.memory_profiler_chan.send(unregister_msg);
+ let msg = mem::ProfilerMsg::UnregisterReporter(self.reporter_name.clone());
+ self.mem_profiler_chan.send(msg);
self.paint_chan.send(PaintMsg::Exit(Some(response_chan), exit_type));
response_port.recv().unwrap()
@@ -705,7 +702,7 @@ impl LayoutTask {
shared_layout_context: &mut SharedLayoutContext,
rw_data: &mut RWGuard<'a>) {
let writing_mode = flow::base(&**layout_root).writing_mode;
- profile(TimeProfilerCategory::LayoutDispListBuild,
+ profile(time::ProfilerCategory::LayoutDispListBuild,
self.profiler_metadata(data),
self.time_profiler_chan.clone(),
|| {
@@ -814,7 +811,7 @@ impl LayoutTask {
LayoutJS::from_trusted_node_address(data.document_root)
};
let node: &mut LayoutNode = unsafe {
- mem::transmute(&mut node)
+ transmute(&mut node)
};
debug!("layout: received layout request for: {}", data.url.serialize());
@@ -874,7 +871,7 @@ impl LayoutTask {
node,
&data.url);
- let mut layout_root = profile(TimeProfilerCategory::LayoutStyleRecalc,
+ let mut layout_root = profile(time::ProfilerCategory::LayoutStyleRecalc,
self.profiler_metadata(data),
self.time_profiler_chan.clone(),
|| {
@@ -892,7 +889,7 @@ impl LayoutTask {
self.get_layout_root((*node).clone())
});
- profile(TimeProfilerCategory::LayoutRestyleDamagePropagation,
+ profile(time::ProfilerCategory::LayoutRestyleDamagePropagation,
self.profiler_metadata(data),
self.time_profiler_chan.clone(),
|| {
@@ -912,7 +909,7 @@ impl LayoutTask {
}
// Resolve generated content.
- profile(TimeProfilerCategory::LayoutGeneratedContent,
+ profile(time::ProfilerCategory::LayoutGeneratedContent,
self.profiler_metadata(data),
self.time_profiler_chan.clone(),
|| {
@@ -921,7 +918,7 @@ impl LayoutTask {
// Perform the primary layout passes over the flow tree to compute the locations of all
// the boxes.
- profile(TimeProfilerCategory::LayoutMain,
+ profile(time::ProfilerCategory::LayoutMain,
self.profiler_metadata(data),
self.time_profiler_chan.clone(),
|| {
@@ -1024,7 +1021,7 @@ impl LayoutTask {
/// Handles a message to destroy layout data. Layout data must be destroyed on *this* task
/// because the struct type is transmuted to a different type on the script side.
unsafe fn handle_reap_layout_data(&self, layout_data: LayoutData) {
- let layout_data_wrapper: LayoutDataWrapper = mem::transmute(layout_data);
+ let layout_data_wrapper: LayoutDataWrapper = transmute(layout_data);
layout_data_wrapper.remove_compositor_layers(self.constellation_chan.clone());
}
diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs
index e0effe6e6fc..74d17d390be 100644
--- a/components/layout/parallel.rs
+++ b/components/layout/parallel.rs
@@ -20,7 +20,7 @@ use wrapper::{layout_node_to_unsafe_layout_node, layout_node_from_unsafe_layout_
use wrapper::{PostorderNodeMutTraversal, UnsafeLayoutNode};
use wrapper::{PreorderDomTraversal, PostorderDomTraversal};
-use profile::time::{TimeProfilerCategory, ProfilerMetadata, TimeProfilerChan, profile};
+use profile::time::{self, ProfilerCategory, ProfilerMetadata, profile};
use std::mem;
use std::ptr;
use std::sync::atomic::{AtomicIsize, Ordering};
@@ -430,7 +430,7 @@ pub fn traverse_dom_preorder(root: LayoutNode,
pub fn traverse_flow_tree_preorder(root: &mut FlowRef,
profiler_metadata: ProfilerMetadata,
- time_profiler_chan: TimeProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
shared_layout_context: &SharedLayoutContext,
queue: &mut WorkQueue<SharedLayoutContextWrapper,UnsafeFlow>) {
if opts::get().bubble_inline_sizes_separately {
@@ -441,7 +441,7 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef,
queue.data = SharedLayoutContextWrapper(shared_layout_context as *const _);
- profile(TimeProfilerCategory::LayoutParallelWarmup, profiler_metadata,
+ profile(time::ProfilerCategory::LayoutParallelWarmup, profiler_metadata,
time_profiler_chan, || {
queue.push(WorkUnit {
fun: assign_inline_sizes,
@@ -456,12 +456,12 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef,
pub fn build_display_list_for_subtree(root: &mut FlowRef,
profiler_metadata: ProfilerMetadata,
- time_profiler_chan: TimeProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
shared_layout_context: &SharedLayoutContext,
queue: &mut WorkQueue<SharedLayoutContextWrapper,UnsafeFlow>) {
queue.data = SharedLayoutContextWrapper(shared_layout_context as *const _);
- profile(TimeProfilerCategory::LayoutParallelWarmup, profiler_metadata,
+ profile(time::ProfilerCategory::LayoutParallelWarmup, profiler_metadata,
time_profiler_chan, || {
queue.push(WorkUnit {
fun: compute_absolute_positions,
diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs
index f8b9c3f263f..966d940d4cb 100644
--- a/components/layout_traits/lib.rs
+++ b/components/layout_traits/lib.rs
@@ -20,8 +20,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 profile::mem::MemoryProfilerChan;
-use profile::time::TimeProfilerChan;
+use profile::mem;
+use profile::time;
use script_traits::{ScriptControlChan, OpaqueScriptLayoutChannel};
use std::sync::mpsc::{Sender, Receiver};
use url::Url;
@@ -50,7 +50,7 @@ pub trait LayoutTaskFactory {
resource_task: ResourceTask,
img_cache_task: ImageCacheTask,
font_cache_task: FontCacheTask,
- time_profiler_chan: TimeProfilerChan,
- memory_profiler_chan: MemoryProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
+ mem_profiler_chan: mem::ProfilerChan,
shutdown_chan: Sender<()>);
}
diff --git a/components/net/image_cache_task.rs b/components/net/image_cache_task.rs
index 43a0d085507..4719a305485 100644
--- a/components/net/image_cache_task.rs
+++ b/components/net/image_cache_task.rs
@@ -7,7 +7,7 @@ use resource_task;
use resource_task::{LoadData, ResourceTask};
use resource_task::ProgressMsg::{Payload, Done};
-use profile::time::{self, profile, TimeProfilerChan};
+use profile::time::{self, profile};
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::collections::hash_map::Entry::{Occupied, Vacant};
@@ -75,7 +75,7 @@ pub struct ImageCacheTask {
impl ImageCacheTask {
pub fn new(resource_task: ResourceTask, task_pool: TaskPool,
- time_profiler_chan: TimeProfilerChan) -> ImageCacheTask {
+ time_profiler_chan: time::ProfilerChan) -> ImageCacheTask {
let (chan, port) = channel();
let chan_clone = chan.clone();
@@ -99,7 +99,7 @@ impl ImageCacheTask {
}
pub fn new_sync(resource_task: ResourceTask, task_pool: TaskPool,
- time_profiler_chan: TimeProfilerChan) -> ImageCacheTask {
+ time_profiler_chan: time::ProfilerChan) -> ImageCacheTask {
let (chan, port) = channel();
spawn_named("ImageCacheTask (sync)".to_owned(), move || {
@@ -141,7 +141,7 @@ struct ImageCache {
wait_map: HashMap<Url, Arc<Mutex<Vec<Sender<ImageResponseMsg>>>>>,
need_exit: Option<Sender<()>>,
task_pool: TaskPool,
- time_profiler_chan: TimeProfilerChan,
+ time_profiler_chan: time::ProfilerChan,
}
#[derive(Clone)]
@@ -314,7 +314,7 @@ impl ImageCache {
self.task_pool.execute(move || {
let url = url_clone;
debug!("image_cache_task: started image decode for {}", url.serialize());
- let image = profile(time::TimeProfilerCategory::ImageDecoding,
+ let image = profile(time::ProfilerCategory::ImageDecoding,
None, time_profiler_chan, || {
load_from_memory(&data)
});
@@ -495,7 +495,7 @@ mod tests {
use resource_task::ProgressMsg::{Payload, Done};
use sniffer_task;
use image::base::test_image_bin;
- use profile::time::{TimeProfiler, TimeProfilerChan};
+ use profile::time;
use std::sync::mpsc::{Sender, channel, Receiver};
use url::Url;
use util::taskpool::TaskPool;
@@ -587,8 +587,8 @@ mod tests {
})
}
- fn profiler() -> TimeProfilerChan {
- TimeProfiler::create(None)
+ fn profiler() -> time::ProfilerChan {
+ time::Profiler::create(None)
}
#[test]
diff --git a/components/profile/mem.rs b/components/profile/mem.rs
index 163a255659d..b6944b4ef59 100644
--- a/components/profile/mem.rs
+++ b/components/profile/mem.rs
@@ -4,7 +4,7 @@
//! Memory profiling functions.
-use self::system_reporter::SystemMemoryReporter;
+use self::system_reporter::SystemReporter;
use std::borrow::ToOwned;
use std::cmp::Ordering;
use std::collections::HashMap;
@@ -14,11 +14,11 @@ use std::time::duration::Duration;
use util::task::spawn_named;
#[derive(Clone)]
-pub struct MemoryProfilerChan(pub Sender<MemoryProfilerMsg>);
+pub struct ProfilerChan(pub Sender<ProfilerMsg>);
-impl MemoryProfilerChan {
- pub fn send(&self, msg: MemoryProfilerMsg) {
- let MemoryProfilerChan(ref c) = *self;
+impl ProfilerChan {
+ pub fn send(&self, msg: ProfilerMsg) {
+ let ProfilerChan(ref c) = *self;
c.send(msg).unwrap();
}
}
@@ -32,7 +32,7 @@ macro_rules! path {
}}
}
-pub struct MemoryReport {
+pub struct Report {
/// The identifying path for this report.
pub path: Vec<String>,
@@ -42,36 +42,36 @@ pub struct MemoryReport {
/// A channel through which memory reports can be sent.
#[derive(Clone)]
-pub struct MemoryReportsChan(pub Sender<Vec<MemoryReport>>);
+pub struct ReportsChan(pub Sender<Vec<Report>>);
-impl MemoryReportsChan {
- pub fn send(&self, report: Vec<MemoryReport>) {
- let MemoryReportsChan(ref c) = *self;
+impl ReportsChan {
+ pub fn send(&self, report: Vec<Report>) {
+ let ReportsChan(ref c) = *self;
c.send(report).unwrap();
}
}
/// A memory reporter is capable of measuring some data structure of interest. Because it needs
-/// to be passed to and registered with the MemoryProfiler, it's typically a "small" (i.e. easily
+/// to be passed to and registered with the Profiler, it's typically a "small" (i.e. easily
/// cloneable) value that provides access to a "large" data structure, e.g. a channel that can
/// inject a request for measurements into the event queue associated with the "large" data
/// structure.
-pub trait MemoryReporter {
+pub trait Reporter {
/// Collect one or more memory reports. Returns true on success, and false on failure.
- fn collect_reports(&self, reports_chan: MemoryReportsChan) -> bool;
+ fn collect_reports(&self, reports_chan: ReportsChan) -> bool;
}
/// Messages that can be sent to the memory profiler thread.
-pub enum MemoryProfilerMsg {
- /// Register a MemoryReporter with the memory profiler. The String is only used to identify the
+pub enum ProfilerMsg {
+ /// Register a Reporter with the memory profiler. The String is only used to identify the
/// reporter so it can be unregistered later. The String must be distinct from that used by any
/// other registered reporter otherwise a panic will occur.
- RegisterMemoryReporter(String, Box<MemoryReporter + Send>),
+ RegisterReporter(String, Box<Reporter + Send>),
- /// Unregister a MemoryReporter with the memory profiler. The String must match the name given
- /// when the reporter was registered. If the String does not match the name of a registered
- /// reporter a panic will occur.
- UnregisterMemoryReporter(String),
+ /// Unregister a Reporter with the memory profiler. The String must match the name given when
+ /// the reporter was registered. If the String does not match the name of a registered reporter
+ /// a panic will occur.
+ UnregisterReporter(String),
/// Triggers printing of the memory profiling metrics.
Print,
@@ -80,16 +80,16 @@ pub enum MemoryProfilerMsg {
Exit,
}
-pub struct MemoryProfiler {
+pub struct Profiler {
/// The port through which messages are received.
- pub port: Receiver<MemoryProfilerMsg>,
+ pub port: Receiver<ProfilerMsg>,
/// Registered memory reporters.
- reporters: HashMap<String, Box<MemoryReporter + Send>>,
+ reporters: HashMap<String, Box<Reporter + Send>>,
}
-impl MemoryProfiler {
- pub fn create(period: Option<f64>) -> MemoryProfilerChan {
+impl Profiler {
+ pub fn create(period: Option<f64>) -> ProfilerChan {
let (chan, port) = channel();
// Create the timer thread if a period was provided.
@@ -99,7 +99,7 @@ impl MemoryProfiler {
spawn_named("Memory profiler timer".to_owned(), move || {
loop {
sleep(period_ms);
- if chan.send(MemoryProfilerMsg::Print).is_err() {
+ if chan.send(ProfilerMsg::Print).is_err() {
break;
}
}
@@ -109,24 +109,23 @@ impl MemoryProfiler {
// Always spawn the memory profiler. If there is no timer thread it won't receive regular
// `Print` events, but it will still receive the other events.
spawn_named("Memory profiler".to_owned(), move || {
- let mut memory_profiler = MemoryProfiler::new(port);
- memory_profiler.start();
+ let mut mem_profiler = Profiler::new(port);
+ mem_profiler.start();
});
- let memory_profiler_chan = MemoryProfilerChan(chan);
+ let mem_profiler_chan = ProfilerChan(chan);
// Register the system memory reporter, which will run on the memory profiler's own thread.
// It never needs to be unregistered, because as long as the memory profiler is running the
// system memory reporter can make measurements.
- let system_reporter = Box::new(SystemMemoryReporter);
- memory_profiler_chan.send(MemoryProfilerMsg::RegisterMemoryReporter("system".to_owned(),
- system_reporter));
+ let system_reporter = Box::new(SystemReporter);
+ mem_profiler_chan.send(ProfilerMsg::RegisterReporter("system".to_owned(), system_reporter));
- memory_profiler_chan
+ mem_profiler_chan
}
- pub fn new(port: Receiver<MemoryProfilerMsg>) -> MemoryProfiler {
- MemoryProfiler {
+ pub fn new(port: Receiver<ProfilerMsg>) -> Profiler {
+ Profiler {
port: port,
reporters: HashMap::new(),
}
@@ -145,34 +144,33 @@ impl MemoryProfiler {
}
}
- fn handle_msg(&mut self, msg: MemoryProfilerMsg) -> bool {
+ fn handle_msg(&mut self, msg: ProfilerMsg) -> bool {
match msg {
- MemoryProfilerMsg::RegisterMemoryReporter(name, reporter) => {
+ ProfilerMsg::RegisterReporter(name, reporter) => {
// Panic if it has already been registered.
let name_clone = name.clone();
match self.reporters.insert(name, reporter) {
None => true,
- Some(_) =>
- panic!(format!("RegisterMemoryReporter: '{}' name is already in use",
- name_clone)),
+ Some(_) => panic!(format!("RegisterReporter: '{}' name is already in use",
+ name_clone)),
}
},
- MemoryProfilerMsg::UnregisterMemoryReporter(name) => {
+ ProfilerMsg::UnregisterReporter(name) => {
// Panic if it hasn't previously been registered.
match self.reporters.remove(&name) {
Some(_) => true,
None =>
- panic!(format!("UnregisterMemoryReporter: '{}' name is unknown", &name)),
+ panic!(format!("UnregisterReporter: '{}' name is unknown", &name)),
}
},
- MemoryProfilerMsg::Print => {
+ ProfilerMsg::Print => {
self.handle_print_msg();
true
},
- MemoryProfilerMsg::Exit => false
+ ProfilerMsg::Exit => false
}
}
@@ -189,7 +187,7 @@ impl MemoryProfiler {
let mut forest = ReportsForest::new();
for reporter in self.reporters.values() {
let (chan, port) = channel();
- if reporter.collect_reports(MemoryReportsChan(chan)) {
+ if reporter.collect_reports(ReportsChan(chan)) {
if let Ok(reports) = port.recv() {
for report in reports.iter() {
forest.insert(&report.path, report.size);
@@ -368,20 +366,20 @@ mod system_reporter {
use std::ffi::CString;
use std::mem::size_of;
use std::ptr::null_mut;
- use super::{MemoryReport, MemoryReporter, MemoryReportsChan};
+ use super::{Report, Reporter, ReportsChan};
#[cfg(target_os="macos")]
use task_info::task_basic_info::{virtual_size, resident_size};
/// Collects global measurements from the OS and heap allocators.
- pub struct SystemMemoryReporter;
+ pub struct SystemReporter;
- impl MemoryReporter for SystemMemoryReporter {
- fn collect_reports(&self, reports_chan: MemoryReportsChan) -> bool {
+ impl Reporter for SystemReporter {
+ fn collect_reports(&self, reports_chan: ReportsChan) -> bool {
let mut reports = vec![];
{
let mut report = |path, size| {
if let Some(size) = size {
- reports.push(MemoryReport { path: path, size: size });
+ reports.push(Report { path: path, size: size });
}
};
diff --git a/components/profile/time.rs b/components/profile/time.rs
index fcd83d8093a..8b85f4d8e7c 100644
--- a/components/profile/time.rs
+++ b/components/profile/time.rs
@@ -19,11 +19,11 @@ use util::task::spawn_named;
// front-end representation of the profiler used to communicate with the profiler
#[derive(Clone)]
-pub struct TimeProfilerChan(pub Sender<TimeProfilerMsg>);
+pub struct ProfilerChan(pub Sender<ProfilerMsg>);
-impl TimeProfilerChan {
- pub fn send(&self, msg: TimeProfilerMsg) {
- let TimeProfilerChan(ref c) = *self;
+impl ProfilerChan {
+ pub fn send(&self, msg: ProfilerMsg) {
+ let ProfilerChan(ref c) = *self;
c.send(msg).unwrap();
}
}
@@ -35,11 +35,11 @@ pub struct TimerMetadata {
incremental: bool,
}
-pub trait Formatable {
+pub trait Formattable {
fn format(&self) -> String;
}
-impl Formatable for Option<TimerMetadata> {
+impl Formattable for Option<TimerMetadata> {
fn format(&self) -> String {
match self {
// TODO(cgaebel): Center-align in the format strings as soon as rustc supports it.
@@ -61,9 +61,9 @@ impl Formatable for Option<TimerMetadata> {
}
#[derive(Clone)]
-pub enum TimeProfilerMsg {
+pub enum ProfilerMsg {
/// Normal message used for reporting time
- Time((TimeProfilerCategory, Option<TimerMetadata>), f64),
+ Time((ProfilerCategory, Option<TimerMetadata>), f64),
/// Message used to force print the profiling metrics
Print,
/// Tells the profiler to shut down.
@@ -72,7 +72,7 @@ pub enum TimeProfilerMsg {
#[repr(u32)]
#[derive(PartialEq, Clone, PartialOrd, Eq, Ord)]
-pub enum TimeProfilerCategory {
+pub enum ProfilerCategory {
Compositing,
LayoutPerform,
LayoutStyleRecalc,
@@ -92,60 +92,60 @@ pub enum TimeProfilerCategory {
ImageDecoding,
}
-impl Formatable for TimeProfilerCategory {
+impl Formattable for ProfilerCategory {
// some categories are subcategories of LayoutPerformCategory
// and should be printed to indicate this
fn format(&self) -> String {
let padding = match *self {
- TimeProfilerCategory::LayoutStyleRecalc |
- TimeProfilerCategory::LayoutRestyleDamagePropagation |
- TimeProfilerCategory::LayoutNonIncrementalReset |
- TimeProfilerCategory::LayoutGeneratedContent |
- TimeProfilerCategory::LayoutMain |
- TimeProfilerCategory::LayoutDispListBuild |
- TimeProfilerCategory::LayoutShaping |
- TimeProfilerCategory::LayoutDamagePropagate |
- TimeProfilerCategory::PaintingPerTile |
- TimeProfilerCategory::PaintingPrepBuff => "+ ",
- TimeProfilerCategory::LayoutParallelWarmup |
- TimeProfilerCategory::LayoutSelectorMatch |
- TimeProfilerCategory::LayoutTreeBuilder => "| + ",
+ ProfilerCategory::LayoutStyleRecalc |
+ ProfilerCategory::LayoutRestyleDamagePropagation |
+ ProfilerCategory::LayoutNonIncrementalReset |
+ ProfilerCategory::LayoutGeneratedContent |
+ ProfilerCategory::LayoutMain |
+ ProfilerCategory::LayoutDispListBuild |
+ ProfilerCategory::LayoutShaping |
+ ProfilerCategory::LayoutDamagePropagate |
+ ProfilerCategory::PaintingPerTile |
+ ProfilerCategory::PaintingPrepBuff => "+ ",
+ ProfilerCategory::LayoutParallelWarmup |
+ ProfilerCategory::LayoutSelectorMatch |
+ ProfilerCategory::LayoutTreeBuilder => "| + ",
_ => ""
};
let name = match *self {
- TimeProfilerCategory::Compositing => "Compositing",
- TimeProfilerCategory::LayoutPerform => "Layout",
- TimeProfilerCategory::LayoutStyleRecalc => "Style Recalc",
- TimeProfilerCategory::LayoutRestyleDamagePropagation => "Restyle Damage Propagation",
- TimeProfilerCategory::LayoutNonIncrementalReset => "Non-incremental reset (temporary)",
- TimeProfilerCategory::LayoutSelectorMatch => "Selector Matching",
- TimeProfilerCategory::LayoutTreeBuilder => "Tree Building",
- TimeProfilerCategory::LayoutDamagePropagate => "Damage Propagation",
- TimeProfilerCategory::LayoutGeneratedContent => "Generated Content Resolution",
- TimeProfilerCategory::LayoutMain => "Primary Layout Pass",
- TimeProfilerCategory::LayoutParallelWarmup => "Parallel Warmup",
- TimeProfilerCategory::LayoutShaping => "Shaping",
- TimeProfilerCategory::LayoutDispListBuild => "Display List Construction",
- TimeProfilerCategory::PaintingPerTile => "Painting Per Tile",
- TimeProfilerCategory::PaintingPrepBuff => "Buffer Prep",
- TimeProfilerCategory::Painting => "Painting",
- TimeProfilerCategory::ImageDecoding => "Image Decoding",
+ ProfilerCategory::Compositing => "Compositing",
+ ProfilerCategory::LayoutPerform => "Layout",
+ ProfilerCategory::LayoutStyleRecalc => "Style Recalc",
+ ProfilerCategory::LayoutRestyleDamagePropagation => "Restyle Damage Propagation",
+ ProfilerCategory::LayoutNonIncrementalReset => "Non-incremental reset (temporary)",
+ ProfilerCategory::LayoutSelectorMatch => "Selector Matching",
+ ProfilerCategory::LayoutTreeBuilder => "Tree Building",
+ ProfilerCategory::LayoutDamagePropagate => "Damage Propagation",
+ ProfilerCategory::LayoutGeneratedContent => "Generated Content Resolution",
+ ProfilerCategory::LayoutMain => "Primary Layout Pass",
+ ProfilerCategory::LayoutParallelWarmup => "Parallel Warmup",
+ ProfilerCategory::LayoutShaping => "Shaping",
+ ProfilerCategory::LayoutDispListBuild => "Display List Construction",
+ ProfilerCategory::PaintingPerTile => "Painting Per Tile",
+ ProfilerCategory::PaintingPrepBuff => "Buffer Prep",
+ ProfilerCategory::Painting => "Painting",
+ ProfilerCategory::ImageDecoding => "Image Decoding",
};
format!("{}{}", padding, name)
}
}
-type TimeProfilerBuckets = BTreeMap<(TimeProfilerCategory, Option<TimerMetadata>), Vec<f64>>;
+type ProfilerBuckets = BTreeMap<(ProfilerCategory, Option<TimerMetadata>), Vec<f64>>;
// back end of the profiler that handles data aggregation and performance metrics
-pub struct TimeProfiler {
- pub port: Receiver<TimeProfilerMsg>,
- buckets: TimeProfilerBuckets,
- pub last_msg: Option<TimeProfilerMsg>,
+pub struct Profiler {
+ pub port: Receiver<ProfilerMsg>,
+ buckets: ProfilerBuckets,
+ pub last_msg: Option<ProfilerMsg>,
}
-impl TimeProfiler {
- pub fn create(period: Option<f64>) -> TimeProfilerChan {
+impl Profiler {
+ pub fn create(period: Option<f64>) -> ProfilerChan {
let (chan, port) = channel();
match period {
Some(period) => {
@@ -154,14 +154,14 @@ impl TimeProfiler {
spawn_named("Time profiler timer".to_owned(), move || {
loop {
sleep(period);
- if chan.send(TimeProfilerMsg::Print).is_err() {
+ if chan.send(ProfilerMsg::Print).is_err() {
break;
}
}
});
// Spawn the time profiler.
spawn_named("Time profiler".to_owned(), move || {
- let mut profiler = TimeProfiler::new(port);
+ let mut profiler = Profiler::new(port);
profiler.start();
});
}
@@ -170,7 +170,7 @@ impl TimeProfiler {
spawn_named("Time profiler".to_owned(), move || {
loop {
match port.recv() {
- Err(_) | Ok(TimeProfilerMsg::Exit) => break,
+ Err(_) | Ok(ProfilerMsg::Exit) => break,
_ => {}
}
}
@@ -178,11 +178,11 @@ impl TimeProfiler {
}
}
- TimeProfilerChan(chan)
+ ProfilerChan(chan)
}
- pub fn new(port: Receiver<TimeProfilerMsg>) -> TimeProfiler {
- TimeProfiler {
+ pub fn new(port: Receiver<ProfilerMsg>) -> Profiler {
+ Profiler {
port: port,
buckets: BTreeMap::new(),
last_msg: None,
@@ -203,7 +203,7 @@ impl TimeProfiler {
}
}
- fn find_or_insert(&mut self, k: (TimeProfilerCategory, Option<TimerMetadata>), t: f64) {
+ fn find_or_insert(&mut self, k: (ProfilerCategory, Option<TimerMetadata>), t: f64) {
match self.buckets.get_mut(&k) {
None => {},
Some(v) => { v.push(t); return; },
@@ -212,15 +212,15 @@ impl TimeProfiler {
self.buckets.insert(k, vec!(t));
}
- fn handle_msg(&mut self, msg: TimeProfilerMsg) -> bool {
+ fn handle_msg(&mut self, msg: ProfilerMsg) -> bool {
match msg.clone() {
- TimeProfilerMsg::Time(k, t) => self.find_or_insert(k, t),
- TimeProfilerMsg::Print => match self.last_msg {
+ ProfilerMsg::Time(k, t) => self.find_or_insert(k, t),
+ ProfilerMsg::Print => match self.last_msg {
// only print if more data has arrived since the last printout
- Some(TimeProfilerMsg::Time(..)) => self.print_buckets(),
+ Some(ProfilerMsg::Time(..)) => self.print_buckets(),
_ => ()
},
- TimeProfilerMsg::Exit => return false,
+ ProfilerMsg::Exit => return false,
};
self.last_msg = Some(msg);
true
@@ -268,9 +268,9 @@ pub enum TimerMetadataReflowType {
pub type ProfilerMetadata<'a> = Option<(&'a Url, TimerMetadataFrameType, TimerMetadataReflowType)>;
-pub fn profile<T, F>(category: TimeProfilerCategory,
+pub fn profile<T, F>(category: ProfilerCategory,
meta: ProfilerMetadata,
- time_profiler_chan: TimeProfilerChan,
+ profiler_chan: ProfilerChan,
callback: F)
-> T
where F: FnOnce() -> T
@@ -285,7 +285,7 @@ pub fn profile<T, F>(category: TimeProfilerCategory,
iframe: iframe == TimerMetadataFrameType::IFrame,
incremental: reflow_type == TimerMetadataReflowType::Incremental,
});
- time_profiler_chan.send(TimeProfilerMsg::Time((category, meta), ms));
+ profiler_chan.send(ProfilerMsg::Time((category, meta), ms));
return val;
}
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs
index b24adf944f6..e14475aa793 100644
--- a/components/script/layout_interface.rs
+++ b/components/script/layout_interface.rs
@@ -11,7 +11,7 @@ use dom::node::LayoutData;
use geom::point::Point2D;
use geom::rect::Rect;
use msg::constellation_msg::{PipelineExitType, WindowSizeData};
-use profile::mem::{MemoryReporter, MemoryReportsChan};
+use profile::mem::{Reporter, ReportsChan};
use script_traits::{ScriptControlChan, OpaqueScriptLayoutChannel, UntrustedNodeAddress};
use std::any::Any;
use std::sync::mpsc::{channel, Receiver, Sender};
@@ -47,7 +47,7 @@ pub enum Msg {
/// Requests that the layout task measure its memory usage. The resulting reports are sent back
/// via the supplied channel.
- CollectMemoryReports(MemoryReportsChan),
+ CollectReports(ReportsChan),
/// Requests that the layout task enter a quiescent state in which no more messages are
/// accepted except `ExitMsg`. A response message will be sent on the supplied channel when
@@ -66,7 +66,7 @@ pub enum Msg {
///
/// 1) read-only with respect to LayoutTaskData,
/// 2) small,
-// 3) and really needs to be fast.
+/// 3) and really needs to be fast.
pub trait LayoutRPC {
/// Requests the dimensions of the content box, as in the `getBoundingClientRect()` call.
fn content_box(&self) -> ContentBoxResponse;
@@ -133,11 +133,11 @@ impl LayoutChan {
}
}
-impl MemoryReporter for LayoutChan {
+impl Reporter for LayoutChan {
// Just injects an appropriate event into the layout task's queue.
- fn collect_reports(&self, reports_chan: MemoryReportsChan) -> bool {
+ fn collect_reports(&self, reports_chan: ReportsChan) -> bool {
let LayoutChan(ref c) = *self;
- c.send(Msg::CollectMemoryReports(reports_chan)).is_ok()
+ c.send(Msg::CollectReports(reports_chan)).is_ok()
}
}
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index bc86b6a4215..1afdbf8dca5 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -41,9 +41,9 @@ use net::storage_task::{StorageTaskFactory, StorageTask};
#[cfg(not(test))]
use gfx::font_cache_task::FontCacheTask;
#[cfg(not(test))]
-use profile::mem::MemoryProfiler;
+use profile::mem;
#[cfg(not(test))]
-use profile::time::TimeProfiler;
+use profile::time;
#[cfg(not(test))]
use util::opts;
#[cfg(not(test))]
@@ -70,8 +70,8 @@ impl Browser {
let (compositor_proxy, compositor_receiver) =
WindowMethods::create_compositor_channel(&window);
- let time_profiler_chan = TimeProfiler::create(opts.time_profiler_period);
- let memory_profiler_chan = MemoryProfiler::create(opts.memory_profiler_period);
+ let time_profiler_chan = time::Profiler::create(opts.time_profiler_period);
+ let mem_profiler_chan = mem::Profiler::create(opts.mem_profiler_period);
let devtools_chan = opts.devtools_port.map(|port| {
devtools::start_server(port)
});
@@ -100,7 +100,7 @@ impl Browser {
image_cache_task,
font_cache_task,
time_profiler_chan.clone(),
- memory_profiler_chan.clone(),
+ mem_profiler_chan.clone(),
devtools_chan,
storage_task);
@@ -124,7 +124,7 @@ impl Browser {
compositor_receiver,
constellation_chan,
time_profiler_chan,
- memory_profiler_chan);
+ mem_profiler_chan);
Browser {
compositor: compositor,
diff --git a/components/util/lib.rs b/components/util/lib.rs
index b4fa2b7a5b0..4eaf40b465f 100644
--- a/components/util/lib.rs
+++ b/components/util/lib.rs
@@ -51,7 +51,7 @@ pub mod linked_list;
pub mod fnv;
pub mod geometry;
pub mod logical_geometry;
-pub mod memory;
+pub mod mem;
pub mod namespace;
pub mod opts;
pub mod persistent_list;
diff --git a/components/util/memory.rs b/components/util/mem.rs
index 4cefce3d0e7..ad7cf6108a2 100644
--- a/components/util/memory.rs
+++ b/components/util/mem.rs
@@ -38,11 +38,11 @@ pub fn heap_size_of(ptr: *const c_void) -> usize {
// FIXME(njn): it would be nice to be able to derive this trait automatically, given that
// implementations are mostly repetitive and mechanical.
//
-pub trait SizeOf {
+pub trait HeapSizeOf {
/// Measure the size of any heap-allocated structures that hang off this value, but not the
/// space taken up by the value itself (i.e. what size_of::<T> measures, more or less); that
- /// space is handled by the implementation of SizeOf for Box<T> below.
- fn size_of_excluding_self(&self) -> usize;
+ /// space is handled by the implementation of HeapSizeOf for Box<T> below.
+ fn heap_size_of_children(&self) -> usize;
}
// There are two possible ways to measure the size of `self` when it's on the heap: compute it
@@ -60,49 +60,49 @@ pub trait SizeOf {
//
// However, in the best case, the two approaches should give the same results.
//
-impl<T: SizeOf> SizeOf for Box<T> {
- fn size_of_excluding_self(&self) -> usize {
+impl<T: HeapSizeOf> HeapSizeOf for Box<T> {
+ fn heap_size_of_children(&self) -> usize {
// Measure size of `self`.
- heap_size_of(&**self as *const T as *const c_void) + (**self).size_of_excluding_self()
+ heap_size_of(&**self as *const T as *const c_void) + (**self).heap_size_of_children()
}
}
-impl SizeOf for String {
- fn size_of_excluding_self(&self) -> usize {
+impl HeapSizeOf for String {
+ fn heap_size_of_children(&self) -> usize {
heap_size_of(self.as_ptr() as *const c_void)
}
}
-impl<T: SizeOf> SizeOf for Option<T> {
- fn size_of_excluding_self(&self) -> usize {
+impl<T: HeapSizeOf> HeapSizeOf for Option<T> {
+ fn heap_size_of_children(&self) -> usize {
match *self {
None => 0,
- Some(ref x) => x.size_of_excluding_self()
+ Some(ref x) => x.heap_size_of_children()
}
}
}
-impl<T: SizeOf> SizeOf for Arc<T> {
- fn size_of_excluding_self(&self) -> usize {
- (**self).size_of_excluding_self()
+impl<T: HeapSizeOf> HeapSizeOf for Arc<T> {
+ fn heap_size_of_children(&self) -> usize {
+ (**self).heap_size_of_children()
}
}
-impl<T: SizeOf> SizeOf for Vec<T> {
- fn size_of_excluding_self(&self) -> usize {
+impl<T: HeapSizeOf> HeapSizeOf for Vec<T> {
+ fn heap_size_of_children(&self) -> usize {
heap_size_of(self.as_ptr() as *const c_void) +
- self.iter().fold(0, |n, elem| n + elem.size_of_excluding_self())
+ self.iter().fold(0, |n, elem| n + elem.heap_size_of_children())
}
}
-// FIXME(njn): We can't implement SizeOf accurately for LinkedList because it requires access to the
-// private Node type. Eventually we'll want to add SizeOf (or equivalent) to Rust itself. In the
-// meantime, we use the dirty hack of transmuting LinkedList into an identical type (LinkedList2) and
-// measuring that.
-impl<T: SizeOf> SizeOf for LinkedList<T> {
- fn size_of_excluding_self(&self) -> usize {
+// FIXME(njn): We can't implement HeapSizeOf accurately for LinkedList because it requires access
+// to the private Node type. Eventually we'll want to add HeapSizeOf (or equivalent) to Rust
+// itself. In the meantime, we use the dirty hack of transmuting LinkedList into an identical type
+// (LinkedList2) and measuring that.
+impl<T: HeapSizeOf> HeapSizeOf for LinkedList<T> {
+ fn heap_size_of_children(&self) -> usize {
let list2: &LinkedList2<T> = unsafe { transmute(self) };
- list2.size_of_excluding_self()
+ list2.heap_size_of_children()
}
}
@@ -124,21 +124,21 @@ struct Node<T> {
value: T,
}
-impl<T: SizeOf> SizeOf for Node<T> {
- // Unlike most size_of_excluding_self() functions, this one does *not* measure descendents.
- // Instead, LinkedList2<T>::size_of_excluding_self() handles that, so that it can use iteration
+impl<T: HeapSizeOf> HeapSizeOf for Node<T> {
+ // Unlike most heap_size_of_children() functions, this one does *not* measure descendents.
+ // Instead, LinkedList2<T>::heap_size_of_children() handles that, so that it can use iteration
// instead of recursion, which avoids potentially blowing the stack.
- fn size_of_excluding_self(&self) -> usize {
- self.value.size_of_excluding_self()
+ fn heap_size_of_children(&self) -> usize {
+ self.value.heap_size_of_children()
}
}
-impl<T: SizeOf> SizeOf for LinkedList2<T> {
- fn size_of_excluding_self(&self) -> usize {
+impl<T: HeapSizeOf> HeapSizeOf for LinkedList2<T> {
+ fn heap_size_of_children(&self) -> usize {
let mut size = 0;
let mut curr: &Link<T> = &self.list_head;
while curr.is_some() {
- size += (*curr).size_of_excluding_self();
+ size += (*curr).heap_size_of_children();
curr = &curr.as_ref().unwrap().next;
}
size
diff --git a/components/util/opts.rs b/components/util/opts.rs
index 24b945dfcf7..25bd06e61f4 100644
--- a/components/util/opts.rs
+++ b/components/util/opts.rs
@@ -47,7 +47,7 @@ pub struct Opts {
/// `None` to disable the memory profiler or `Some` with an interval in seconds to enable it
/// and cause it to produce output on that interval (`-m`).
- pub memory_profiler_period: Option<f64>,
+ pub mem_profiler_period: Option<f64>,
/// Enable experimental web features (`-e`).
pub enable_experimental: bool,
@@ -176,7 +176,7 @@ pub fn default_opts() -> Opts {
tile_size: 512,
device_pixels_per_px: None,
time_profiler_period: None,
- memory_profiler_period: None,
+ mem_profiler_period: None,
enable_experimental: false,
layout_threads: 1,
nonincremental_layout: false,
@@ -286,7 +286,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
let time_profiler_period = opt_match.opt_default("p", "5").map(|period| {
period.parse().unwrap()
});
- let memory_profiler_period = opt_match.opt_default("m", "5").map(|period| {
+ let mem_profiler_period = opt_match.opt_default("m", "5").map(|period| {
period.parse().unwrap()
});
@@ -330,7 +330,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
tile_size: tile_size,
device_pixels_per_px: device_pixels_per_px,
time_profiler_period: time_profiler_period,
- memory_profiler_period: memory_profiler_period,
+ mem_profiler_period: mem_profiler_period,
enable_experimental: opt_match.opt_present("e"),
layout_threads: layout_threads,
nonincremental_layout: nonincremental_layout,