runtime capture: registry heartbeat decodes live DSP tables (WIN 0.540658, freq-axis@48k, per-bin weights), rtsnap_fast/findctx/rtchunk infra
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
import subprocess, os, glob, time, struct
|
||||
def mem_open(pid): return os.open(f'/proc/{pid}/mem', os.O_RDONLY)
|
||||
def find_host(proc, wait=120):
|
||||
t0=time.time()
|
||||
while time.time()-t0<wait:
|
||||
for p in glob.glob('/proc/[0-9]*'):
|
||||
try:
|
||||
pid=int(os.path.basename(p))
|
||||
cmd=open(f'/proc/{pid}/cmdline','rb').read().replace(b'\0',b' ').decode('utf8','replace')
|
||||
maps=open(f'/proc/{pid}/maps').read()
|
||||
except Exception: continue
|
||||
if 'yabridge-host' in cmd and 'soothe2' in maps: return pid
|
||||
time.sleep(0.05)
|
||||
return None
|
||||
os.system("pkill -9 -x reaper 2>/dev/null; pkill -9 -f '[y]abridge' 2>/dev/null; sleep 1")
|
||||
proc=subprocess.Popen(['/usr/bin/reaper','-nosplash','-ignoreerrors','-renderproject','/home/m/soothe-bt/dual300.rpp'],
|
||||
stdout=open('/dev/null','w'),stderr=subprocess.STDOUT)
|
||||
host=find_host(proc); print('host',host)
|
||||
time.sleep(4)
|
||||
fd=mem_open(host)
|
||||
SIG=struct.pack('<I',0x472c4400)
|
||||
t0=time.time(); total=0; hits={}
|
||||
for line in open(f'/proc/{host}/maps').read().splitlines():
|
||||
p=line.split(); lo,hi=(int(x,16) for x in p[0].split('-'))
|
||||
if 'r' not in p[1]: continue
|
||||
t0r=time.time()
|
||||
ok_read=0
|
||||
a=lo
|
||||
while a<hi:
|
||||
n=min(hi-a, 0x400000)
|
||||
try:
|
||||
d=os.pread(fd,n,a)
|
||||
except Exception:
|
||||
a+=n; continue
|
||||
if not d:
|
||||
a+=n; continue
|
||||
ok_read+=len(d)
|
||||
i=0
|
||||
while True:
|
||||
i=d.find(SIG,i)
|
||||
if i<0: break
|
||||
hits[a+i]=None; i+=1
|
||||
a+=n
|
||||
if ok_read:
|
||||
print(' 0x%x-%x MB=%.1f ok=%.1fMB'%(lo,hi,(hi-lo)/1e6,ok_read/1e6))
|
||||
total+=ok_read
|
||||
print('scanned ok=%.0fMB t=%.1fs n44100=%d'%(total/1e6,time.time()-t0,len(hits)))
|
||||
for a in list(hits)[:5]:
|
||||
print(' HIT 0x%x'%a)
|
||||
proc.kill()
|
||||
Reference in New Issue
Block a user