summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/replicas.zig27
1 files changed, 21 insertions, 6 deletions
diff --git a/test/replicas.zig b/test/replicas.zig
index 637af0b3..5cddf6c8 100644
--- a/test/replicas.zig
+++ b/test/replicas.zig
@@ -284,6 +284,12 @@ const Totals = struct {
far_final: std.ArrayListUnmanaged(u64) = .empty,
queue_max: u64 = 0,
cut: u64 = 0,
+ /// How far behind the session each fell at most (Link.behind, ns), and
+ /// how often it let its link go for it: the far client, and the others.
+ far_behind: u64 = 0,
+ far_lags: u64 = 0,
+ near_behind: u64 = 0,
+ near_lags: u64 = 0,
/// What a join costs the replicas already there, ns of this process's
/// clock: the session's join step (its reloads and its dump), and each
/// client's unit that reloaded its terminals.
@@ -760,9 +766,12 @@ fn ended(cl: *Client, c: usize, net: *Net, now: u64, totals: *Totals, run_: Run,
const r = cl.r.?;
const link = &cl.loop.link;
// Its link ended by the session (a Detach), it says nothing more.
- if (!link.gone) replica.bye(link.fd, r.diverged != null);
+ if (!link.gone) replica.bye(link.fd, r.diverged != null or link.lagged != 0);
try drain(cl, c, net, now);
cl.live = 0;
+ if (link.lagged != 0) {
+ if (net.throttled == @as(?usize, c)) totals.far_lags += 1 else totals.near_lags += 1;
+ }
if (r.diverged) |why| {
if (link.put_off) totals.rejoined += 1 else {
totals.divergences += 1;
@@ -1515,6 +1524,8 @@ const Soak = struct {
const t0 = monoNs();
cl.loop.take(.{ .unit = try std.heap.c_allocator.dupe(u8, m.bytes) });
if (pardes.Term.reloads.n != reloads) try s.totals.join_client_ns.append(gpa, monoNs() - t0);
+ const behind = if (net.throttled == @as(?usize, c)) &s.totals.far_behind else &s.totals.near_behind;
+ behind.* = @max(behind.*, cl.loop.link.behind);
},
.word => cl.loop.take(.{ .refused = try std.heap.c_allocator.dupe(u8, m.bytes) }),
.blob => cl.loop.take(.{ .blob = try std.heap.c_allocator.dupe(u8, m.bytes) }),
@@ -3082,16 +3093,20 @@ pub fn main(init: std.process.Init) !void {
for (t.stops) |st| if (st.n > 0) try stop_lines.print(gpa, "{s}:{d} ", .{ st.name, st.n });
try stop_lines.append(gpa, '\n');
try join_lines.print(gpa, "{d:>4} {d:>5} {d:>7} {d:>8} {d:>8} {d:>6} {d:>5}/{d:<5} {d:>5}/{d:<6} {d:>7} {d:>5}/{d}/{d}\n", .{ rtt, t.joins, t.refused, t.rejoined, t.detached, t.detach_words, t.agree, t.differ, t.checks, t.units, t.resizes, t.kind_panes[0], t.kind_panes[1], t.kind_panes[2] });
- try far_lines.print(gpa, "{d:>4} {d:>5} {d:>6.1}/{d:<6.1} {d:>6.1}/{d:<6.1} {d:>8} {d:>3} {d:>6.1}/{d:<6.1} {d:>6.1}/{d:<6.1} ({d})\n", .{
- rtt, t.far_joins,
+ try far_lines.print(gpa, "{d:>4} {d:>5} {d:>4} {d:>6.1}/{d:<6.1} {d:>6.1}/{d:<6.1} {d:>8} {d:>3} {d:>6.1}/{d:<6.1} {d:>6.1}/{d:<6.1} ({d}) {d:>6.0}/{d:<6.0} {d}\n", .{
+ rtt, t.far_joins, t.far_lags,
secs(pct(t.far_gaps.items, 50)), secs(pct(t.far_gaps.items, 100)),
secs(pct(t.far_final.items, 50)), secs(pct(t.far_final.items, 100)),
t.queue_max >> 10, t.cut,
msOf(pct(t.join_session_ns.items, 50)), msOf(pct(t.join_session_ns.items, 100)),
msOf(pct(t.join_client_ns.items, 50)), msOf(pct(t.join_client_ns.items, 100)),
t.join_client_ns.items.len,
+ msOf(t.far_behind), msOf(t.near_behind),
+ t.near_lags,
});
- if (t.far_final.items.len < seeds and clients >= 5) failed = true;
+ // The far client shows the final screen in every run, and the near
+ // ones never fall behind with it.
+ if ((t.far_final.items.len < seeds and clients >= 3) or t.near_lags > 0) failed = true;
if (t.divergences > 0 or t.unequal > 0 or t.screens_wrong > 0 or t.differ > 0 or t.unlisted > 0) failed = true;
}
std.debug.print("terminals: deltas a replica applied a second under the flood; a peer's bytes a second under the flood (deltas, units); encode a frame of the flood for every peer, apply a delta (us); rows fetched, KB of rows sent before the step that read them; resets; deltas checked/wrong\n", .{});
@@ -3100,8 +3115,8 @@ pub fn main(init: std.process.Init) !void {
std.debug.print(" rtt joins refused rejoined detached detach agree/differ checks/units resizes kinds\n{s}", .{join_lines.items});
std.debug.print("stops: the wakes the clients' loops asked, the frames they drew, the yanks, pastes and links their frontends did (y/p/l), and what stopped their inputs (a stop counted again as its input is applied again), by name; those at a name replica.may_wait does not list fail the run\n", .{});
std.debug.print(" rtt unlisted wakes draws y/p/l stops\n{s}", .{stop_lines.items});
- std.debug.print("far: the third client's link 1 Mbit/s and 200 ms each way (zstd's bytes): its joins from a dump, s between two from the flood's start (p50/max), s from the flood's end to its final screen (p50/max: a run that never shows it fails), the session's queue for it at most, clients cut off; a join's cost to the replicas there before it, ms on this process's clock (p50/max): the session's step (reloads and dump), a client's unit (reloads), how many\n", .{});
- std.debug.print(" rtt joins refresh s final s queue KB cut session ms client ms\n{s}", .{far_lines.items});
+ std.debug.print("far: the third client's link 1 Mbit/s and 200 ms each way (zstd's bytes): its joins from a dump, of them for its lag (Link.behind past replica.behind_max_ms), s between two from the flood's start (p50/max), s from the flood's end to its final screen (p50/max: a run that never shows it fails), the session's queue for it at most, clients cut off; a join's cost to the replicas there before it, ms on this process's clock (p50/max): the session's step (reloads and dump), a client's unit (reloads), how many; ms behind the session at most (Link.behind), the far client and the others, and the others' joins for it (0, or the run fails)\n", .{});
+ std.debug.print(" rtt joins lags refresh s final s queue KB cut session ms client ms behind far/near ms\n{s}", .{far_lines.items});
if (failed) std.process.exit(1);
}