MCPcopy
hub / github.com/aio-libs/aiohttp / main

Function main

benchmark/async.py:254–299  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

252
253
254def main(argv):
255 args = ARGS.parse_args()
256
257 count = args.count
258 concurrency = args.concurrency
259 verbose = args.verbose
260 tries = args.tries
261
262 loop = asyncio.get_event_loop()
263 suite = [run_aiohttp, run_tornado, run_twisted]
264
265 suite *= tries
266 random.shuffle(suite)
267
268 all_times = collections.defaultdict(list)
269 all_rps = collections.defaultdict(list)
270 for test in suite:
271 test_name = test.__name__
272
273 rps, times = loop.run_until_complete(run(test, count, concurrency,
274 loop=loop, verbose=verbose,
275 profile=args.profile))
276 all_times[test_name].extend(times)
277 all_rps[test_name].append(rps)
278
279 if args.profile:
280 profiler.dump_stats('out.prof')
281
282 print()
283
284 for test_name in sorted(all_rps):
285 rps = all_rps[test_name]
286 times = [t * 1000 for t in all_times[test_name]]
287
288 rps_mean = mean(rps)
289 times_mean = mean(times)
290 times_stdev = stdev(times)
291 times_median = median(times)
292 print('Results for', test_name)
293 print('RPS: {:d},\tmean: {:.3f} ms,'
294 '\tstandard deviation {:.3f} ms\tmedian {:.3f} ms'
295 .format(int(rps_mean),
296 times_mean,
297 times_stdev,
298 times_median))
299 return 0
300
301ARGS = argparse.ArgumentParser(description="Run benchmark.")
302ARGS.add_argument(

Callers 1

async.pyFile · 0.70

Calls 3

extendMethod · 0.80
appendMethod · 0.80
runFunction · 0.70

Tested by

no test coverage detected