Skip to content

Commit 8ebd4d9

Browse files
committed
add span to winit event handler (#6612)
# Objective - Add a span for the winit event handler. I've found this useful in my PR for pipelined rendering and I've seen it come up in a few other contexts now. ![image](https://user-images.githubusercontent.com/2180432/201588888-5dc02063-2c41-471b-8937-a71aeaf174b4.png)
1 parent eaa35cf commit 8ebd4d9

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

crates/bevy_internal/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ trace = [
1616
"bevy_ecs/trace",
1717
"bevy_log/trace",
1818
"bevy_render?/trace",
19-
"bevy_hierarchy/trace"
19+
"bevy_hierarchy/trace",
20+
"bevy_winit/trace"
2021
]
2122
trace_chrome = [ "bevy_log/tracing-chrome" ]
2223
trace_tracy = ["bevy_render?/tracing-tracy", "bevy_log/tracing-tracy" ]

crates/bevy_winit/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ license = "MIT OR Apache-2.0"
99
keywords = ["bevy"]
1010

1111
[features]
12+
trace = []
1213
wayland = ["winit/wayland"]
1314
x11 = ["winit/x11"]
1415

crates/bevy_winit/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ pub fn winit_runner_with(mut app: App) {
360360
let event_handler = move |event: Event<()>,
361361
event_loop: &EventLoopWindowTarget<()>,
362362
control_flow: &mut ControlFlow| {
363+
#[cfg(feature = "trace")]
364+
let _span = bevy_utils::tracing::info_span!("winit event_handler").entered();
363365
match event {
364366
event::Event::NewEvents(start) => {
365367
let winit_config = app.world.resource::<WinitSettings>();

0 commit comments

Comments
 (0)