Skip to content

Commit

Permalink
display frame count in span
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Jul 1, 2021
1 parent 699972f commit dd90337
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ pub struct App {
pub world: World,
pub runner: Box<dyn Fn(App)>,
pub schedule: Schedule,
#[cfg(feature = "trace")]
frame_count: u32,
}

impl Default for App {
Expand All @@ -41,6 +43,8 @@ impl Default for App {
world: Default::default(),
schedule: Default::default(),
runner: Box::new(run_once),
#[cfg(feature = "trace")]
frame_count: 0,
}
}
}
Expand All @@ -57,7 +61,8 @@ impl App {
pub fn update(&mut self) {
#[cfg(feature = "trace")]
{
let bevy_frame_update_span = info_span!("frame");
self.frame_count = self.frame_count.wrapping_add(1);
let bevy_frame_update_span = info_span!("frame", frame_count = self.frame_count);
let _bevy_frame_update_guard = bevy_frame_update_span.enter();
self.schedule
.run_in_span(&mut self.world, Some(&bevy_frame_update_span));
Expand Down

0 comments on commit dd90337

Please sign in to comment.