def pretty_printing_ropgadget(results): tab = [] for benchmark, \ total_before, total_after, \ jop_before, jop_after, \ sys_before, sys_after, \ rop_before, rop_after in results: # total_red = 0.0 # if (total_before > 0): # total_red = (1.0 - (float(total_after) / float(total_before))) * 100.0 rop_red = 0.0 if (rop_before > 0): rop_red = (1.0 - (float(rop_after) / float(rop_before))) * 100.0 sys_red = 0.0 if (sys_before > 0): sys_red = (1.0 - (float(sys_after) / float(sys_before))) * 100.0 jop_red = 0.0 if (jop_before > 0): jop_red = (1.0 - (float(jop_after) / float(jop_before))) * 100.0 tab.append([ benchmark, #total_before, #total_after, #float("{0:.2f}".format(total_red)), rop_before, rop_after, float("{0:.2f}".format(rop_red)), sys_before, sys_after, float("{0:.2f}".format(sys_red)), jop_before, jop_after, float("{0:.2f}".format(jop_red)) ]) table = [["Program", \ "B ROP", "A ROP", "% ROP Red", \ "B SYS", "A SYS", "% SYS Red", \ "B JOP", "A JOP", "% JOP Red"]] for row in tab: table.append(row) out = sys.stdout pptable.pprint_table(out, table)
def pretty_printing_ropgadget(results): tab = [] for benchmark, \ total_before, total_after, \ jop_before, jop_after, \ sys_before, sys_after, \ rop_before, rop_after in results: # total_red = 0.0 # if (total_before > 0): # total_red = (1.0 - (float(total_after) / float(total_before))) * 100.0 rop_red = 0.0 if (rop_before > 0): rop_red = (1.0 - (float(rop_after) / float(rop_before))) * 100.0 sys_red = 0.0 if (sys_before > 0): sys_red = (1.0 - (float(sys_after) / float(sys_before))) * 100.0 jop_red = 0.0 if (jop_before > 0): jop_red = (1.0 - (float(jop_after) / float(jop_before))) * 100.0 tab.append([benchmark, #total_before, #total_after, #float("{0:.2f}".format(total_red)), rop_before, rop_after, float("{0:.2f}".format(rop_red)), sys_before, sys_after, float("{0:.2f}".format(sys_red)), jop_before, jop_after, float("{0:.2f}".format(jop_red))]) table = [["Program", \ "B ROP", "A ROP", "% ROP Red", \ "B SYS", "A SYS", "% SYS Red", \ "B JOP", "A JOP", "% JOP Red"]] for row in tab: table.append(row) out = sys.stdout pptable.pprint_table(out,table)
def pretty_printing_occam(results): tab = [] for benchmark, before, after in results: if before is None or after is None: continue func_red = 0.0 if (before.funcs > 0): func_red = (1.0 - (float(after.funcs) / float(before.funcs))) * 100.0 insts_red = 0.0 if (before.insts > 0): insts_red = (1.0 - (float(after.insts) / float(before.insts))) * 100.0 mem_red = 0.0 if (before.mem_insts > 0): mem_red = ( 1.0 - (float(after.mem_insts) / float(before.mem_insts))) * 100.0 tab.append([ benchmark, before.funcs, after.funcs, float("{0:.2f}".format(func_red)), before.insts, after.insts, float("{0:.2f}".format(insts_red)), before.mem_insts, after.mem_insts, float("{0:.2f}".format(mem_red)) ]) table = [["Program", \ "B Fun", "A Fun", "% Fun Red", \ "B Ins", "A Ins", "% Ins Red", \ "B Mem Ins", "A Mem Ins", "% Mem Ins Red"]] for row in tab: table.append(row) import pptable out = sys.stdout pptable.pprint_table(out, table)
def pretty_printing_occam(results): tab = [] for benchmark, before, after in results: if before is None or after is None: continue func_red = 0.0 if (before.funcs > 0): func_red = (1.0 - (float(after.funcs) / float(before.funcs))) * 100.0 insts_red = 0.0 if (before.insts > 0): insts_red = (1.0 - (float(after.insts) / float(before.insts))) * 100.0 mem_red = 0.0 if (before.mem_insts > 0): mem_red = (1.0 - (float(after.mem_insts) / float(before.mem_insts))) * 100.0 tab.append([benchmark, before.funcs, after.funcs, float("{0:.2f}".format(func_red)), before.insts, after.insts, float("{0:.2f}".format(insts_red)), before.mem_insts, after.mem_insts, float("{0:.2f}".format(mem_red))]) table = [["Program", \ "B Fun", "A Fun", "% Fun Red", \ "B Ins", "A Ins", "% Ins Red", \ "B Mem Ins", "A Mem Ins", "% Mem Ins Red"]] for row in tab: table.append(row) import pptable out = sys.stdout pptable.pprint_table(out,table)