summaryrefslogtreecommitdiffstats
path: root/gfx/wr/webrender/src/telemetry.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /gfx/wr/webrender/src/telemetry.rs
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/wr/webrender/src/telemetry.rs')
-rw-r--r--gfx/wr/webrender/src/telemetry.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/gfx/wr/webrender/src/telemetry.rs b/gfx/wr/webrender/src/telemetry.rs
new file mode 100644
index 0000000000..6a9f4068c1
--- /dev/null
+++ b/gfx/wr/webrender/src/telemetry.rs
@@ -0,0 +1,41 @@
+/* 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;
+use std::time::Duration;
+
+pub struct Telemetry;
+
+/// Defines the interface for hooking up an external telemetry reporter to WR.
+#[cfg(not(feature = "gecko"))]
+impl Telemetry {
+ pub fn record_rasterize_blobs_time(_duration: Duration) { }
+ pub fn start_framebuild_time() -> TimerId { TimerId { id: 0 } }
+ pub fn stop_and_accumulate_framebuild_time(_id: TimerId) { }
+ pub fn record_renderer_time(_duration: Duration) { }
+ pub fn record_renderer_time_no_sc(_duration: Duration) { }
+ pub fn record_scenebuild_time(_duration: Duration) { }
+ pub fn start_sceneswap_time() -> TimerId { TimerId { id: 0 } }
+ pub fn stop_and_accumulate_sceneswap_time(_id: TimerId) { }
+ pub fn cancel_sceneswap_time(_id: TimerId) { }
+ pub fn record_texture_cache_update_time(_duration: Duration) { }
+ pub fn record_time_to_frame_build(_duration: Duration) { }
+}
+
+#[cfg(feature = "gecko")]
+impl Telemetry {
+ pub fn record_rasterize_blobs_time(duration: Duration) { wr::rasterize_blobs_time.accumulate_raw_duration(duration); }
+ pub fn start_framebuild_time() -> TimerId { wr::framebuild_time.start() }
+ pub fn stop_and_accumulate_framebuild_time(id: TimerId) { wr::framebuild_time.stop_and_accumulate(id); }
+ pub fn record_renderer_time(duration: Duration) { wr::renderer_time.accumulate_raw_duration(duration); }
+ pub fn record_renderer_time_no_sc(duration: Duration) { wr::renderer_time_no_sc.accumulate_raw_duration(duration); }
+ pub fn record_scenebuild_time(duration: Duration) { wr::scenebuild_time.accumulate_raw_duration(duration); }
+ pub fn start_sceneswap_time() -> TimerId { wr::sceneswap_time.start() }
+ pub fn stop_and_accumulate_sceneswap_time(id: TimerId) { wr::sceneswap_time.stop_and_accumulate(id); }
+ pub fn cancel_sceneswap_time(id: TimerId) { wr::sceneswap_time.cancel(id); }
+ pub fn record_texture_cache_update_time(duration: Duration) { wr::texture_cache_update_time.accumulate_raw_duration(duration); }
+ pub fn record_time_to_frame_build(duration: Duration) { wr::time_to_frame_build.accumulate_raw_duration(duration); }
+}