debian-cpu-benchmark add sysbench install guide

This commit is contained in:
Jaewook Lee
2024-08-12 17:05:58 +09:00
parent b1dd7f43a9
commit ba159467f2

View File

@@ -1,17 +1,20 @@
#!/usr/bin/env python3
import subprocess, multiprocessing as mp, pandas as pd
subprocess.run("sudo apt-get update && sudo apt-get install -y sysbench",
shell=True, stdout=subprocess.PIPE)
def speed(core):
output = subprocess.getoutput(
f'sysbench cpu --threads={core} run | grep "events per second"')
output = float(output.split()[-1])
print(output)
return output
try:
output = subprocess.run(
f'sysbench cpu --threads={core} run | grep "events per second"',
shell=True, capture_output=True, text=True).stdout.split()[-1]
print(output)
return output
except:
print('\n'
'sudo apt-get update && sudo apt-get install -y sysbench'
'\tOR'
'brew install sysbench'
'\n')
raise
df = []
for core in range(1, mp.cpu_count()+1):
s = speed(core)