MCPcopy Index your code
hub / github.com/python/cpython / main

Function main

Tools/ftscalingbench/ftscalingbench.py:401–433  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

399
400
401def main(opts):
402 global WORK_SCALE
403 if not hasattr(sys, "_is_gil_enabled") or sys._is_gil_enabled():
404 sys.stderr.write("expected to be run with the GIL disabled\n")
405
406 benchmark_names = opts.benchmarks
407 if benchmark_names:
408 for name in benchmark_names:
409 if name not in ALL_BENCHMARKS:
410 sys.stderr.write(f"Unknown benchmark: {name}\n")
411 sys.exit(1)
412 else:
413 benchmark_names = ALL_BENCHMARKS.keys()
414
415 WORK_SCALE = opts.scale
416
417 if not opts.baseline_only:
418 initialize_threads(opts)
419
420 do_bench = not opts.baseline_only and not opts.parallel_only
421 for name in benchmark_names:
422 func = ALL_BENCHMARKS[name]
423 if do_bench:
424 benchmark(func)
425 continue
426
427 if opts.parallel_only:
428 delta_ns = bench_parallel(func)
429 else:
430 delta_ns = bench_one_thread(func)
431
432 time_ms = delta_ns / 1_000_000
433 print(f"{func.__name__:<18} {time_ms:.1f} ms")
434
435
436if __name__ == "__main__":

Callers 1

ftscalingbench.pyFile · 0.70

Calls 7

initialize_threadsFunction · 0.85
bench_parallelFunction · 0.85
bench_one_threadFunction · 0.85
benchmarkFunction · 0.70
writeMethod · 0.45
exitMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…