Restructured everything to make profiling a feature of iced_winit.

This commit is contained in:
bungoboingo 2022-12-20 20:41:09 -08:00 committed by Héctor Ramón Jiménez
parent c5cd236b73
commit 4b6d3797d4
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
23 changed files with 184 additions and 254 deletions

View file

@ -17,8 +17,8 @@ use iced_winit::{Clipboard, Command, Debug, Proxy, Settings};
use glutin::window::Window;
use std::mem::ManuallyDrop;
#[cfg(feature = "trace")]
use iced_profiling::{info_span, instrument::Instrument};
#[cfg(feature = "tracing")]
use tracing::{info_span, instrument::Instrument};
/// Runs an [`Application`] with an executor, compositor, and the provided
/// settings.
@ -39,12 +39,12 @@ where
use glutin::ContextBuilder;
#[cfg(feature = "trace")]
let _guard = iced_profiling::init();
let _guard = iced_winit::Profiler::init();
let mut debug = Debug::new();
debug.startup_started();
#[cfg(feature = "trace")]
#[cfg(feature = "tracing")]
let _ = info_span!("Application::Glutin", "RUN").entered();
let mut event_loop = EventLoopBuilder::with_user_event().build();
@ -147,7 +147,7 @@ where
settings.exit_on_close_request,
);
#[cfg(feature = "trace")]
#[cfg(feature = "tracing")]
let run_instance =
run_instance.instrument(info_span!("Application", "LOOP"));
@ -350,7 +350,7 @@ async fn run_instance<A, E, C>(
messages.push(message);
}
event::Event::RedrawRequested(_) => {
#[cfg(feature = "trace")]
#[cfg(feature = "tracing")]
let _ = info_span!("Application", "FRAME").entered();
debug.render_started();