INNER CODE UNIT · Python
deadline
openHiTLS/openHiTLS · testcode/benchmark/async_perf/test_async_perf.py:132
deadline = time.monotonic() + 15
while proc.poll() is None and time.monotonic() < deadline:
try:
masks = {int(p.name): sorted(os.sched_getaffinity(int(p.name)))
for p in Path(f"/proc/{proc.pid}/task").iterdir()}
if len(masks) == 3 and all(len(mask) == 1 for mask in masks.values()):
snapshots.append(masks)
except (FileNotFoundError, ProcessLookupError):
pass
time.sleep(0.02)
proc.wait(timeout=1)
finally:
if proc.poll() is None:
proc.kill()
proc.wait()
log.seek(0)
output = log.read()
if proc.returncode != 0 and "cannot bind idle physical cores" in output: