diff --git a/crates/bevy_internal/Cargo.toml b/crates/bevy_internal/Cargo.toml index 5446f251b1c6ae..ac371a3d4a82a2 100644 --- a/crates/bevy_internal/Cargo.toml +++ b/crates/bevy_internal/Cargo.toml @@ -16,7 +16,8 @@ trace = [ "bevy_ecs/trace", "bevy_log/trace", "bevy_render?/trace", - "bevy_hierarchy/trace" + "bevy_hierarchy/trace", + "bevy_winit/trace" ] trace_chrome = [ "bevy_log/tracing-chrome" ] trace_tracy = ["bevy_render?/tracing-tracy", "bevy_log/tracing-tracy" ] diff --git a/crates/bevy_winit/Cargo.toml b/crates/bevy_winit/Cargo.toml index 3d78e7160d1c22..96864623f11133 100644 --- a/crates/bevy_winit/Cargo.toml +++ b/crates/bevy_winit/Cargo.toml @@ -9,6 +9,7 @@ license = "MIT OR Apache-2.0" keywords = ["bevy"] [features] +trace = [] wayland = ["winit/wayland"] x11 = ["winit/x11"] diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 0ef1cb6e5c3304..0b1b544eec17bd 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -360,6 +360,8 @@ pub fn winit_runner_with(mut app: App) { let event_handler = move |event: Event<()>, event_loop: &EventLoopWindowTarget<()>, control_flow: &mut ControlFlow| { + #[cfg(feature = "trace")] + let _span = bevy_utils::tracing::info_span!("winit event_handler").entered(); match event { event::Event::NewEvents(start) => { let winit_config = app.world.resource::();