Skip to content

Commit 3ee6ee9

Browse files
committed
just run gnuplot automatically
1 parent 9578425 commit 3ee6ee9

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

libexec/scaling

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@ def save(benchmarks):
123123
for row in table(benchmarks):
124124
f.write(' '.join([str(x) for x in row])+'\n')
125125

126+
def plot():
127+
import os,shutil,subprocess
128+
if shutil.which('gnuplot'):
129+
g = os.path.dirname(os.path.abspath(__file__))+'/scaling.gpl'
130+
r = subprocess.run(['gnuplot',g], capture_output=True, text=True)
131+
print(r.stdout)
132+
if r.returncode == 0:
133+
with open('scaling.svg','w') as f:
134+
f.write(r.stdout)
135+
print('Created scaling.svg from scaling.txt and scaling.gpl!')
136+
else:
137+
print(r.stderr)
138+
else:
139+
print('Warning: gnuplot is not in $PATH.')
140+
126141
if __name__ == '__main__':
127142
cfg = cli()
128143
import os
@@ -133,4 +148,5 @@ if __name__ == '__main__':
133148
benchmarks.append([threads, benchmark(cfg, threads, log)])
134149
show(benchmarks)
135150
save(benchmarks)
151+
plot()
136152

0 commit comments

Comments
 (0)