"""The tail of the GPU rail's idle hold. n=112 was too thin to bound a 1 s wait.""" import time, statistics exec(open('rails.py').read().split('import time, subprocess, sys')[0]) prev = sample(); last = time.perf_counter(); gaps = [] t_end = time.perf_counter() + 90.0 while time.perf_counter() < t_end: time.sleep(0.002) cur = sample() d = IOR.IOReportCreateSamplesDelta(prev, cur, None) if sum(v for _g,_sg,n,_u,v in rails(d) if n == "GPU Energy") > 0: now = time.perf_counter(); gaps.append((now-last)*1e3); last = now; prev = cur gaps.sort() n = len(gaps) over = [g for g in gaps if g > 1000.0] print(f"idle gaps n={n} over 90 s") for q in (50, 90, 95, 99): print(f" p{q}: {gaps[min(int(q/100*n), n-1)]:8.1f} ms") print(f" max: {gaps[-1]:8.1f} ms") print(f" gaps exceeding RAIL_EDGE_WAIT (1000 ms): {len(over)} {[round(g) for g in over[:8]]}")