summaryrefslogtreecommitdiff
path: root/src/FrameStats.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/FrameStats.zig')
-rw-r--r--src/FrameStats.zig73
1 files changed, 71 insertions, 2 deletions
diff --git a/src/FrameStats.zig b/src/FrameStats.zig
index ee5ee3f2..cf3b00d3 100644
--- a/src/FrameStats.zig
+++ b/src/FrameStats.zig
@@ -45,8 +45,9 @@ 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), and where it drew the caret, its top in rows
- /// (the jitter check: a caret on a fixed row must not wobble).
+ /// rows (0 at rest), or a focused PDF's strip as drawn, pixels down
+ /// the document; 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;
@@ -286,6 +287,8 @@ pub const Step = struct {
act: union(enum) {
/// Wheel notches, down positive, as a mouse's.
wheel: i8,
+ /// A touchpad's scroll, lines down, a fraction (no notch).
+ touch: f32,
key: pardes.Key,
/// A named stretch of the run starts (the dump lists them).
phase: []const u8,
@@ -316,6 +319,7 @@ pub fn named(name: []const u8) ?[]const Step {
if (std.mem.eql(u8, name, "stress")) return &stress;
if (std.mem.eql(u8, name, "kinds")) return &kinds;
if (std.mem.eql(u8, name, "panes")) return &panes;
+ if (std.mem.eql(u8, name, "pdf-scroll")) return &pdf_scroll;
if (std.mem.eql(u8, name, "one")) return &one;
if (std.mem.eql(u8, name, "jumps")) return &jumps;
if (std.mem.eql(u8, name, "longlines")) return &longlines;
@@ -449,6 +453,71 @@ fn scrollSet(steps: []Step, n: *usize, t: *u32) void {
t.* += 500;
}
+/// A PDF's strip put through what moves it (anim 11): a wheel's notches,
+/// then spun; PageDown held; the far jumps ge and gg; a Look at a page and
+/// Back; then slow: a notch at a time, and a touchpad's drag a pixel or so
+/// a frame.
+pub const pdf_scroll = blk: {
+ @setEvalBranchQuota(20_000);
+ var steps: [512]Step = undefined;
+ var n: usize = 0;
+ var t: u32 = 1500;
+ const at = struct {
+ fn add(s: []Step, k: *usize, ms: u32, act: @FieldType(Step, "act")) void {
+ s[k.*] = .{ .at_ms = ms, .act = act };
+ k.* += 1;
+ }
+ };
+ at.add(&steps, &n, t, .{ .exec = "Look ../../docs/design.pdf" });
+ t += 2000;
+ at.add(&steps, &n, t, .{ .phase = "spin" });
+ for (0..6) |_| {
+ at.add(&steps, &n, t, .{ .wheel = 1 });
+ t += 150;
+ }
+ for (0..60) |_| {
+ at.add(&steps, &n, t, .{ .wheel = 1 });
+ t += 8;
+ }
+ t += 600;
+ for (0..30) |_| {
+ at.add(&steps, &n, t, .{ .wheel = -1 });
+ t += 8;
+ }
+ t += 600;
+ at.add(&steps, &n, t, .{ .phase = "held-pagedown" });
+ for (0..20) |_| {
+ at.add(&steps, &n, t, .{ .key = .{ .cp = pardes.Key.page_down } });
+ t += 33;
+ }
+ t += 600;
+ at.add(&steps, &n, t, .{ .phase = "far-jump" });
+ for ([_][]const u8{ "e", "g" }) |second| {
+ at.add(&steps, &n, t, .{ .key = .{ .cp = 'g', .text = "g" } });
+ at.add(&steps, &n, t + 20, .{ .key = .{ .cp = second[0], .text = second } });
+ t += 800;
+ }
+ at.add(&steps, &n, t, .{ .exec = "Look ../../docs/design.pdf:12" });
+ t += 800;
+ at.add(&steps, &n, t, .{ .key = .{ .cp = 'o', .ctrl = true } });
+ t += 800;
+ at.add(&steps, &n, t, .{ .phase = "slow-notches" });
+ for (0..8) |_| {
+ at.add(&steps, &n, t, .{ .wheel = 1 });
+ t += 300;
+ }
+ at.add(&steps, &n, t, .{ .phase = "slow-touch" });
+ for (0..120) |_| {
+ at.add(&steps, &n, t, .{ .touch = 0.06 });
+ t += 16;
+ }
+ t += 600;
+ at.add(&steps, &n, t, .{ .phase = "done" });
+ at.add(&steps, &n, t, .end);
+ const out = steps[0..n].*;
+ break :blk out;
+};
+
/// `scrollSet` alone, on the file the session opened: one kind, for a
/// profiler's run.
pub const one = blk: {