diff options
Diffstat (limited to 'anim/src/syscalls.zig')
| -rw-r--r-- | anim/src/syscalls.zig | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/anim/src/syscalls.zig b/anim/src/syscalls.zig index b3e080d..e184990 100644 --- a/anim/src/syscalls.zig +++ b/anim/src/syscalls.zig @@ -28,9 +28,9 @@ const k = theme.color.on_kernel; /// one by one; the arrow goes down through the line; only then does the /// kernel's side change, the last call giving way to this one, its name, /// its rows, its card; the work is done a byte at a time (a call with -/// none skips it); the arrow comes back, and what came back strikes rax. -/// So a call is as long as what it does: `close` 4.1 s, a `read` of -/// fifteen bytes 5.2. +/// none skips it); the kernel's rows say what it returns, the arrow comes +/// back with it, and it strikes rax as the arrow lands. So a call is as +/// long as what it does: `close` 3.9 s, a `read` of fifteen bytes 5.0. pub const Plan = struct { registers: f32 = time.cascade, enters: f32 = 0.80, @@ -45,16 +45,18 @@ pub const Plan = struct { work: f32 = 2.00, fills: f32 = 2.40, bytes: f32 = 0, - /// The arrow back sets off; as it lands the `returns` row takes the - /// value; then rax is armed, and struck (nothing is marked as come - /// back before it has); the program stores what came back (memory, - /// after its cause); the mark moves on. + /// The `returns` row takes the value 6 f before the arrow back sets + /// off (the kernel answers before the answer travels); rax is armed + /// while the arrow travels and struck as it lands (nothing is marked as + /// come back before it has); everything else the step changed waits + /// for rax; the program stores what came back (memory, after its + /// cause); the mark moves on. + returns: f32 = 1.90, back: f32 = 2.00, - returns: f32 = 2.40, - struck: f32 = 2.60, - stored: f32 = 2.90, - advance: f32 = 3.50, - total: f32 = 4.10, + struck: f32 = 2.40, + stored: f32 = 2.70, + advance: f32 = 3.30, + total: f32 = 3.90, pub const cross = 0.40; pub const row = 0.10; @@ -67,8 +69,8 @@ pub const Plan = struct { const up: u64 = if (fills(call)) |span| span.len else 0; p.bytes = @floatFromInt(@max(down, @min(up, 32))); if (p.bytes > 0) p.back = p.fills + p.bytes * byte + 10.0 / 60.0; - p.returns = p.back + cross; - p.struck = p.returns + time.strike.arm; + p.returns = p.back - 6.0 / 60.0; + p.struck = p.back + cross; p.stored = p.struck + time.cascade; p.advance = p.stored + time.read_value; p.total = p.advance + time.step + time.rest; @@ -338,7 +340,7 @@ pub const Crossing = struct { const reach = 64; // Off promptly, and settling in the kernel. const up = cursors.standard(std.math.clamp((t - p.enters) / Plan.cross, 0, 1)); - const gone = std.math.clamp((t - p.returns - theme.time.quick) / theme.time.read.out, 0, 1); + const gone = std.math.clamp((t - p.struck - theme.time.quick) / theme.time.read.out, 0, 1); const v = u.faded(1 - gone); if (t < p.back) along(v, x, bottom, bottom - up * reach); if (made.exit != null and t > p.back) along(v, x + 40, bottom - reach, bottom - reach + cursors.standard(std.math.clamp((t - p.back) / Plan.cross, 0, 1)) * reach); @@ -451,12 +453,13 @@ pub const Timeline = struct { }; test "a crossing is as long as what the call does" { - // A call with no work: 4.1 s. Fifteen bytes copied up: 5.2. - try std.testing.expectApproxEqAbs(@as(f32, 4.10), Plan.of(.{ .nr = 3, .args = @splat(0), .enter = 0 }).total, 1e-3); + // A call with no work: 3.9 s. Fifteen bytes copied up: 5.0. + try std.testing.expectApproxEqAbs(@as(f32, 3.90), Plan.of(.{ .nr = 3, .args = @splat(0), .enter = 0 }).total, 1e-3); const read = Plan.of(.{ .nr = 0, .args = .{ 3, 0x1000, 32, 0, 0, 0 }, .enter = 0, .exit = 0, .result = 15 }); - try std.testing.expectApproxEqAbs(@as(f32, 5.17), read.total, 1e-2); - // What came back is read in the kernel's rows, then struck in rax, then stored. - try std.testing.expect(read.struck >= read.returns + theme.time.strike.arm and read.stored > read.struck); + try std.testing.expectApproxEqAbs(@as(f32, 4.97), read.total, 1e-2); + // What came back is in the kernel's rows before the arrow back leaves, + // struck in rax as it lands (armed on its way), then stored. + try std.testing.expect(read.returns < read.back and read.struck == read.back + Plan.cross and read.struck - time.strike.arm > read.back and read.stored > read.struck); // Nothing on the kernel's side before the arrow is through the line. try std.testing.expect(read.leaves >= read.enters and read.name >= read.enters + Plan.cross); try std.testing.expect(read.fills > read.name and read.returns > read.fills + 15 * Plan.byte); |
