line = line.decode('utf-8') lines.append(line) if line.startswith('Requests/sec:'): rps = float(line.split()[-1]) else: break retcode = loop.run_until_complete(wrk.wait()) if retcode != 0: print('\r\n'.join(lines)) return rps if __name__ == '__main__': cpu.dump() buggers.silence() loop = uvloop.new_event_loop() argparser = argparse.ArgumentParser('do_wrk') argparser.add_argument('-s', dest='server', default='') argparser.add_argument('-e', dest='endpoint') args = argparser.parse_args(sys.argv[1:]) aio.set_event_loop(loop) server_fut = aio.create_subprocess_exec('python', 'server.py', *args.server.split()) server = loop.run_until_complete(server_fut)
return cases.base['10long'].data def get_websites(size=2 ** 18): data = b'' while len(data) < size: for c in cases.websites.values(): data += c.data return data if __name__ == '__main__': print('pid', os.getpid()) cpu.dump() buggers.silence() argparser = argparse.ArgumentParser(description='do_perf') argparser.add_argument( '-p', '--parsers', dest='parsers', default='cffi,cext') argparser.add_argument( '-b', '--benchmarks', dest='benchmarks', default='http10long,websites,websitesn') result = argparser.parse_args(sys.argv[1:]) parsers = result.parsers.split(',') benchmarks = result.benchmarks.split(',') one_shot = [b for b in benchmarks if b in ['http10long', 'websites']] multi_shot = [b for b in benchmarks if b in ['websitesn']]