Bug 1637729 - Added a counter to track how many picture cache tiles are invalidated, and added it as an event marker to the profiler. r=jrmuizel,gw
authorDaniel Lu <dlu@mozilla.com>
Fri, 22 May 2020 13:57:43 +0000
changeset 531623 dcf166da7a8bad96946df5d46b9f4beff8ce46f9
parent 531622 6f4edb094e0de7396a7d4f011da485e367b5c3aa
child 531624 cd4b7928b25c5ffe59863139e5e440fbc31f084a
push id37441
push userapavel@mozilla.com
push dateFri, 22 May 2020 21:38:53 +0000
treeherdermozilla-central@d6abd35b54ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, gw
bugs1637729
milestone78.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 1637729 - Added a counter to track how many picture cache tiles are invalidated, and added it as an event marker to the profiler. r=jrmuizel,gw Differential Revision: https://phabricator.services.mozilla.com/D76389
gfx/wr/webrender/src/profiler.rs
gfx/wr/webrender/src/renderer.rs
--- a/gfx/wr/webrender/src/profiler.rs
+++ b/gfx/wr/webrender/src/profiler.rs
@@ -307,16 +307,20 @@ impl AverageIntProfileCounter {
     pub fn add(&mut self, val: usize) {
         self.accum += val as u64;
     }
 
     pub fn inc(&mut self) {
         self.accum += 1;
     }
 
+    pub fn get_accum(&mut self) -> u64{
+        self.accum
+    }
+
     /// Returns either the most up to date value if the counter is updated
     /// with add add inc, or the average over the previous time slice.
     pub fn get(&self) -> usize {
         let result = if self.accum != 0 {
             self.accum
         } else {
             self.avg
         };
--- a/gfx/wr/webrender/src/renderer.rs
+++ b/gfx/wr/webrender/src/renderer.rs
@@ -71,17 +71,17 @@ use crate::internal_types::{TextureSourc
 use crate::internal_types::{CacheTextureId, DebugOutput, FastHashMap, FastHashSet, LayerIndex, RenderedDocument, ResultMsg};
 use crate::internal_types::{TextureCacheAllocationKind, TextureCacheUpdate, TextureUpdateList, TextureUpdateSource};
 use crate::internal_types::{RenderTargetInfo, SavedTargetIndex, Swizzle};
 use malloc_size_of::MallocSizeOfOps;
 use crate::picture::{RecordedDirtyRegion, tile_cache_sizes, ResolvedSurfaceTexture};
 use crate::prim_store::DeferredResolve;
 use crate::profiler::{BackendProfileCounters, FrameProfileCounters, TimeProfileCounter,
                GpuProfileTag, RendererProfileCounters, RendererProfileTimers};
-use crate::profiler::{Profiler, ChangeIndicator, ProfileStyle, add_event_marker};
+use crate::profiler::{Profiler, ChangeIndicator, ProfileStyle, add_event_marker, thread_is_being_profiled};
 use crate::device::query::{GpuProfiler, GpuDebugMethod};
 use rayon::{ThreadPool, ThreadPoolBuilder};
 use crate::render_backend::{FrameId, RenderBackend};
 use crate::render_task_graph::RenderTaskGraph;
 use crate::render_task::{RenderTask, RenderTaskData, RenderTaskKind};
 use crate::resource_cache::ResourceCache;
 use crate::scene_builder_thread::{SceneBuilderThread, SceneBuilderThreadChannels, LowPrioritySceneBuilderThread};
 use crate::screen_capture::AsyncScreenshotGrabber;
@@ -107,16 +107,17 @@ use std::path::PathBuf;
 use std::rc::Rc;
 use std::sync::Arc;
 use std::sync::atomic::{AtomicBool, Ordering};
 use std::sync::mpsc::{channel, Sender, Receiver};
 use std::thread;
 use std::cell::RefCell;
 use tracy_rs::register_thread_with_profiler;
 use time::precise_time_ns;
+use std::ffi::CString;
 
 cfg_if! {
     if #[cfg(feature = "debugger")] {
         use serde_json;
         use crate::debug_server;
     }
 }
 
@@ -3449,16 +3450,23 @@ impl Renderer {
                 self.draw_frame(
                     frame,
                     device_size,
                     cpu_frame_id,
                     &mut results,
                     doc_index == 0,
                 );
 
+                // Profile marker for the number of invalidated picture cache
+                if thread_is_being_profiled() {
+                    let num_invalidated = self.profile_counters.rendered_picture_cache_tiles.get_accum();
+                    let message = format!("NumPictureCacheInvalidated: {}", num_invalidated);
+                    add_event_marker(&(CString::new(message).unwrap()));
+                }
+
                 if device_size.is_some() {
                     self.draw_frame_debug_items(&frame.debug_items);
                 }
                 if self.debug_flags.contains(DebugFlags::PROFILER_DBG) {
                     frame_profiles.push(frame.profile_counters.clone());
                 }
 
                 let dirty_regions =