#!/usr/bin/env bash # # fps-check.sh — measure UI smoothness of JTube TV on a device while programmatically # scrolling the home rows the same way a remote would move focus. # # Usage: fps-check.sh [serial] default serial: emulator-5554 # Prereqs: app installed + logged in, on the Home destination. set -u DEV="${1:-emulator-5554}" ADB=~/Android/Sdk/platform-tools/adb echo "device $DEV: resetting frame stats" $ADB -s "$DEV" shell am force-stop net.jeena.jtubetv sleep 1 $ADB -s "$DEV" shell am start -n net.jeena.jtubetv/.MainActivity >/dev/null sleep 15 # give images time to load + settle # from top bar (search focused) DOWN into the first row, then traverse right across # the row: each RIGHT triggers one (animated) row scroll. $ADB -s "$DEV" shell input keyevent KEYCODE_DPAD_DOWN; sleep 1 $ADB -s "$DEV" shell dumpsys gfxinfo net.jeena.jtubetv reset > /dev/null for i in $(seq 1 12); do $ADB -s "$DEV" shell input keyevent KEYCODE_DPAD_RIGHT sleep 1.2 done $ADB -s "$DEV" shell input keyevent KEYCODE_DPAD_DOWN; sleep 1.5 for i in $(seq 1 6); do $ADB -s "$DEV" shell input keyevent KEYCODE_DPAD_LEFT sleep 1.2 done echo "--- gfxinfo (home rows scrolling, 18 focus moves) ---" $ADB -s "$DEV" shell dumpsys gfxinfo net.jeena.jtubetv | python3 -c " import sys, re out = sys.stdin.read() m = re.search(r'\*\* Graphics info\s*\n(.*)', out, re.S) block = m.group(1) if m else out def grab(name): mm = re.search(name + r'[^\d]*(\S+)', block) return mm.group(1) if mm else '?' total = grab('Total frames rendered') janky = grab('Janky frames') print('Total frames rendered:', total) print('Janky frames:', janky) p50, p90, p95, p99 = grab('50th percentile'), grab('90th percentile'), grab('95th percentile'), grab('99th percentile') print('frame time percentiles (ms): p50=%s p90=%s p95=%s p99=%s' % (p50, p90, p95, p99)) "