From: Mark Wooding Date: Fri, 6 Sep 2024 19:55:44 +0000 (+0100) Subject: soak: Track total steps and steps within checkpoint separately. X-Git-Tag: 0.99.0~103 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/xyla/commitdiff_plain/d0b808f52e94c99573adae789885283b9ff2063f soak: Track total steps and steps within checkpoint separately. Much less awful than adjusting `nsteps'. --- diff --git a/soak b/soak index 79d4b61..6b90d0f 100755 --- a/soak +++ b/soak @@ -228,7 +228,7 @@ KID = SUB.Popen(OPTS.testprog, stdin = SUB.PIPE, stdout = SUB.PIPE) def fail(msg): SYS.stderr.write("%s: FAILED: %s\n" % (PROG, msg)) - SYS.stderr.write("%s: step = %d\n" % (PROG, STEP)) + SYS.stderr.write("%s: step = %d\n" % (PROG, CSTEP)) KID.stdin.close() KID.stdout.close() rc = KID.wait() @@ -276,10 +276,10 @@ for lv in ST.stack: put("= %s\n" % ST.cur.tree) dump_tree() -STEP = 0; nsteps = OPTS.nsteps +STEP = CSTEP = 0; nsteps = OPTS.nsteps ch = choices() while nsteps is None or STEP < nsteps: - if OPTS.sync: SYS.stdout.write("\n;; step %d\n" % STEP) + if OPTS.sync: SYS.stdout.write("\n;; step %d\n" % CSTEP) op = ch.choose(ST.rand) if op == "addrm1": @@ -391,14 +391,13 @@ while nsteps is None or STEP < nsteps: else: raise ValueError("unexpected operation `%s'" % op) - STEP += 1 + STEP += 1; CSTEP += 1 dump_tree() - if OPTS.sync or STEP == OPTS.ckpt_steps: check_tree() - if STEP == OPTS.ckpt_steps: + if OPTS.sync or CSTEP == OPTS.ckpt_steps: check_tree() + if CSTEP == OPTS.ckpt_steps: snapshot() ST.write_ckpt() - STEP = 0; OPTS.sync = False - if nsteps is not None: nsteps -= OPTS.ckpt_steps + CSTEP = 0; OPTS.sync = False while True: check_tree()