From c5cd236b7380c3689792934aeaecd2942713fa67 Mon Sep 17 00:00:00 2001 From: Bingus Date: Tue, 29 Nov 2022 19:50:58 -0800 Subject: Initial profiling support for Iced. --- examples/integration_wgpu/Cargo.toml | 1 + examples/integration_wgpu/src/main.rs | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'examples/integration_wgpu') diff --git a/examples/integration_wgpu/Cargo.toml b/examples/integration_wgpu/Cargo.toml index eaa1df7e..9380f659 100644 --- a/examples/integration_wgpu/Cargo.toml +++ b/examples/integration_wgpu/Cargo.toml @@ -8,6 +8,7 @@ publish = false [dependencies] iced_winit = { path = "../../winit" } iced_wgpu = { path = "../../wgpu", features = ["webgl"] } +iced_profiling = { path = "../../profiling", features = ["tracing-chrome"]} env_logger = "0.8" [target.'cfg(target_arch = "wasm32")'.dependencies] diff --git a/examples/integration_wgpu/src/main.rs b/examples/integration_wgpu/src/main.rs index 70f9a48b..e3dfb6fc 100644 --- a/examples/integration_wgpu/src/main.rs +++ b/examples/integration_wgpu/src/main.rs @@ -16,6 +16,8 @@ use winit::{ event_loop::{ControlFlow, EventLoop}, }; +use iced_profiling::info_span; + #[cfg(target_arch = "wasm32")] use wasm_bindgen::JsCast; #[cfg(target_arch = "wasm32")] @@ -39,6 +41,9 @@ pub fn main() { #[cfg(not(target_arch = "wasm32"))] env_logger::init(); + // Initialize tracing + let _guard = iced_profiling::init(); + // Initialize winit let event_loop = EventLoop::new(); @@ -198,6 +203,8 @@ pub fn main() { } } Event::RedrawRequested(_) => { + let _ = info_span!("Integration_WGPU", "DRAW").entered(); + if resized { let size = window.inner_size(); -- cgit