diff --git a/benchmarks/graphGen.py b/benchmarks/graphGen.py index 7c16a457..de8b70ce 100755 --- a/benchmarks/graphGen.py +++ b/benchmarks/graphGen.py @@ -3,9 +3,8 @@ import subprocess import sys import json import plotly.graph_objects as go +from plotly.subplots import make_subplots -coremarkData = {} -embenchData = {} debug = True def loadCoremark(): @@ -21,61 +20,85 @@ def loadCoremark(): if (debug): print(coremarkData) return coremarkData -def loadEmbench(): +def loadEmbench(embenchPath, embenchData): """loads the embench data dictionary""" - embenchPath = "embench/wallySpeed.json" f = open(embenchPath) embenchData = json.load(f) if (debug): print(embenchData) return embenchData -def graphEmbench(embenchData): - ydata = list(embenchData["speed results"]["detailed speed results"].keys()) + ["speed geometric mean","speed geometric sd","speed geometric range"] - xdata = list(embenchData["speed results"]["detailed speed results"].values()) + [embenchData["speed results"]["speed geometric mean"],embenchData["speed results"]["speed geometric sd"],embenchData["speed results"]["speed geometric range"]] - fig = go.Figure(go.Bar( +def graphEmbench(embenchSpeedOpt_SpeedData, embenchSizeOpt_SpeedData, embenchSpeedOpt_SizeData, embenchSizeOpt_SizeData): + fig = make_subplots(rows=2, cols=4, + # subplot_titles( "Wally's Embench Cycles and Instret (with -O2)","Wally's Embench Cycles Per Instruction (with -O2)")) + subplot_titles=( "Wally's Embench Cycles and Instret (with -O2)","Wally's Embench Cycles Per Instruction (with -O2)","Wally's Embench Speed Score (with -O2)","Wally's Embench Size Score (with -O2)", + "Wally's Embench Cycles and Instret (with -Os)","Wally's Embench Cycles Per Instruction (with -Os)","Wally's Embench Speed Score (with -Os)","Wally's Embench Size Score (with -Os)")) + + ydata = list(embenchSpeedOpt_SpeedData["speed results"]["detailed speed results"].keys()) + ["speed geometric mean","speed geometric sd","speed geometric range"] + xdata = list(embenchSpeedOpt_SpeedData["speed results"]["detailed speed results"].values()) + [embenchSpeedOpt_SpeedData["speed results"]["speed geometric mean"],embenchSpeedOpt_SpeedData["speed results"]["speed geometric sd"],embenchSpeedOpt_SpeedData["speed results"]["speed geometric range"]] + + fig.add_trace( go.Bar( y=ydata, x=xdata, - orientation='h')) + textposition='outside', text=xdata, + orientation='h'), + row=1,col=3) - fig.show() + ydata = list(embenchSizeOpt_SpeedData["speed results"]["detailed speed results"].keys()) + ["speed geometric mean","speed geometric sd","speed geometric range"] + xdata = list(embenchSizeOpt_SpeedData["speed results"]["detailed speed results"].values()) + [embenchSizeOpt_SpeedData["speed results"]["speed geometric mean"],embenchSizeOpt_SpeedData["speed results"]["speed geometric sd"],embenchSizeOpt_SpeedData["speed results"]["speed geometric range"]] + + fig.add_trace( go.Bar( + y=ydata, + x=xdata, + textposition='outside', text=xdata, + orientation='h'), + row=2,col=3) + + + ydata = list(embenchSpeedOpt_SizeData["size results"]["detailed size results"].keys()) + ["size geometric mean","size geometric sd","size geometric range"] + xdata = list(embenchSpeedOpt_SizeData["size results"]["detailed size results"].values()) + [embenchSpeedOpt_SizeData["size results"]["size geometric mean"],embenchSpeedOpt_SizeData["size results"]["size geometric sd"],embenchSpeedOpt_SizeData["size results"]["size geometric range"]] + + fig.add_trace( go.Bar( + y=ydata, + x=xdata, + textposition='outside', text=xdata, + orientation='h'), + row=1,col=4) + + ydata = list(embenchSizeOpt_SizeData["size results"]["detailed size results"].keys()) + ["size geometric mean","size geometric sd","size geometric range"] + xdata = list(embenchSizeOpt_SizeData["size results"]["detailed size results"].values()) + [embenchSizeOpt_SizeData["size results"]["size geometric mean"],embenchSizeOpt_SizeData["size results"]["size geometric sd"],embenchSizeOpt_SizeData["size results"]["size geometric range"]] + + fig.add_trace( go.Bar( + y=ydata, + x=xdata, + textposition='outside', text=xdata, + orientation='h'), + row=2,col=4) + + # facet_row="Score", facet_col="Optimization Flag", + # category_orders={"Score": ["Cycles & Instr", "CPI", "SpeedScore", "SizeScore"], + # "Optimization Flag": ["O2", "Os"]}), + # orientation='h') + fig.update_layout(height=1500,width=4000, title_text="Wally Embench Scores", showlegend=False) + + fig.write_image("figure.png", engine="kaleido") + # fig.show() def main(): - coremarkData = loadCoremark() - embenchData = loadEmbench() - graphEmbench(embenchData) + coremarkData = {} + embenchSizeOpt_SpeedData = {} + embenchSpeedOpt_SpeedData = {} + embenchSizeOpt_SizeData = {} + embenchSpeedOpt_SizeData = {} + # coremarkData = loadCoremark() + embenchSpeedOpt_SpeedData = loadEmbench("embench/wallySpeedOpt_speed.json", embenchSpeedOpt_SpeedData) + embenchSizeOpt_SpeedData = loadEmbench("embench/wallySizeOpt_speed.json", embenchSizeOpt_SpeedData) + embenchSpeedOpt_SizeData = loadEmbench("embench/wallySpeedOpt_size.json", embenchSpeedOpt_SizeData) + embenchSizeOpt_SizeData = loadEmbench("embench/wallySizeOpt_size.json", embenchSizeOpt_SizeData) + + graphEmbench(embenchSpeedOpt_SpeedData, embenchSizeOpt_SpeedData, embenchSpeedOpt_SizeData, embenchSizeOpt_SizeData) if __name__ == '__main__': sys.exit(main()) -# x = -# y = - -# df = px.data.tips() -# fig = px.bar(df, x="total_bill", y="day", orientation='h') -# fig.show() -# import plotly.express as px - - -# result = sp.run(['ls', '-l'], stdout=sp.PIPE) -# result.stdout - -# fig = go.Figure( go.Bar( -# x=[], -# y=[], -# color="species", -# facet_col="species", -# title="Using update_traces() With Plotly Express Figures"), -# orientation='h') - -# fig.show() - -# -# "ls -Art ../addins/embench-iot/logs/*speed* | tail -n 1 " # gets most recent embench speed log -# "ls -Art ../addins/embench-iot/logs/*size* | tail -n 1 " # gets most recent embench speed log - -## get coremark score - -# cat coremarkPath | grep "CoreMark 1.0" | cut -d ':' -f 2 | cut -d " " -f 2 -# cat coremarkPath | grep "MTIME" | cut -d ':' -f 2 | cut -d " " -f 2 | tail -1 -# cat coremarkPath | grep "MINSTRET" | cut -d ':' -f 2 | cut -d " " -f 2 | tail -1 \ No newline at end of file +# "ls -Art ../addins/embench-iot/logs/*speed* | tail -n 1 " # gets most recent embench speed log \ No newline at end of file