INNER CODE UNIT · Python

run_batch

openHiTLS/openHiTLS · testcode/benchmark/async_perf/run_async_perf.py:85

def run_batch(args, scenario):
    processes = []
    error = None
    with tempfile.TemporaryFile(mode="w+") as server_log, tempfile.TemporaryFile(mode="w+") as client_log:
        # Separate read descriptor: a shared file offset would interfere with the server's writes.
        with open(f"/proc/self/fd/{server_log.fileno()}") as reader:
            try:
                server = subprocess.Popen(server_command(args) + ["-a", scenario],
                                          stdout=server_log, stderr=server_log)
                processes.append(server)
                cpus = wait_ready(server, reader)
                if cpus is not None:
                    protocol = "tls12" if "-tls12-" in scenario else "tls13"
                    for index in range(args.concurrency):
                        pin = None
                        if cpus:
                            cpu = cpus[index % len(cpus)]
                            pin = lambda cpu=cpu: os.sched_setaffinity(0, {cpu})

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…