cpu-benchmark: better interface
This commit is contained in:
@@ -7,20 +7,26 @@ def speed(core):
|
|||||||
output = subprocess.run(
|
output = subprocess.run(
|
||||||
f'sysbench cpu --threads={core} run | grep "events per second"',
|
f'sysbench cpu --threads={core} run | grep "events per second"',
|
||||||
shell=True, capture_output=True, text=True).stdout.split()[-1]
|
shell=True, capture_output=True, text=True).stdout.split()[-1]
|
||||||
print(output)
|
return float(output)
|
||||||
return output
|
|
||||||
except:
|
except:
|
||||||
print('\n'
|
print('\n'
|
||||||
'sudo apt-get update && sudo apt-get install -y sysbench'
|
'sudo apt-get update && sudo apt-get install -y sysbench neofetch'
|
||||||
'\tOR'
|
'\tOR'
|
||||||
'brew install sysbench'
|
'brew install sysbench neofetch'
|
||||||
'\n')
|
'\n')
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
subprocess.run('neofetch')
|
||||||
|
R, G, B, W = (f'\x1b[{x}m' for x in (31, 32, 34, 0))
|
||||||
df = []
|
df = []
|
||||||
|
print(f'\t{G}Speed\t\t{B} Speed')
|
||||||
|
print(f'\t{G}(multicore)\t{B}(per-core)')
|
||||||
for core in range(1, mp.cpu_count()+1):
|
for core in range(1, mp.cpu_count()+1):
|
||||||
|
print(f'{R}Core: {core}', end='')
|
||||||
s = speed(core)
|
s = speed(core)
|
||||||
df.append((core, s, s/core))
|
row = (core, s, s/core)
|
||||||
|
print(f'\t{G}{int(row[1]):^8}\t{B}{int(row[2]):^8}')
|
||||||
|
df.append(row)
|
||||||
|
print(W)
|
||||||
df = pd.DataFrame(df)
|
df = pd.DataFrame(df)
|
||||||
df.to_csv('bench.csv', index=False)
|
df.to_csv('bench.csv', index=False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user