All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m16s
Measured every browse transition on the onn, a Fire TV Stick 4K and a TCL TV with a new framestats harness and atrace breakdowns. - Stage card artwork and titles a few cards per frame while a section enters, so its first frame no longer composes every card at once. - Give every discovery list the lookahead cache window and nudge it once after a section settles, so the first move down composes nothing. - Activate a focused top tab two frames later, so its highlight responds before the section switches; start the page entrance after composition settles, using per-draw alpha instead of an offscreen layer. - Limit Coil to two concurrent decodes, drop the redundant window background, size card image requests explicitly, and skip a coroutine per card for focus restoration. Home -> Movies UI stalls drop from 150-200 ms to 70-90 ms and Movies row moves no longer skip frames. Device scripts can now target any authorized serial and tolerate the TCL's flaky network ADB link. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
2.6 KiB
Python
49 lines
2.6 KiB
Python
"""Trace one D-pad transition and summarize Kaleido's slow UI-thread frames.
|
|
|
|
Usage: trace_transition.py <label> <setup keys> <measured keys>
|
|
Keys are comma-separated keycodes (19 up, 20 down, 21 left, 22 right); setup runs
|
|
after launch and is not measured. Select the device with KALEIDO_DEVICE. Raw atrace
|
|
output and the summary stay in ignored evidence/private/.
|
|
"""
|
|
import collections,re,sys,time
|
|
from device import adb,OUT
|
|
from verify_ui import launch
|
|
|
|
SLICE=re.compile(r'^\s*(.+?)-(\d+)\s+\(\s*(\d+)\)\s+\[\d+\]\s+\S+\s+([\d.]+): tracing_mark_write: ([BE])\|(\d+)(?:\|(.*))?$')
|
|
|
|
def slices(text,pid):
|
|
stacks=collections.defaultdict(list);done=[]
|
|
for line in text.splitlines():
|
|
m=SLICE.match(line)
|
|
if not m or m.group(3)!=pid:continue
|
|
tid=int(m.group(2));at=float(m.group(4))*1000
|
|
if m.group(5)=='B':stacks[tid].append((m.group(7) or '',at))
|
|
elif stacks[tid]:
|
|
name,start=stacks[tid].pop();done.append((tid,len(stacks[tid]),name,start,at-start))
|
|
return done
|
|
|
|
def main():
|
|
label,setup,measured=sys.argv[1],sys.argv[2],sys.argv[3]
|
|
launch()
|
|
for code in filter(None,setup.split(',')):adb('shell','input','keyevent',code);time.sleep(1.2)
|
|
pid=adb('shell','pidof','tv.kaleido.app').decode().split()[0]
|
|
time.sleep(1)
|
|
adb('shell','atrace','--async_start','-b','16384','-a','tv.kaleido.app','gfx','view','sched','dalvik')
|
|
for code in measured.split(','):adb('shell','input','keyevent',code);time.sleep(1.5)
|
|
raw=adb('shell','atrace','--async_stop','-a','tv.kaleido.app','gfx','view','sched','dalvik').decode(errors='replace')
|
|
(OUT/f'trace-{label}.txt').write_text(raw)
|
|
found=slices(raw,pid);main_tid=int(pid)
|
|
frames=[s for s in found if s[0]==main_tid and s[2].startswith('Choreographer#doFrame')]
|
|
lines=[f'{len(frames)} UI frames; slow (>12 ms) frames with their longest nested work:']
|
|
for tid,depth,name,start,length in frames:
|
|
if length<12:continue
|
|
inner=[s for s in found if s[0]==main_tid and s[3]>=start and s[3]+s[4]<=start+length and s[1]>depth]
|
|
top=sorted(inner,key=lambda s:-s[4])[:8]
|
|
lines.append(f' {name} {length:.1f} ms')
|
|
lines+=[f' {" "*(s[1]-depth-1)}{s[2][:90]} {s[4]:.1f}' for s in sorted(top,key=lambda s:(s[3],s[1]))]
|
|
render=[s for s in found if s[2]=='DrawFrame' or s[2].startswith('DrawFrames')]
|
|
if render:lines.append(f'RenderThread DrawFrame max {max(s[4] for s in render):.1f} ms over {len(render)} frames')
|
|
(OUT/f'trace-{label}-summary.txt').write_text('\n'.join(lines)+'\n')
|
|
print('\n'.join(lines))
|
|
|
|
if __name__=='__main__':main()
|