Skip to content

Commit

Permalink
add span to winit event handler (bevyengine#6612)
Browse files Browse the repository at this point in the history
# 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)
  • Loading branch information
hymm authored and taiyoungjang committed Dec 15, 2022
1 parent 5a4ec0f commit d3cc8dc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ license = "MIT OR Apache-2.0"
keywords = ["bevy"]

[features]
trace = []
wayland = ["winit/wayland"]
x11 = ["winit/x11"]

Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,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::<WinitSettings>();
Expand Down

0 comments on commit d3cc8dc

Please sign in to comment.