@@ -10,17 +10,39 @@ def plot_repeats_plot(outcomes, args):
1010 fig .tight_layout (pad = 2.0 )
1111
1212 # Drop precision column and sum up based on iteration
13- rival = (outcomes .loc [(outcomes ['tool' ] == "rival" ) & ( outcomes [ 'iter' ] > 0 ) ]).sort_values (by = ['iter' ])
14- rival_no_repeats = (outcomes .loc [(outcomes ['tool' ] == "rival-no-repeats" ) & ( outcomes [ 'iter' ] > 0 ) ]).sort_values (by = ['iter' ])
15- baseline = (outcomes .loc [(outcomes ['tool' ] == "baseline" ) & ( outcomes [ 'iter' ] > 0 ) ]).sort_values (by = ['iter' ])
13+ rival = (outcomes .loc [(outcomes ['tool' ] == "rival" )]).sort_values (by = ['iter' ])
14+ rival_no_repeats = (outcomes .loc [(outcomes ['tool' ] == "rival-no-repeats" )]).sort_values (by = ['iter' ])
15+ baseline = (outcomes .loc [(outcomes ['tool' ] == "baseline" )]).sort_values (by = ['iter' ])
1616
17- ax .bar (np .arange (len (baseline )) + 0.925 , 100 , color = "green" , alpha = 1 , width = 0.5 , label = 'baseline' , hatch = '/' )
18- percentages = np .array (rival ['number_of_instr_executions' ]) / np .array (rival_no_repeats ['number_of_instr_executions' ]) * 100
19- ax .bar (np .arange (len (rival )) + 1.075 , percentages , color = "red" , alpha = 0.7 , width = 0.5 , label = 'reval' )
17+ # ax.bar(np.arange(len(baseline)) - 0.075, 100, color="green", alpha=1, width=0.5, label='baseline', hatch='/')
18+ percentages = (1.0 - np .array (rival ['number_of_instr_executions' ]) / np .array (rival_no_repeats ['number_of_instr_executions' ])) * 100
19+ ax .bar (np .arange (len (rival )), percentages , color = "red" , alpha = 0.7 , label = 'reval' )
20+
21+ average = round ((1.0 - (rival ['number_of_instr_executions' ].sum () / rival_no_repeats ['number_of_instr_executions' ].sum ())) * 100 , 2 )
22+ print ("\\ newcommand{\AveragePercentageOfSkippedInstr}{" + str (average ) + "\\ xspace}" )
23+ maximum = round ((1.0 - (np .array (rival ['number_of_instr_executions' ])[- 1 ] / np .array (rival_no_repeats ['number_of_instr_executions' ])[- 1 ])) * 100 , 2 )
24+ print ("\\ newcommand{\MaximumPercentageOfSkippedInstr}{" + str (maximum ) + "\\ xspace}" )
25+
26+ # Print percentages
27+ for bar in ax .patches :
28+ if bar .get_height () == 0 :
29+ ax .text (
30+ bar .get_x () + bar .get_width () / 2 ,
31+ bar .get_height () + bar .get_y () - bar .get_height ()/ 2 + 0.5 ,
32+ str (round (bar .get_height (), 2 )) + "%" ,
33+ ha = 'center' ,
34+ color = 'black' )
35+ else :
36+ ax .text (
37+ bar .get_x () + bar .get_width () / 2 ,
38+ bar .get_height () + bar .get_y () - bar .get_height ()/ 2 + 0.5 ,
39+ str (round (bar .get_height (), 2 )) + "%" ,
40+ ha = 'center' ,
41+ color = 'black' )
2042
2143 ax .legend ()
2244 ax .set_xlabel ("Iteration" )
23- ax .set_ylabel ("Percentage of instructions executed " )
45+ ax .set_ylabel ("Percentage of instructions skipped " )
2446 ax .yaxis .grid (True , linestyle = '-' , which = 'major' , color = 'grey' , alpha = 0.3 )
2547 plt .tight_layout ()
2648 plt .savefig (args .path + "/repeats_plot.png" , format = "png" )
0 commit comments