Bug 1583841 - Include some ResourceProfileCounters in the smart profiler. r=gw
authorNicolas Silva <nsilva@mozilla.com>
Fri, 18 Oct 2019 01:09:17 +0000
changeset 559438 8cc42e92e6ef2b11d818b056aa6f67cd800844db
parent 559437 5979a213200682d5eef021820f88cd3a2ef2f936
child 559439 16bed925e3ac7bf500d924d5441085f87de07e3d
push id12177
push usercsabou@mozilla.com
push dateMon, 21 Oct 2019 14:52:16 +0000
treeherdermozilla-beta@1918a9cd33bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1583841
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1583841 - Include some ResourceProfileCounters in the smart profiler. r=gw Depends on D49617 Differential Revision: https://phabricator.services.mozilla.com/D49618
gfx/wr/webrender/src/profiler.rs
--- a/gfx/wr/webrender/src/profiler.rs
+++ b/gfx/wr/webrender/src/profiler.rs
@@ -43,16 +43,23 @@ pub mod expected {
     pub const GPU_CACHE_ROWS_UPDATED: Range<u64> =  0..25;
     pub const GPU_CACHE_BLOCKS_TOTAL: Range<u64> =  1..1000;
     pub const GPU_CACHE_BLOCKS_UPDATED: Range<u64> = 0..1000;
     pub const GPU_CACHE_BLOCKS_SAVED: Range<u64> =  0..1000;
     pub const DISPLAY_LIST_BUILD_TIME: Range<f64> = 0.0..3.0;
     pub const DISPLAY_LIST_CONSUME_TIME: Range<f64> = 0.0..2.0;
     pub const DISPLAY_LIST_SEND_TIME: Range<f64> =  0.0..1.0;
     pub const DISPLAY_LIST_TOTAL_TIME: Range<f64> = 0.0..4.0;
+    pub const NUM_FONT_TEMPLATES: Range<usize> =    0..50;
+    pub const FONT_TEMPLATES_MB: Range<f32> =       0.0..40.0;
+    pub const NUM_IMAGE_TEMPLATES: Range<usize> =   0..20;
+    pub const IMAGE_TEMPLATES_MB: Range<f32> =      0.0..10.0;
+    pub const DISPLAY_LIST_MB: Range<f32> =         0.0..0.2;
+    pub const NUM_RASTERIZED_BLOBS: Range<usize> =  0..25; // in tiles
+    pub const RASTERIZED_BLOBS_MB: Range<f32> =     0.0..4.0;
 }
 
 const GRAPH_WIDTH: f32 = 1024.0;
 const GRAPH_HEIGHT: f32 = 320.0;
 const GRAPH_PADDING: f32 = 8.0;
 const GRAPH_FRAME_HEIGHT: f32 = 16.0;
 const PROFILE_PADDING: f32 = 8.0;
 
