36 lines
1.5 KiB
Python
36 lines
1.5 KiB
Python
import json, sys
|
|
|
|
SKIP = {'rng','rng_words_in','rng_left_in','server','host','out_name','results',
|
|
'queen','slavers','server_cached','host_plus_0x54','sites','thresholds'}
|
|
|
|
def val(x):
|
|
if isinstance(x, dict) and 't' in x:
|
|
v = x.get('v')
|
|
if x['t'] == 'struct' and isinstance(v, dict):
|
|
return {k: val(w) for k, w in v.items()}
|
|
if x['t'] == 'list' and isinstance(v, list):
|
|
return [val(w) for w in v]
|
|
return v
|
|
return x
|
|
|
|
for path in sys.argv[1:]:
|
|
print("="*72); print(path)
|
|
for ln in open(path):
|
|
r = json.loads(ln)
|
|
if 'hook' not in r:
|
|
print("meta:", r.get('build_id') or list(r)[:6]); continue
|
|
hook = r['hook']; depth = r.get('depth')
|
|
side = r.get('side') or {}
|
|
rng = side.get('rng') or {}
|
|
b = val(rng.get('before')) or {}; a = val(rng.get('after')) or {}
|
|
bw, aw = b.get('words'), a.get('words')
|
|
d = (aw - bw) if isinstance(aw, int) and isinstance(bw, int) else None
|
|
print(f"[d{depth}] {hook:52s} words {bw} -> {aw} DELTA {d}")
|
|
for arg in (r.get('args') or []):
|
|
n = arg.get('n')
|
|
if n in SKIP: continue
|
|
print(f" {n} = {json.dumps(val(arg))}")
|
|
for nm, s in side.items():
|
|
if nm == 'rng': continue
|
|
print(f" side[{nm}] {json.dumps(val(s.get('before')))} -> {json.dumps(val(s.get('after')))}")
|
|
if r.get('err'): print(" ERR", r['err'])
|