summaryrefslogtreecommitdiff
path: root/src/FrameStats.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/FrameStats.zig')
-rw-r--r--src/FrameStats.zig12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/FrameStats.zig b/src/FrameStats.zig
index 0b252ff9..ee5ee3f2 100644
--- a/src/FrameStats.zig
+++ b/src/FrameStats.zig
@@ -45,8 +45,10 @@ pub const Frame = struct {
/// The shell had no image to draw into (a busy swapchain).
skipped: bool = false,
/// The shell's motion in it: a scroll's picture offset from the text,
- /// rows (0 at rest).
+ /// rows (0 at rest), and where it drew the caret, its top in rows
+ /// (the jitter check: a caret on a fixed row must not wobble).
scroll: f32 = 0,
+ caret: f32 = 0,
/// From the first input this frame answers to its present's end, µs;
/// 0 when it answers none.
latency_us: u32 = 0,
@@ -84,6 +86,7 @@ skipped: u64 = 0,
/// What the shell sets while it draws the frame (Frame.scroll), and the
/// pump (view).
scroll: f32 = 0,
+caret: f32 = 0,
view: i32 = 0,
/// The first input not yet answered by a drawn frame, monotonic ns.
input_ns: u64 = 0,
@@ -146,6 +149,7 @@ pub fn record(stats: *FrameStats, end_ns: u64, moving: bool, skipped: bool) void
.moving = stats.armed,
.skipped = skipped,
.scroll = stats.scroll,
+ .caret = stats.caret,
.latency_us = if (stats.input_ns == 0) 0 else @max(1, us.of(stats.input_ns, end_ns)),
.view = stats.view,
.zones = stats.zone_us,
@@ -263,13 +267,13 @@ pub fn dump(stats: *const FrameStats, path: [:0]const u8) void {
.phase => |name| write.line(fd, &buf, "# phase {s} {d:.1}\n", .{ name, @as(f64, @floatFromInt((stats.demo_ns + @as(u64, step.at_ms) * std.time.ns_per_ms) -| t0)) / std.time.ns_per_ms }),
else => {},
};
- write.line(fd, &buf, "# start_ms\tupdate_us\trender_us\tpresent_us\tgap_us\tmoving\tskipped\tscroll\tlatency_us\tview", .{});
+ write.line(fd, &buf, "# start_ms\tupdate_us\trender_us\tpresent_us\tgap_us\tmoving\tskipped\tscroll\tcaret\tlatency_us\tview", .{});
inline for (comptime std.enums.values(Zone)) |which| write.line(fd, &buf, "\t{t}_us", .{which});
write.line(fd, &buf, "\tshaped\trastered\tbytes\n", .{});
for (all) |part| for (part) |f| {
- write.line(fd, &buf, "{d:.3}\t{d}\t{d}\t{d}\t{d}\t{d}\t{d}\t{d:.4}\t{d}\t{d}", .{
+ write.line(fd, &buf, "{d:.3}\t{d}\t{d}\t{d}\t{d}\t{d}\t{d}\t{d:.4}\t{d:.4}\t{d}\t{d}", .{
@as(f64, @floatFromInt(f.start_ns -| t0)) / std.time.ns_per_ms, f.update_us, f.render_us, f.present_us, f.gap_us,
- @intFromBool(f.moving), @intFromBool(f.skipped), f.scroll, f.latency_us, f.view,
+ @intFromBool(f.moving), @intFromBool(f.skipped), f.scroll, f.caret, f.latency_us, f.view,
});
for (f.zones) |us| write.line(fd, &buf, "\t{d}", .{us});
write.line(fd, &buf, "\t{d}\t{d}\t{d}\n", .{ f.shaped, f.rastered, f.bytes });