mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
f7258927ae
Runtime measurement showed this function (RAM 0x641C) and its internal branch targets (0x6430, 0x6444, 0x6458, 0x650C, 0x6514, 0x658C, 0x6594) collectively generating ~50K dirty_ram_dispatch blocks/session. The address is confirmed as a true function start via jalr call site at 0xBFC15F10. Seeding the entry point only; CFG analysis discovers all internal labels. Result: blocks_run dropped from 119,804 to 29,692 (75% reduction). Also adds tools/probe_dirty_ram.py for live dirty_ram measurement via the TCP debug server. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
import socket, json, time, sys
|
|
|
|
port = int(sys.argv[1]) if len(sys.argv) > 1 else 4470
|
|
|
|
def send_cmd(cmd, **kwargs):
|
|
payload = {'id': 1, 'cmd': cmd}
|
|
payload.update(kwargs)
|
|
s = socket.create_connection(('127.0.0.1', port), timeout=3)
|
|
s.sendall(json.dumps(payload).encode() + b'\n')
|
|
data = b''
|
|
while True:
|
|
chunk = s.recv(4096)
|
|
if not chunk:
|
|
break
|
|
data += chunk
|
|
try:
|
|
json.loads(data.decode())
|
|
break
|
|
except:
|
|
pass
|
|
s.close()
|
|
return json.loads(data.decode())
|
|
|
|
# Wait for server
|
|
for i in range(15):
|
|
try:
|
|
r = send_cmd('ping')
|
|
print(f'Connected. frame={r.get("frame")}, dispatch_miss_total={r.get("dispatch_miss_total")}')
|
|
break
|
|
except Exception as e:
|
|
print(f' waiting... ({e})')
|
|
time.sleep(2)
|
|
else:
|
|
print('Could not connect after 30s')
|
|
sys.exit(1)
|
|
|
|
# Query dirty_ram stats
|
|
try:
|
|
r = send_cmd('dirty_ram_stats')
|
|
print('dirty_ram_stats:', json.dumps(r, indent=2))
|
|
except Exception as e:
|
|
print(f'dirty_ram_stats failed: {e}')
|
|
|
|
# Also try heartbeat
|
|
try:
|
|
r = send_cmd('heartbeat')
|
|
print('heartbeat:', json.dumps(r, indent=2))
|
|
except Exception as e:
|
|
print(f'heartbeat failed: {e}')
|