Skip to content

Commit

Permalink
updated diagnostics plugins to use raw measurements
Browse files Browse the repository at this point in the history
  • Loading branch information
maniwani committed Jan 9, 2022
1 parent 8aa1d8a commit 5e82ddf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ impl FrameTimeDiagnosticsPlugin {
state.frame_count += 1.0;
diagnostics.add_measurement(Self::FRAME_COUNT, state.frame_count);

if time.delta_seconds_f64() == 0.0 {
let frame_time = time.raw_delta_seconds_f64();
if frame_time == 0.0 {
return;
}

diagnostics.add_measurement(Self::FRAME_TIME, time.delta_seconds_f64());
diagnostics.add_measurement(Self::FRAME_TIME, frame_time);
if let Some(fps) = diagnostics
.get(Self::FRAME_TIME)
.and_then(|frame_time_diagnostic| {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_diagnostic/src/log_diagnostics_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl LogDiagnosticsPlugin {
time: Res<Time>,
diagnostics: Res<Diagnostics>,
) {
if state.timer.tick(time.delta()).finished() {
if state.timer.tick(time.raw_delta()).finished() {
if let Some(ref filter) = state.filter {
for diagnostic in filter.iter().map(|id| diagnostics.get(*id).unwrap()) {
Self::log_diagnostic(diagnostic);
Expand All @@ -103,7 +103,7 @@ impl LogDiagnosticsPlugin {
time: Res<Time>,
diagnostics: Res<Diagnostics>,
) {
if state.timer.tick(time.delta()).finished() {
if state.timer.tick(time.raw_delta()).finished() {
if let Some(ref filter) = state.filter {
for diagnostic in filter.iter().map(|id| diagnostics.get(*id).unwrap()) {
debug!("{:#?}\n", diagnostic);
Expand Down

0 comments on commit 5e82ddf

Please sign in to comment.