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

Differential Revision: https://phabricator.services.mozilla.com/D140681
This commit is contained in:
Bas Schouten 2022-04-20 23:54:21 +00:00
parent ef681f3a6c
commit c357e94fd8
9 changed files with 416 additions and 17 deletions

2
Cargo.lock generated
View File

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

View File

@ -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

361
gfx/wr/Cargo.lock generated
View File

@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "adler32"
version = "1.0.4"
@ -64,6 +70,12 @@ dependencies = [
"num-traits",
]
[[package]]
name = "arrayref"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
[[package]]
name = "atty"
version = "0.2.14"
@ -200,6 +212,7 @@ dependencies = [
"libc",
"num-integer",
"num-traits",
"serde",
"time",
"winapi",
]
@ -458,7 +471,7 @@ version = "0.99.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.36",
"quote 1.0.3",
"syn",
]
@ -542,6 +555,44 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "ffi-support"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27838c6815cfe9de2d3aeb145ffd19e565f577414b33f3bdbf42fe040e9e0ff6"
dependencies = [
"lazy_static",
"log",
]
[[package]]
name = "flate2"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af"
dependencies = [
"cfg-if 1.0.0",
"crc32fast",
"libc",
"miniz_oxide",
]
[[package]]
name = "fog"
version = "0.1.0"
dependencies = [
"bincode",
"chrono",
"glean",
"inherent",
"log",
"mozbuild",
"once_cell",
"serde",
"thin-vec",
"uuid",
]
[[package]]
name = "font-loader"
version = "0.11.0"
@ -570,6 +621,16 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
dependencies = [
"matches",
"percent-encoding",
]
[[package]]
name = "freetype"
version = "0.7.0"
@ -606,6 +667,17 @@ dependencies = [
"byteorder",
]
[[package]]
name = "getrandom"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
dependencies = [
"cfg-if 1.0.0",
"libc",
"wasi",
]
[[package]]
name = "gl_generator"
version = "0.13.1"
@ -646,6 +718,46 @@ dependencies = [
"gl_generator 0.14.0",
]
[[package]]
name = "glean"
version = "44.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4022e5a404be8c59f7a9649d60e907af954f5f02b736d1e58c71267b159eb1eb"
dependencies = [
"chrono",
"crossbeam-channel",
"glean-core",
"inherent",
"log",
"once_cell",
"serde",
"serde_json",
"thiserror",
"time",
"uuid",
"whatsys",
]
[[package]]
name = "glean-core"
version = "44.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bbdc6a097188ab24ba7e500b6a163fa8cf99a52c1630c240fd7a297a7271215"
dependencies = [
"bincode",
"chrono",
"ffi-support",
"flate2",
"log",
"once_cell",
"rkv",
"serde",
"serde_json",
"time",
"uuid",
"zeitstempel",
]
[[package]]
name = "glsl"
version = "4.0.3"
@ -760,6 +872,23 @@ dependencies = [
"quick-error",
]
[[package]]
name = "id-arena"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005"
[[package]]
name = "idna"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
dependencies = [
"matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "image"
version = "0.23.3"
@ -783,6 +912,17 @@ dependencies = [
"adler32",
]
[[package]]
name = "inherent"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3974bf42c2050bbf0696471e4d91ecc9844845c2323b388aa7bf9d63f3b0693"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.3",
"syn",
]
[[package]]
name = "itoa"
version = "0.4.5"
@ -841,6 +981,29 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a"
[[package]]
name = "lmdb-rkv"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447a296f7aca299cfbb50f4e4f3d49451549af655fb7215d7f8c0c3d64bad42b"
dependencies = [
"bitflags",
"byteorder",
"libc",
"lmdb-rkv-sys",
]
[[package]]
name = "lmdb-rkv-sys"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61b9ce6b3be08acefa3003c57b7565377432a89ec24476bbe72e11d101f852fe"
dependencies = [
"cc",
"libc",
"pkg-config",
]
[[package]]
name = "lock_api"
version = "0.3.4"
@ -874,11 +1037,17 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e37c5d4cd9473c5f4c9c111f033f15d4df9bd378fdf615944e360a4f55a05f0b"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.36",
"syn",
"synstructure",
]
[[package]]
name = "matches"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]]
name = "maybe-uninit"
version = "2.0.0"
@ -916,6 +1085,15 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "647da2489d438eb707e9bcffe0e47fb6f3f355ed288120740fc1e614cfadb9e9"
[[package]]
name = "miniz_oxide"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082"
dependencies = [
"adler",
]
[[package]]
name = "mozangle"
version = "0.3.3"
@ -928,6 +1106,12 @@ dependencies = [
"walkdir",
]
[[package]]
name = "mozbuild"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "903970ae2f248d7275214cf8f387f8ba0c4ea7e3d87a320e85493db60ce28616"
[[package]]
name = "nix"
version = "0.14.1"
@ -1011,6 +1195,12 @@ dependencies = [
"malloc_buf",
]
[[package]]
name = "once_cell"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
[[package]]
name = "ordered-float"
version = "1.0.2"
@ -1060,6 +1250,25 @@ dependencies = [
"winapi",
]
[[package]]
name = "paste"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45ca20c77d80be666aef2b45486da86238fabe33e38306bd3118fe4af33fa880"
dependencies = [
"paste-impl",
"proc-macro-hack",
]
[[package]]
name = "paste-impl"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d95a7db200b97ef370c8e6de0088252f7e0dfff7d047a28528e47456c0fc98b6"
dependencies = [
"proc-macro-hack",
]
[[package]]
name = "peek-poke"
version = "0.2.0"
@ -1072,7 +1281,7 @@ dependencies = [
name = "peek-poke-derive"
version = "0.2.1"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.36",
"quote 1.0.3",
"syn",
"synstructure",
@ -1115,6 +1324,12 @@ dependencies = [
"inflate",
]
[[package]]
name = "proc-macro-hack"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro2"
version = "0.4.30"
@ -1126,9 +1341,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.10"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [
"unicode-xid 0.2.0",
]
@ -1154,7 +1369,7 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.36",
]
[[package]]
@ -1252,6 +1467,29 @@ version = "0.6.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
[[package]]
name = "rkv"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28e2e15d3fff125cfc4fb3f1b226ff83af057c4715061ded16193b7142beefc9"
dependencies = [
"arrayref",
"bincode",
"bitflags",
"byteorder",
"id-arena",
"lazy_static",
"lmdb-rkv",
"log",
"ordered-float",
"paste",
"serde",
"serde_derive",
"thiserror",
"url",
"uuid",
]
[[package]]
name = "ron"
version = "0.7.0"
@ -1358,7 +1596,7 @@ version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.36",
"quote 1.0.3",
"syn",
]
@ -1473,11 +1711,11 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.17"
version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03"
checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.36",
"quote 1.0.3",
"unicode-xid 0.2.0",
]
@ -1488,7 +1726,7 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.36",
"quote 1.0.3",
"syn",
"unicode-xid 0.2.0",
@ -1512,6 +1750,32 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "thin-vec"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ceb94bb4b121597e14f054e8c3368afd6e7219a64598037bd480184b456a5df4"
[[package]]
name = "thiserror"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
dependencies = [
"proc-macro2 1.0.36",
"quote 1.0.3",
"syn",
]
[[package]]
name = "thread_local"
version = "1.0.1"
@ -1532,6 +1796,21 @@ dependencies = [
"winapi",
]
[[package]]
name = "tinyvec"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tracy-rs"
version = "0.1.2"
@ -1541,6 +1820,21 @@ dependencies = [
"minidl",
]
[[package]]
name = "unicode-bidi"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
[[package]]
name = "unicode-normalization"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-width"
version = "0.1.7"
@ -1559,6 +1853,27 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
[[package]]
name = "url"
version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
dependencies = [
"form_urlencoded",
"idna",
"matches",
"percent-encoding",
]
[[package]]
name = "uuid"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
dependencies = [
"getrandom",
]
[[package]]
name = "vec_map"
version = "0.8.1"
@ -1668,9 +1983,11 @@ dependencies = [
"dwrote",
"etagere",
"euclid",
"fog",
"freetype",
"fxhash",
"gleam 0.13.1",
"glean",
"glslopt",
"lazy_static",
"libc",
@ -1738,6 +2055,17 @@ dependencies = [
"serde",
]
[[package]]
name = "whatsys"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c24fff5aa1e0973964ba23a995e8b10fa2cdeae507e0cbbbd36f8403242a765d"
dependencies = [
"cc",
"cfg-if 1.0.0",
"libc",
]
[[package]]
name = "winapi"
version = "0.3.8"
@ -1880,3 +2208,14 @@ checksum = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d"
dependencies = [
"linked-hash-map",
]
[[package]]
name = "zeitstempel"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eeea3eb6a30ed24e374f59368d3917c5180a845fdd4ed6f1b2278811a9e826f8"
dependencies = [
"cfg-if 1.0.0",
"libc",
"once_cell",
]

View File

@ -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]

View File

@ -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);
}
}

View File

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

View File

@ -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); }
}

View File

@ -179,7 +179,7 @@ wrench-deps:
fetch:
- android-rs-glue
toolchain:
- linux64-rust-1.47 # whatever m-c is built with
- linux64-rust-1.59 # whatever m-c is built with
linux64-liblowercase:
description: "liblowercase"

View File

@ -16046,16 +16046,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"],