diff --git a/cpu-bench/bench.py b/cpu-bench/bench.py index d1d9613..8ffa1fd 100755 --- a/cpu-bench/bench.py +++ b/cpu-bench/bench.py @@ -3,10 +3,11 @@ def ensure(*packages): for pkg in packages: try: __import__(pkg) - except: import os; os.sytem(f'pip install -q {pkg}') + except: import os; os.system(f'pip install -q {pkg}') ensure('pandas', 'tabulate') import subprocess, multiprocessing as mp, warnings, pandas as pd +from tqdm.auto import tqdm from tabulate import tabulate warnings.filterwarnings("ignore") R, G, B, W = (f'\x1b[{x}m' for x in (31, 32, 34, 0)) @@ -15,7 +16,8 @@ subprocess.run('neofetch') command = lambda core: f'sysbench cpu --cpu-max-prime=20000 --time=1 --threads={core} run | grep second' -print(f'{G}$ {command("$(nproc)")}{W}') +print(f'{G}$ {command("$(nproc)")}{W}', flush=True) + def speed(core): output = subprocess.run(