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.
This commit is contained in:
Nicholas Nethercote 2015-03-22 15:20:31 -07:00
parent 7f587f6cb5
commit ce36e574f4
19 changed files with 322 additions and 331 deletions

View file

@ -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();
}

View file

@ -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>
}
}

View file

@ -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,

View file

@ -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 {

View file

@ -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,