Bug 1751693: Add telemetry probe to measure glyph rasterization time and the required plumbing for WR. r=nical

Differential Revision: https://phabricator.services.mozilla.com/D140681
This commit is contained in:
Bas Schouten 2022-03-28 07:21:14 +00:00
Родитель 9f9179d4e9
Коммит 3f4629d024
7 изменённых файлов: 65 добавлений и 5 удалений

2
Cargo.lock сгенерированный
Просмотреть файл

@ -5814,9 +5814,11 @@ dependencies = [
"dwrote",
"etagere",
"euclid",
"fog",
"freetype",
"fxhash",
"gleam",
"glean",
"glslopt",
"lazy_static",
"libc",

Просмотреть файл

@ -31,3 +31,20 @@ paint:
- mwoodrow@mozilla.com
expires: never
telemetry_mirror: PAINT_BUILD_DISPLAYLIST_TIME
wr:
rasterize_glyphs_time:
type: timing_distribution
description: >
The time to rasterize glyphs for consumption by WebRender.
time_unit: microsecond
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1728423
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1728423
data_sensitivity:
- technical
notification_emails:
- gfx-telemetry-alerts@mozilla.com
expires: never
telemetry_mirror: WR_RASTERIZE_GLYPHS_TIME

Просмотреть файл

@ -18,7 +18,7 @@ display_list_stats = ["api/display_list_stats"]
serialize_program = ["serde", "webrender_build/serialize_program"]
no_static_freetype = []
leak_checks = []
gecko = []
gecko = ["fog"]
sw_compositor = ["swgl"]
[build-dependencies]
@ -51,6 +51,8 @@ svg_fmt = "0.4"
tracy-rs = "0.1.2"
derive_more = "0.99"
etagere = "0.2.6"
glean = "44.0.0"
fog = { path = "../../../toolkit/components/glean/api", optional = true }
swgl = { path = "../swgl", optional = true }
[dev-dependencies]

Просмотреть файл

@ -20,6 +20,7 @@ use crate::resource_cache::CachedImageData;
use crate::texture_cache::{TextureCache, TextureCacheHandle, Eviction, TargetShader};
use crate::gpu_cache::GpuCache;
use crate::profiler::{self, TransactionProfile};
use crate::telemetry::Telemetry;
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use rayon::ThreadPool;
use rayon::prelude::*;
@ -227,6 +228,7 @@ impl GlyphRasterizer {
profile: &mut TransactionProfile,
) {
profile.start_time(profiler::GLYPH_RESOLVE_TIME);
let timer_id = Telemetry::start_rasterize_glyphs_time();
// Work around the borrow checker, since we call flush_glyph_requests below
let mut pending_glyph_requests = mem::replace(
@ -314,6 +316,7 @@ impl GlyphRasterizer {
// we can schedule removing the fonts if needed.
self.remove_dead_fonts();
Telemetry::stop_and_accumulate_rasterize_glyphs_time(timer_id);
profile.end_time(profiler::GLYPH_RESOLVE_TIME);
}
}

Просмотреть файл

@ -74,6 +74,7 @@ extern crate svg_fmt;
#[macro_use]
mod profiler;
mod telemetry;
mod batch;
mod border;

Просмотреть файл

@ -0,0 +1,24 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use glean::TimerId;
#[cfg(feature = "gecko")]
use fog::metrics::wr;
pub struct Telemetry;
/// Defines the interface for hooking up an external telemetry reporter to WR.
#[cfg(not(feature = "gecko"))]
impl Telemetry {
// Start rasterize glyph time collection
pub fn start_rasterize_glyphs_time() -> TimerId { return 0; }
// End rasterize glyph time collection
pub fn stop_and_accumulate_rasterize_glyphs_time(_id: TimerId) { }
}
#[cfg(feature = "gecko")]
impl Telemetry {
pub fn start_rasterize_glyphs_time() -> TimerId { wr::rasterize_glyphs_time.start() }
pub fn stop_and_accumulate_rasterize_glyphs_time(id: TimerId) { wr::rasterize_glyphs_time.stop_and_accumulate(id); }
}

Просмотреть файл

@ -15999,16 +15999,27 @@
"description": "WebRender scene swap time in miliseconds"
},
"WR_FRAMEBUILD_TIME": {
"record_in_processes": ["main", "gpu"],
"products": ["firefox", "fennec", "geckoview_streaming"],
"alert_emails": ["gfx-telemetry-alerts@mozilla.com", "jmuizelaar@mozilla.com"],
"bug_numbers": [1470901, 1584109],
"record_in_processes": [ "main", "gpu" ],
"products": [ "firefox", "fennec", "geckoview_streaming" ],
"alert_emails": [ "gfx-telemetry-alerts@mozilla.com", "jmuizelaar@mozilla.com" ],
"bug_numbers": [ 1470901, 1584109 ],
"expires_in_version": "never",
"kind": "exponential",
"high": 1000,
"n_buckets": 50,
"description": "WebRender render time in milliseconds"
},
"WR_RASTERIZE_GLYPHS_TIME": {
"record_in_processes": ["main", "gpu"],
"products": ["firefox", "fennec", "geckoview_streaming"],
"alert_emails": ["gfx-telemetry-alerts@mozilla.com", "jmuizelaar@mozilla.com"],
"bug_numbers": [ ],
"expires_in_version": "never",
"kind": "exponential",
"high": 500,
"n_buckets": 50,
"description": "Time taken by WebRender to rasterize a set of glyphs"
},
"WEB_AUDIO_BECOMES_AUDIBLE_TIME": {
"record_in_processes": ["content"],
"products": ["firefox"],