debian-cpu-benchmark: initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.ipynb_checkpoints
|
||||||
18
debian-cpu-benchmark/bench.py
Normal file
18
debian-cpu-benchmark/bench.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
df = []
|
||||||
|
for core in range(1, mp.cpu_count()+1):
|
||||||
|
s = speed(core)
|
||||||
|
df.append((core, s, s/core))
|
||||||
|
df = pd.DataFrame(df)
|
||||||
|
df.to_csv('bench.csv', index=False)
|
||||||
Reference in New Issue
Block a user