Skip to content

bevy::diagnostic::FrameTimeDiagnosticsPlugin cannot obtain true FPS with modifying bevy::time::TimeUpdateStrategy #15409

Closed as not planned
1 of 1 issue completed
@Neutron3529

Description

Bevy version

0.14.2

What you did

Writting down such minimal example:

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(bevy::diagnostic::LogDiagnosticsPlugin::default())
        .add_plugins(bevy::diagnostic::FrameTimeDiagnosticsPlugin::default())
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, init)
        // .add_systems(Update, despawn)
        .run();
}

fn init(mut tus: ResMut<bevy::time::TimeUpdateStrategy>) {
    *tus = bevy::time::TimeUpdateStrategy::ManualDuration(std::time::Duration::from_secs(100));
}

What went wrong

The actual FPS (which could be calculated from the wall logging time) does not reported.
Instead, a fixed fps 0.01 is reported every frame.

$ cargo run --release
   Compiling minimal v0.1.0 (/me/bug)
    Finished `release` profile [optimized] target(s) in 2.13s
     Running `target/release/minimal`
2024-09-24T09:24:28.335904Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 3060 Laptop GPU", vendor: 4318, device: 9504, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "560.35.03", backend: Vulkan }
2024-09-24T09:24:28.938985Z  INFO bevy_winit::system: Creating new window "App" (Entity { index: 0, generation: 1 })
2024-09-24T09:24:28.951865Z  INFO bevy diagnostic: fps        :    0.010000   (avg 0.010000)
2024-09-24T09:24:28.951907Z  INFO bevy diagnostic: frame_time : 100000.000000ms (avg 100000.000000ms)
2024-09-24T09:24:28.951915Z  INFO bevy diagnostic: frame_count:    1.000000   (avg 0.500000)
2024-09-24T09:24:29.049511Z  INFO bevy diagnostic: fps        :    0.010000   (avg 0.010000)
2024-09-24T09:24:29.049543Z  INFO bevy diagnostic: frame_time : 100000.000000ms (avg 100000.000000ms)
2024-09-24T09:24:29.049552Z  INFO bevy diagnostic: frame_count:    2.000000   (avg 1.000000)
2024-09-24T09:24:29.062974Z  INFO bevy diagnostic: fps        :    0.010000   (avg 0.010000)

Additional information

It should be the misuse about the real time. For some meta informations, Res<Time> should not be used. Maybe bevy should provide a Time<Wall> that just wraps std::time::Instant::now() for those users who needs the wall time, or just let those user call std::time::Instant::now().

Sub-issues

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-TimeInvolves time keeping and reportingC-BugAn unexpected or incorrect behaviorS-WontfixThis issue is the result of a deliberate design decision, and will not be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions