Created
January 28, 2022 17:59
-
-
Save maguec/bdd78f419ac26dd19b7e13ae04473acf to your computer and use it in GitHub Desktop.
Creating a 3d gnuplot file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import json | |
import glob | |
x_axis = 'threads' | |
y_axis = 'clients' | |
z_axis = 'Ops/sec' | |
planes = 'pipeline' | |
plane_labels = [1, 5, 10, 15, 20] | |
outfs = {} | |
for plane in plane_labels: | |
outfs[plane] = open('gnuplot_{}_{}.dat'.format(planes, plane), "w") | |
path = sys.argv[1] | |
for f1 in glob.glob("{}/*.json".format(path)): | |
f1json = json.load(open(f1)) | |
outfs[f1json['configuration'][planes]].write( | |
"{} {} {}\n".format(f1json['configuration'][x_axis], f1json['configuration'][y_axis], f1json['ALL STATS']['Totals'][z_axis]) | |
) | |
for x, y in outfs.items(): | |
y.close() | |
message = f""" | |
set title "{z_axis}" | |
set dgrid3d 50,50 | |
set xlabel "{x_axis}" | |
set ylabel "{y_axis}" | |
set zlabel "{z_axis}" | |
""" | |
setup = open("gnuplot.setup", "w") | |
setup.write(message) | |
setup.close() | |
setup = open("gnuplot_{}.setup".format(planes), "w") | |
setup.write(message) | |
setup.close() | |
message = f""" | |
set title "{z_axis}" | |
set dgrid3d 50,50 | |
set xlabel "{x_axis}" | |
set ylabel "{y_axis}" | |
set zlabel "{z_axis}" | |
""" | |
message += "splot " | |
for x in plane_labels: | |
message += f""" "gnuplot_{planes}_{x}.dat" using 1:2:3 title '{planes} {x}' with lines""" | |
if x != plane_labels[-1]: | |
message += ',' | |
message += '\n' | |
setup = open("gnuplot.setup", "w") | |
setup.write(message) | |
setup.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment