diff --git a/cpu-bench/bench.py b/cpu-bench/bench.py index 31968c2..df9d097 100755 --- a/cpu-bench/bench.py +++ b/cpu-bench/bench.py @@ -5,6 +5,7 @@ from tabulate import tabulate warnings.filterwarnings("ignore") R, G, B, W = (f'\x1b[{x}m' for x in (31, 32, 34, 0)) subprocess.run('neofetch') +print(f'{R}$ sysbench cpu --threads={core} run | grep "events per second"{W}' def speed(core): output = subprocess.run( @@ -13,7 +14,7 @@ def speed(core): return float(output) df = [] -for core in range(1, mp.cpu_count()+2): +for core in range(1, mp.cpu_count()+1): s = speed(core) row = { '#Threads': core, diff --git a/debian-cpu-benchmark/.gitignore b/debian-cpu-benchmark/.gitignore deleted file mode 100644 index df68529..0000000 --- a/debian-cpu-benchmark/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bench.csv diff --git a/debian-cpu-benchmark/bench.py b/debian-cpu-benchmark/bench.py deleted file mode 100755 index 8332a8b..0000000 --- a/debian-cpu-benchmark/bench.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python - -import subprocess, multiprocessing as mp, warnings, pandas as pd -from tabulate import tabulate -warnings.filterwarnings("ignore") -R, G, B, W = (f'\x1b[{x}m' for x in (31, 32, 34, 0)) -subprocess.run('neofetch') - -def speed(core): - output = subprocess.run( - f'sysbench cpu --threads={core} run | grep "events per second"', - shell=True, capture_output=True, text=True).stdout.split()[-1] - return float(output) - -df = [] -for core in range(1, mp.cpu_count()+2): - s = speed(core) - row = { - '#Threads': core, - 'Throughput': s, - '(per-core)': s/core - } - df.append(row) -df = pd.DataFrame(df) -df.to_csv('bench.csv', index=False) - -df.iloc[:, 0] = df.iloc[:, 0].apply(lambda s: f'{R}{s}{W}') -df.iloc[:, 1] = df.iloc[:, 1].apply(lambda s: f'{G}{int(s)}{W}') -df.iloc[:, 2] = df.iloc[:, 2].apply(lambda s: f'{B}{int(s)}{W}') -print(tabulate(df, headers='keys', tablefmt='rounded_outline', showindex=False)) \ No newline at end of file