"""Run against the foreground SystemProbe. All missing/error outcomes are retained.""" import csv, subprocess, sys, time import grpc from pathlib import Path from inject import inject def adb(*args): return subprocess.check_output(["adb",*args],text=True,stderr=subprocess.DEVNULL).strip() def event(token): lines=adb("logcat","-d","-s","HexMeasure:I").splitlines() return [l.split(token+"|",1)[1] for l in lines if token+"|" in l] def start(op,token,lang): adb("shell","am","start","-n","local.hex.measure/.SystemProbe","--es","op",op,"--es","id",token,"--es","lang",lang) def uptime_ms(): return float(adb("shell","cat","/proc/uptime").split()[0])*1000 def trial(row): token="clip"+row["id"]+"_"+str(time.monotonic_ns()) locale={"en":"en-US","es":"es-ES","de":"de-DE","no":"nb-NO"}[row["lang"]] start("recognize",token,locale) end=None;deadline=time.monotonic()+7 while time.monotonic()