@@ -610,17 +617,21 @@ pub struct TextureCacheProfileCounters {
 impl TextureCacheProfileCounters {
     pub fn new() -> Self {
         TextureCacheProfileCounters {
             pages_alpha8_linear: ResourceProfileCounter::new("Texture A8 cached pages", None, None),
             pages_alpha16_linear: ResourceProfileCounter::new("Texture A16 cached pages", None, None),
             pages_color8_linear: ResourceProfileCounter::new("Texture RGBA8 cached pages (L)", None, None),
             pages_color8_nearest: ResourceProfileCounter::new("Texture RGBA8 cached pages (N)", None, None),
             pages_picture: ResourceProfileCounter::new("Picture cached pages", None, None),
-            rasterized_blob_pixels: ResourceProfileCounter::new("Rasterized Blob Pixels", None, None),
+            rasterized_blob_pixels: ResourceProfileCounter::new(
+                "Rasterized Blob Pixels",
+                Some(expected::NUM_RASTERIZED_BLOBS),
+                Some(expected::RASTERIZED_BLOBS_MB),
+            ),
         }
     }
 }
 
 #[derive(Clone)]
 pub struct GpuCacheProfileCounters {
     pub allocated_rows: AverageIntProfileCounter,
     pub allocated_blocks: AverageIntProfileCounter,
@@ -738,18 +749,26 @@ impl IpcProfileCounters {
 impl BackendProfileCounters {
     pub fn new() -> Self {
         BackendProfileCounters {
             total_time: TimeProfileCounter::new(
                 "Backend CPU Time", false,
                 Some(expected::MAX_BACKEND_CPU_TIME),
             ),
             resources: ResourceProfileCounters {
-                font_templates: ResourceProfileCounter::new("Font Templates", None, None),
-                image_templates: ResourceProfileCounter::new("Image Templates", None, None),
+                font_templates: ResourceProfileCounter::new(
+                    "Font Templates",
+                    Some(expected::NUM_FONT_TEMPLATES),
+                    Some(expected::FONT_TEMPLATES_MB),
+                ),
+                image_templates: ResourceProfileCounter::new(
+                    "Image Templates",
+                    Some(expected::NUM_IMAGE_TEMPLATES),
+                    Some(expected::IMAGE_TEMPLATES_MB),
+                ),
                 texture_cache: TextureCacheProfileCounters::new(),
                 gpu_cache: GpuCacheProfileCounters::new(),
             },
             ipc: IpcProfileCounters {
                 build_time: TimeProfileCounter::new(
                     "Display List Build Time", false,
                     Some(expected::DISPLAY_LIST_BUILD_TIME)
                 ),
@@ -760,17 +779,20 @@ impl BackendProfileCounters {
                 send_time: TimeProfileCounter::new(
                     "Display List Send Time", false,
                     Some(expected::DISPLAY_LIST_SEND_TIME),
                 ),
                 total_time: TimeProfileCounter::new(
                     "Total Display List Time", false,
                     Some(expected::DISPLAY_LIST_TOTAL_TIME),
                 ),
-                display_lists: ResourceProfileCounter::new("Display Lists Sent", None, None),
+                display_lists: ResourceProfileCounter::new(
+                    "Display Lists Sent",
+                    None, Some(expected::DISPLAY_LIST_MB),
+                ),
             },
             //TODO: generate this by a macro
             intern: InternProfileCounters {
                 prim: ResourceProfileCounter::new("Interned primitives", None, None),
                 image: ResourceProfileCounter::new("Interned images", None, None),
                 image_border: ResourceProfileCounter::new("Interned image borders", None, None),
                 line_decoration: ResourceProfileCounter::new("Interned line decorations", None, None),
                 linear_grad: ResourceProfileCounter::new("Interned linear gradients", None, None),
@@ -1622,17 +1644,17 @@ impl Profiler {
     }
 
     fn draw_smart_profile(
         &mut self,
         backend_profile: &BackendProfileCounters,
         renderer_profile: &RendererProfileCounters,
         debug_renderer: &mut DebugRenderer,
     ) {
-        while self.cooldowns.len() < 12 {
+        while self.cooldowns.len() < 18 {
             self.cooldowns.push(0);
         }
 
         // Always show the fps counter.
         Profiler::draw_counters(
             &[
                 &renderer_profile.frame_time,
             ],
@@ -1659,16 +1681,22 @@ impl Profiler {
             ],
             &[
                 &backend_profile.resources.gpu_cache.allocated_rows,
                 &backend_profile.resources.gpu_cache.updated_rows,
                 &backend_profile.resources.gpu_cache.allocated_blocks,
                 &backend_profile.resources.gpu_cache.updated_blocks,
                 &backend_profile.resources.gpu_cache.saved_blocks,
             ],
+            &[
+                &backend_profile.resources.image_templates,
+                &backend_profile.resources.font_templates,
+                &backend_profile.resources.texture_cache.rasterized_blob_pixels,
+                &backend_profile.ipc.display_lists,
+            ],
         ];
 
         for group in counters {
             let end = start + group.len();
             Profiler::draw_counters(
                 &group[..],
                 Some(&mut self.cooldowns[start..end]),
                 debug_renderer,