Skip to content

Commit

Permalink
Rename lots of profiling-related things.
Browse files Browse the repository at this point in the history
------------------------------------------------------------------------
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.
  • Loading branch information
nnethercote committed Mar 25, 2015
1 parent 7f587f6 commit ce36e57
Show file tree
Hide file tree
Showing 19 changed files with 322 additions and 331 deletions.
26 changes: 12 additions & 14 deletions components/compositing/compositor.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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>>,
Expand Down Expand Up @@ -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.
//
Expand Down Expand Up @@ -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,
Expand All @@ -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();
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
}

Expand Down
12 changes: 6 additions & 6 deletions components/compositing/compositor_task.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand All @@ -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>
}
}
Expand Down
16 changes: 8 additions & 8 deletions components/compositing/constellation.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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)>,

Expand Down Expand Up @@ -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 {
Expand All @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 10 additions & 12 deletions components/compositing/headless.rs
Expand Up @@ -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.
///
Expand All @@ -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.
{
Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions components/compositing/pipeline.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

9 comments on commit ce36e57

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from jdm
at nnethercote@ce36e57

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging nnethercote/servo/profiler-renaming = ce36e57 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nnethercote/servo/profiler-renaming = ce36e57 merged ok, testing candidate = 6cf273d

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from jdm
at nnethercote@ce36e57

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging nnethercote/servo/profiler-renaming = ce36e57 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nnethercote/servo/profiler-renaming = ce36e57 merged ok, testing candidate = d784d9c

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = d784d9c

Please sign in to comment.