Show FPS in benchmark log

This commit is contained in:
Jared Miller 2025-12-15 18:40:04 -05:00 committed by Jared Tyler Miller
parent 70dd969a5b
commit 342c73f4f3

View file

@ -85,15 +85,14 @@ const BenchmarkLogger = struct {
if (!crossed_threshold and !big_jump and !heartbeat_due) return; if (!crossed_threshold and !big_jump and !heartbeat_due) return;
// determine note const fps = if (frame_ms > 0) 1000.0 / frame_ms else 0;
var note: []const u8 = "";
if (crossed_threshold and now_above) { // determine note - show ! when below target fps
note = "[!60fps]"; var note_buf: [16]u8 = undefined;
} else if (crossed_threshold and !now_above) { const note = if (now_above)
note = "[+60fps]"; std.fmt.bufPrint(&note_buf, "[!{d:.0}fps]", .{fps}) catch ""
} else if (big_jump) { else
note = "[jump]"; std.fmt.bufPrint(&note_buf, "[{d:.0}fps]", .{fps}) catch "";
}
var buf: [256]u8 = undefined; var buf: [256]u8 = undefined;
const line = std.fmt.bufPrint(&buf, "[{d:.1}s] entities={d} frame={d:.1}ms update={d:.1}ms render={d:.1}ms {s}\n", .{ const line = std.fmt.bufPrint(&buf, "[{d:.1}s] entities={d} frame={d:.1}ms update={d:.1}ms render={d:.1}ms {s}\n", .{