I am creating a game and am getting some very annoying stuttering, the stutters are quite short but still very noticeable. How can I go about debugging this, is there a way to see what systems are taking the most time? I have attached a graph showing the frame times I have collected.
This is how I am testing
#[derive(Resource, Default, Debug)]
struct FrameTimes(Vec<f32>);
fn log_frame_times(mut frame_times: ResMut<FrameTimes>, time: Res<Time>, keys: Res<Input<KeyCode>>) {
frame_times.0.push(time.delta_seconds());
if keys.just_pressed(KeyCode::F1) {
let _ = std::fs::write("frame_times.txt", format!("{:#?}", frame_times.0));
}
}