all repos — mgba @ 7e36ee16487f20f463aa25ee190c53ad04785e9f

mGBA Game Boy Advance Emulator

Tools: Add exponential backoff retrying, print last result
Vicki Pfau vi@endrift.com
Tue, 09 Mar 2021 21:01:42 -0800
commit

7e36ee16487f20f463aa25ee190c53ad04785e9f

parent

93631592d1589ed9da9c1213835cca0583b19ecc

1 files changed, 13 insertions(+), 2 deletions(-)

jump to
M tools/perf.pytools/perf.py

@@ -71,6 +71,7 @@ return ['-F', str(self.frames)]

class PerfServer(object): ITERATIONS_PER_INSTANCE = 50 + RETRIES = 5 def __init__(self, address, root='/', command=None): s = address.rsplit(':', 1)

@@ -100,8 +101,17 @@ server_command.append('-N')

elif test.renderer == 'threaded-software': server_command.append('-T') subprocess.check_call(server_command) - time.sleep(4) - self.socket = socket.create_connection(self.address, timeout=1000) + time.sleep(1) + for backoff in range(self.RETRIES): + try: + self.socket = socket.create_connection(self.address, timeout=1000) + break + except OSError as e: + print("Failed to connect:", e) + if backoff < self.RETRIES - 1: + time.sleep(2 ** backoff) + else: + raise kwargs = {} if sys.version_info[0] >= 3: kwargs["encoding"] = "utf-8"

@@ -158,6 +168,7 @@ for test in self.tests:

print('Running test {}'.format(test.name), file=sys.stderr) if self.server: self.server.run(test) + print(self.server.results[-1]) else: try: test.run(self.cwd)