scripts: bench.py: Fixed issue with double summing bench probes

This little per-process counters weren't updated in the move to
cumulative-by-default probes, and were summing already cumulative
results.

I was looking at something like 3 trillion bytes read and was thinking
there was no way that could be right.
This commit is contained in:
Christopher Haster
2026-02-10 13:18:13 -06:00
parent 1be93a2a3e
commit a8b5a17933
+11 -4
View File
@@ -1213,6 +1213,7 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
last_stdout = co.deque(maxlen=args.get('context', 5) + 1) last_stdout = co.deque(maxlen=args.get('context', 5) + 1)
last_assert = None last_assert = None
last_runtime = time.time() last_runtime = time.time()
last_probes = {}
try: try:
while True: while True:
# parse a line for state changes # parse a line for state changes
@@ -1244,6 +1245,7 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
last_stdout.clear() last_stdout.clear()
last_assert = None last_assert = None
last_runtime = time.time() last_runtime = time.time()
last_probes.clear()
elif op == 'finished': elif op == 'finished':
# force a failure # force a failure
if args.get('fail'): if args.get('fail'):
@@ -1255,6 +1257,13 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
passed_suite_perms[suite] += 1 passed_suite_perms[suite] += 1
passed_case_perms[case] += 1 passed_case_perms[case] += 1
passed_perms += 1 passed_perms += 1
# update totals for summary
readed += sum(readed
for readed, _, _ in last_probes.values())
progged += sum(progged
for _, progged, _ in last_probes.values())
erased += sum(erased
for _, _, erased in last_probes.values())
elif op == 'skipped': elif op == 'skipped':
locals.seen_perms += 1 locals.seen_perms += 1
elif op == 'assert': elif op == 'assert':
@@ -1306,10 +1315,8 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
'bench_simtime': simtime_, 'bench_simtime': simtime_,
'bench_runtime': '%.6f' % ( 'bench_runtime': '%.6f' % (
time.time() - last_runtime)}) time.time() - last_runtime)})
# keep track of total for summary # keep track of totals for summary
readed += readed_ last_probes[probe_] = (readed_, progged_, erased_)
progged += progged_
erased += erased_
except KeyboardInterrupt: except KeyboardInterrupt:
proc.kill() proc.kill()
raise BenchFailure(last_id, 0, list(last_stdout)) raise BenchFailure(last_id, 0, list(last_stdout))