mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
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:
parent
7f587f6cb5
commit
ce36e574f4
19 changed files with 322 additions and 331 deletions
|
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue