Skip to content

Commit 0ffb544

Browse files
McSpideySyamaMishracart
committed
changed diagnostics from seconds to milliseconds (#5554)
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> # Objective Change frametimediagnostic from seconds to milliseconds because this will always be less than one seconds and is the common diagnostic display unit for game engines. ## Solution - multiplied the existing value by 1000 --- ## Changelog Frametimes are now reported in milliseconds Co-authored-by: Syama Mishra <38512086+SyamaMishra@users.noreply.github.com> Co-authored-by: McSpidey <mcspidey@gmail.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com>
1 parent 90d1dc8 commit 0ffb544

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

crates/bevy_diagnostic/src/frame_time_diagnostics_plugin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl FrameTimeDiagnosticsPlugin {
2727
DiagnosticId::from_u128(73441630925388532774622109383099159699);
2828

2929
pub fn setup_system(mut diagnostics: ResMut<Diagnostics>) {
30-
diagnostics.add(Diagnostic::new(Self::FRAME_TIME, "frame_time", 20).with_suffix("s"));
30+
diagnostics.add(Diagnostic::new(Self::FRAME_TIME, "frame_time", 20).with_suffix("ms"));
3131
diagnostics.add(Diagnostic::new(Self::FPS, "fps", 20));
3232
diagnostics.add(Diagnostic::new(Self::FRAME_COUNT, "frame_count", 1));
3333
}
@@ -46,7 +46,7 @@ impl FrameTimeDiagnosticsPlugin {
4646
return;
4747
}
4848

49-
diagnostics.add_measurement(Self::FRAME_TIME, || time.delta_seconds_f64());
49+
diagnostics.add_measurement(Self::FRAME_TIME, || time.delta_seconds_f64() * 1000.);
5050

5151
diagnostics.add_measurement(Self::FPS, || 1.0 / time.delta_seconds_f64());
5252
}

examples/ui/text_debug.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,11 @@ fn change_text_system(
176176

177177
text.sections[0].value = format!(
178178
"This text changes in the bottom right - {:.1} fps, {:.3} ms/frame",
179-
fps,
180-
frame_time * 1000.0,
179+
fps, frame_time,
181180
);
182181

183182
text.sections[2].value = format!("{:.1}", fps);
184183

185-
text.sections[4].value = format!("{:.3}", frame_time * 1000.0);
184+
text.sections[4].value = format!("{:.3}", frame_time);
186185
}
187186
}

0 commit comments

Comments
 (0)