Rename TimeProfilerCategory variants.

This commit is contained in:
Ms2ger 2015-01-04 11:31:51 +01:00
parent d3e226239e
commit 4d47817bae
5 changed files with 53 additions and 51 deletions

View file

@ -38,7 +38,7 @@ use servo_msg::constellation_msg::{PipelineId, WindowSizeData};
use servo_util::geometry::{PagePx, ScreenPx, ViewportPx}; use servo_util::geometry::{PagePx, ScreenPx, ViewportPx};
use servo_util::memory::MemoryProfilerChan; use servo_util::memory::MemoryProfilerChan;
use servo_util::opts; use servo_util::opts;
use servo_util::time::{profile, TimeProfilerChan}; use servo_util::time::{TimeProfilerCategory, profile, TimeProfilerChan};
use servo_util::{memory, time}; use servo_util::{memory, time};
use std::collections::HashMap; use std::collections::HashMap;
use std::collections::hash_map::{Occupied, Vacant}; use std::collections::hash_map::{Occupied, Vacant};
@ -1074,7 +1074,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
gl::bind_texture(gl::TEXTURE_2D, 0); gl::bind_texture(gl::TEXTURE_2D, 0);
} }
profile(time::CompositingCategory, None, self.time_profiler_chan.clone(), || { profile(TimeProfilerCategory::Compositing, None, self.time_profiler_chan.clone(), || {
debug!("compositor: compositing"); debug!("compositor: compositing");
// Adjust the layer dimensions as necessary to correspond to the size of the window. // Adjust the layer dimensions as necessary to correspond to the size of the window.
self.scene.viewport = Rect { self.scene.viewport = Rect {

View file

@ -32,8 +32,7 @@ use servo_util::opts;
use servo_util::smallvec::SmallVec; use servo_util::smallvec::SmallVec;
use servo_util::task::spawn_named_with_send_on_failure; use servo_util::task::spawn_named_with_send_on_failure;
use servo_util::task_state; use servo_util::task_state;
use servo_util::time::{TimeProfilerChan, profile}; use servo_util::time::{TimeProfilerChan, TimeProfilerCategory, profile};
use servo_util::time;
use std::comm::{Receiver, Sender, channel}; use std::comm::{Receiver, Sender, channel};
use std::mem; use std::mem;
use std::task::TaskBuilder; use std::task::TaskBuilder;
@ -384,7 +383,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
mut tiles: Vec<BufferRequest>, mut tiles: Vec<BufferRequest>,
scale: f32, scale: f32,
layer_id: LayerId) { layer_id: LayerId) {
time::profile(time::PaintingCategory, None, self.time_profiler_chan.clone(), || { profile(TimeProfilerCategory::Painting, None, self.time_profiler_chan.clone(), || {
// Bail out if there is no appropriate stacking context. // Bail out if there is no appropriate stacking context.
let stacking_context = match self.root_stacking_context { let stacking_context = match self.root_stacking_context {
Some(ref stacking_context) => { Some(ref stacking_context) => {
@ -560,7 +559,8 @@ impl WorkerThread {
paint_context.clear(); paint_context.clear();
// Draw the display list. // Draw the display list.
profile(time::PaintingPerTileCategory, None, self.time_profiler_sender.clone(), || { profile(TimeProfilerCategory::PaintingPerTile, None,
self.time_profiler_sender.clone(), || {
stacking_context.optimize_and_draw_into_context(&mut paint_context, stacking_context.optimize_and_draw_into_context(&mut paint_context,
&tile.page_rect, &tile.page_rect,
&matrix, &matrix,

View file

@ -56,7 +56,7 @@ use servo_util::opts;
use servo_util::smallvec::{SmallVec, SmallVec1, VecLike}; use servo_util::smallvec::{SmallVec, SmallVec1, VecLike};
use servo_util::task::spawn_named_with_send_on_failure; use servo_util::task::spawn_named_with_send_on_failure;
use servo_util::task_state; use servo_util::task_state;
use servo_util::time::{mod, ProfilerMetadata, TimeProfilerChan, TimerMetadataFrameType}; use servo_util::time::{TimeProfilerCategory, ProfilerMetadata, TimeProfilerChan, TimerMetadataFrameType};
use servo_util::time::{TimerMetadataReflowType, profile}; use servo_util::time::{TimerMetadataReflowType, profile};
use servo_util::workqueue::WorkQueue; use servo_util::workqueue::WorkQueue;
use std::cell::Cell; use std::cell::Cell;
@ -398,7 +398,7 @@ impl LayoutTask {
Box<LayoutRPC + Send>); Box<LayoutRPC + Send>);
}, },
Msg::Reflow(data) => { Msg::Reflow(data) => {
profile(time::LayoutPerformCategory, profile(TimeProfilerCategory::LayoutPerform,
self.profiler_metadata(&*data), self.profiler_metadata(&*data),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
|| self.handle_reflow(&*data, possibly_locked_rw_data)); || self.handle_reflow(&*data, possibly_locked_rw_data));
@ -627,7 +627,7 @@ impl LayoutTask {
shared_layout_context: &mut SharedLayoutContext, shared_layout_context: &mut SharedLayoutContext,
rw_data: &mut RWGuard<'a>) { rw_data: &mut RWGuard<'a>) {
let writing_mode = flow::base(&**layout_root).writing_mode; let writing_mode = flow::base(&**layout_root).writing_mode;
profile(time::LayoutDispListBuildCategory, profile(TimeProfilerCategory::LayoutDispListBuild,
self.profiler_metadata(data), self.profiler_metadata(data),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
|| { || {
@ -771,7 +771,7 @@ impl LayoutTask {
|mut flow| LayoutTask::reflow_all_nodes(flow.deref_mut())); |mut flow| LayoutTask::reflow_all_nodes(flow.deref_mut()));
} }
let mut layout_root = profile(time::LayoutStyleRecalcCategory, let mut layout_root = profile(TimeProfilerCategory::LayoutStyleRecalc,
self.profiler_metadata(data), self.profiler_metadata(data),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
|| { || {
@ -789,7 +789,7 @@ impl LayoutTask {
self.get_layout_root((*node).clone()) self.get_layout_root((*node).clone())
}); });
profile(time::LayoutRestyleDamagePropagation, profile(TimeProfilerCategory::LayoutRestyleDamagePropagation,
self.profiler_metadata(data), self.profiler_metadata(data),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
|| { || {
@ -811,7 +811,7 @@ impl LayoutTask {
// Perform the primary layout passes over the flow tree to compute the locations of all // Perform the primary layout passes over the flow tree to compute the locations of all
// the boxes. // the boxes.
profile(time::LayoutMainCategory, profile(TimeProfilerCategory::LayoutMain,
self.profiler_metadata(data), self.profiler_metadata(data),
self.time_profiler_chan.clone(), self.time_profiler_chan.clone(),
|| { || {

View file

@ -19,7 +19,7 @@ use wrapper::{PostorderNodeMutTraversal, UnsafeLayoutNode};
use wrapper::{PreorderDomTraversal, PostorderDomTraversal}; use wrapper::{PreorderDomTraversal, PostorderDomTraversal};
use servo_util::opts; use servo_util::opts;
use servo_util::time::{mod, ProfilerMetadata, TimeProfilerChan, profile}; use servo_util::time::{TimeProfilerCategory, ProfilerMetadata, TimeProfilerChan, profile};
use servo_util::workqueue::{WorkQueue, WorkUnit, WorkerProxy}; use servo_util::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
use std::mem; use std::mem;
use std::ptr; use std::ptr;
@ -432,7 +432,8 @@ pub fn traverse_flow_tree_preorder(root: &mut FlowRef,
queue.data = shared_layout_context as *const _; queue.data = shared_layout_context as *const _;
profile(time::LayoutParallelWarmupCategory, profiler_metadata, time_profiler_chan, || { profile(TimeProfilerCategory::LayoutParallelWarmup, profiler_metadata,
time_profiler_chan, || {
queue.push(WorkUnit { queue.push(WorkUnit {
fun: assign_inline_sizes, fun: assign_inline_sizes,
data: mut_owned_flow_to_unsafe_flow(root), data: mut_owned_flow_to_unsafe_flow(root),
@ -451,7 +452,8 @@ pub fn build_display_list_for_subtree(root: &mut FlowRef,
queue: &mut WorkQueue<*const SharedLayoutContext,UnsafeFlow>) { queue: &mut WorkQueue<*const SharedLayoutContext,UnsafeFlow>) {
queue.data = shared_layout_context as *const _; queue.data = shared_layout_context as *const _;
profile(time::LayoutParallelWarmupCategory, profiler_metadata, time_profiler_chan, || { profile(TimeProfilerCategory::LayoutParallelWarmup, profiler_metadata,
time_profiler_chan, || {
queue.push(WorkUnit { queue.push(WorkUnit {
fun: compute_absolute_positions, fun: compute_absolute_positions,
data: mut_owned_flow_to_unsafe_flow(root), data: mut_owned_flow_to_unsafe_flow(root),

View file

@ -71,21 +71,21 @@ pub enum TimeProfilerMsg {
#[repr(u32)] #[repr(u32)]
#[deriving(PartialEq, Clone, PartialOrd, Eq, Ord)] #[deriving(PartialEq, Clone, PartialOrd, Eq, Ord)]
pub enum TimeProfilerCategory { pub enum TimeProfilerCategory {
CompositingCategory, Compositing,
LayoutPerformCategory, LayoutPerform,
LayoutStyleRecalcCategory, LayoutStyleRecalc,
LayoutRestyleDamagePropagation, LayoutRestyleDamagePropagation,
LayoutNonIncrementalReset, LayoutNonIncrementalReset,
LayoutSelectorMatchCategory, LayoutSelectorMatch,
LayoutTreeBuilderCategory, LayoutTreeBuilder,
LayoutDamagePropagateCategory, LayoutDamagePropagate,
LayoutMainCategory, LayoutMain,
LayoutParallelWarmupCategory, LayoutParallelWarmup,
LayoutShapingCategory, LayoutShaping,
LayoutDispListBuildCategory, LayoutDispListBuild,
PaintingPerTileCategory, PaintingPerTile,
PaintingPrepBuffCategory, PaintingPrepBuff,
PaintingCategory, Painting,
} }
impl Formatable for TimeProfilerCategory { impl Formatable for TimeProfilerCategory {
@ -93,36 +93,36 @@ impl Formatable for TimeProfilerCategory {
// and should be printed to indicate this // and should be printed to indicate this
fn format(&self) -> String { fn format(&self) -> String {
let padding = match *self { let padding = match *self {
TimeProfilerCategory::LayoutStyleRecalcCategory | TimeProfilerCategory::LayoutStyleRecalc |
TimeProfilerCategory::LayoutRestyleDamagePropagation | TimeProfilerCategory::LayoutRestyleDamagePropagation |
TimeProfilerCategory::LayoutNonIncrementalReset | TimeProfilerCategory::LayoutNonIncrementalReset |
TimeProfilerCategory::LayoutMainCategory | TimeProfilerCategory::LayoutMain |
TimeProfilerCategory::LayoutDispListBuildCategory | TimeProfilerCategory::LayoutDispListBuild |
TimeProfilerCategory::LayoutShapingCategory | TimeProfilerCategory::LayoutShaping |
TimeProfilerCategory::LayoutDamagePropagateCategory | TimeProfilerCategory::LayoutDamagePropagate |
TimeProfilerCategory::PaintingPerTileCategory | TimeProfilerCategory::PaintingPerTile |
TimeProfilerCategory::PaintingPrepBuffCategory => "+ ", TimeProfilerCategory::PaintingPrepBuff => "+ ",
TimeProfilerCategory::LayoutParallelWarmupCategory | TimeProfilerCategory::LayoutParallelWarmup |
TimeProfilerCategory::LayoutSelectorMatchCategory | TimeProfilerCategory::LayoutSelectorMatch |
TimeProfilerCategory::LayoutTreeBuilderCategory => "| + ", TimeProfilerCategory::LayoutTreeBuilder => "| + ",
_ => "" _ => ""
}; };
let name = match *self { let name = match *self {
TimeProfilerCategory::CompositingCategory => "Compositing", TimeProfilerCategory::Compositing => "Compositing",
TimeProfilerCategory::LayoutPerformCategory => "Layout", TimeProfilerCategory::LayoutPerform => "Layout",
TimeProfilerCategory::LayoutStyleRecalcCategory => "Style Recalc", TimeProfilerCategory::LayoutStyleRecalc => "Style Recalc",
TimeProfilerCategory::LayoutRestyleDamagePropagation => "Restyle Damage Propagation", TimeProfilerCategory::LayoutRestyleDamagePropagation => "Restyle Damage Propagation",
TimeProfilerCategory::LayoutNonIncrementalReset => "Non-incremental reset (temporary)", TimeProfilerCategory::LayoutNonIncrementalReset => "Non-incremental reset (temporary)",
TimeProfilerCategory::LayoutSelectorMatchCategory => "Selector Matching", TimeProfilerCategory::LayoutSelectorMatch => "Selector Matching",
TimeProfilerCategory::LayoutTreeBuilderCategory => "Tree Building", TimeProfilerCategory::LayoutTreeBuilder => "Tree Building",
TimeProfilerCategory::LayoutDamagePropagateCategory => "Damage Propagation", TimeProfilerCategory::LayoutDamagePropagate => "Damage Propagation",
TimeProfilerCategory::LayoutMainCategory => "Primary Layout Pass", TimeProfilerCategory::LayoutMain => "Primary Layout Pass",
TimeProfilerCategory::LayoutParallelWarmupCategory => "Parallel Warmup", TimeProfilerCategory::LayoutParallelWarmup => "Parallel Warmup",
TimeProfilerCategory::LayoutShapingCategory => "Shaping", TimeProfilerCategory::LayoutShaping => "Shaping",
TimeProfilerCategory::LayoutDispListBuildCategory => "Display List Construction", TimeProfilerCategory::LayoutDispListBuild => "Display List Construction",
TimeProfilerCategory::PaintingPerTileCategory => "Painting Per Tile", TimeProfilerCategory::PaintingPerTile => "Painting Per Tile",
TimeProfilerCategory::PaintingPrepBuffCategory => "Buffer Prep", TimeProfilerCategory::PaintingPrepBuff => "Buffer Prep",
TimeProfilerCategory::PaintingCategory => "Painting", TimeProfilerCategory::Painting => "Painting",
}; };
format!("{}{}", padding, name) format!("{}{}", padding, name)
} }