mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 06:05:56 +00:00
Measure a change within one launch: TOTK_AB=<presents> alternates A and B blocks (A B B A), a switch set to ab is on in the B blocks, and tools/ab_summary.py compares the perf windows of each side; TOTK_ONE_PER_CORE=1 keeps one logical processor per physical core (off: no gain on a 7900X)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ab88c10e4c
commit
48dfe0cfdf
4 files changed
+112
-6
No files matched your search
@@ -0,0 +1,43 @@
|
||||
"""In-launch A/B summary of a TOTK_AB run (runtime/prof_win.c rt_ab): per perf window of 60 presents wholly in an A or a
|
||||
B block, the frame interval and the replay time; their means per side, and the B - A difference per A B B A cycle.
|
||||
|
||||
usage: ab_summary.py <log> [--from <frame>]
|
||||
"""
|
||||
import argparse
|
||||
import re
|
||||
import statistics
|
||||
import sys
|
||||
|
||||
LINE = re.compile(r'perf: frame (\d+): interval avg ([0-9.]+) ms .*replay avg ([0-9.]+) ms; ab (\d+)/(\d+)')
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument('log')
|
||||
ap.add_argument('--from', dest='lo', type=int, default=0, help='first frame counted (after the load)')
|
||||
a = ap.parse_args()
|
||||
side = {0: [], 1: []}
|
||||
for line in open(a.log, encoding='utf-8', errors='replace'):
|
||||
m = LINE.search(line)
|
||||
if not m or int(m.group(1)) < a.lo:
|
||||
continue
|
||||
b, n = int(m.group(4)), int(m.group(5))
|
||||
if b and b != n:
|
||||
continue # a window across a block edge
|
||||
side[1 if b else 0].append((int(m.group(1)), float(m.group(2)), float(m.group(3))))
|
||||
if not side[0] or not side[1]:
|
||||
print('no whole A and B windows (TOTK_AB unset, or the run too short)')
|
||||
return 1
|
||||
for k, name in ((0, 'A'), (1, 'B')):
|
||||
w = side[k]
|
||||
iv = statistics.mean(x[1] for x in w)
|
||||
rp = statistics.mean(x[2] for x in w)
|
||||
print(f'{name}: {len(w):3d} windows, interval {iv:6.2f} ms ({1000 / iv:5.1f} fps), replay {rp:5.2f} ms')
|
||||
ia, ib = statistics.mean(x[1] for x in side[0]), statistics.mean(x[1] for x in side[1])
|
||||
ra, rb = statistics.mean(x[2] for x in side[0]), statistics.mean(x[2] for x in side[1])
|
||||
print(f'B - A: interval {ib - ia:+.2f} ms ({100 * (ib - ia) / ia:+.1f}%), replay {rb - ra:+.2f} ms ({100 * (rb - ra) / ra:+.1f}%)')
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user