bevy/crates/bevy_diagnostic/src
Brezak f187d9c5fc
Poll system information in separate tasks (#13693)
# Objective

Reading system information severely slows down the update loop.
Fixes #12848.

## Solution

Read system info in a separate thread.

## Testing

- Open the scene 3d example
- Add `FrameTimeDiagnosticsPlugin`, `SystemInformationDiagnosticsPlugin`
and `LogDiagnosticsPlugin` to the app.
- Add this system to the update schedule to disable Vsync on the main
window
```rust
fn change_window_mode(mut windows: Query<&mut Window, Added<Window>>) {
    for mut window in &mut windows {
        window.present_mode = PresentMode::AutoNoVsync;
    }
}
```
- Read the fps values in the console before and after this PR.

On my PC I went from around 50 fps to around 1150 fps.

---

## Changelog

### Changed

- The `SystemInformationDiagnosticsPlugin` now reads system data
separate of the update cycle.

### Added 

- The `EXPECTED_SYSTEM_INFORMATION_INTERVAL` constant which defines how
often we read system diagnostic data.

---------

Co-authored-by: IceSentry <IceSentry@users.noreply.github.com>
2024-06-10 19:06:22 +00:00
..
diagnostic.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
entity_count_diagnostics_plugin.rs Replace DiagnosticId by DiagnosticPath (#9266) 2024-01-20 15:42:51 +00:00
frame_time_diagnostics_plugin.rs Replace DiagnosticId by DiagnosticPath (#9266) 2024-01-20 15:42:51 +00:00
lib.rs Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
log_diagnostics_plugin.rs Replace bevy_log's tracing reexport with bevy_utils' (#12254) 2024-03-02 18:38:04 +00:00
system_information_diagnostics_plugin.rs Poll system information in separate tasks (#13693) 2024-06-10 19:06:22 +00:00