Changeset 44706d1
- Timestamp:
- Nov 24, 2020, 11:56:58 AM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 5c028ac
- Parents:
- 0bb691b1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/plot.py
r0bb691b1 r44706d1 20 20 from matplotlib.ticker import EngFormatter 21 21 22 def funit(name):23 match = re.search("Number of (.*)", name)24 if match:25 return match.group(1).strip()22 class Field: 23 def __init__(self, unit, _min): 24 self.unit = unit 25 self.min = _min 26 26 27 match = re.search("\((.*)\)", name) 28 if match: 29 return match.group(1).strip() 30 31 match = re.search("(.*) per .*", name) 32 if match: 33 return match.group(1).strip() 34 35 match = re.search("(.*)\/.*", name) 36 if match: 37 return match.group(1).strip() 38 39 return "Unkown" 27 field_names = { 28 "ns per ops" : Field('ns' , 0), 29 "Number of processors" : Field('' , 1), 30 "Ops per procs" : Field('Ops' , 0), 31 "Ops per threads" : Field('Ops' , 0), 32 "ns per ops/procs" : Field('ns' , 0), 33 "Number of threads" : Field('thrd' , 1), 34 "Total Operations(ops)": Field('Ops' , 0), 35 "Ops/sec/procs" : Field('Ops' , 0), 36 "Total blocks" : Field('Blocks', 0), 37 "Ops per second" : Field('Ops' , 0), 38 "Cycle size (# thrds)" : Field('thrd' , 1), 39 "Duration (ms)" : Field('ms' , 0), 40 } 40 41 41 42 def plot(data, x, y): 42 43 fig, ax = plt.subplots() 43 colors = itertools.cycle([ "r", "b", "g"])44 colors = itertools.cycle(['#0095e3','#006cb4','#69df00','#0aa000','#fb0300','#e30002','#fd8f00','#ff7f00','#8f00d6','#4b009a','#ffff00','#b13f00']) 44 45 series = {} 45 46 for entry in data: … … 58 59 59 60 plt.ylabel(y) 60 plt.xlim( 0.75, mx + 0.25)61 plt.xlim(field_names[x].min, mx + 0.25) 61 62 plt.xticks(range(1, math.ceil(mx) + 1)) 62 63 plt.xlabel(x) 63 plt.ylim( 0, my*1.2)64 plt.ylim(field_names[y].min, my*1.2) 64 65 plt.grid(b = True) 65 formatter0 = EngFormatter(unit='Ops/s')66 ax.yaxis.set_major_formatter( formatter0)67 plt.legend( )66 ax.xaxis.set_major_formatter( EngFormatter(unit=field_names[x].unit) ) 67 ax.yaxis.set_major_formatter( EngFormatter(unit=field_names[y].unit) ) 68 plt.legend(loc='upper left') 68 69 plt.show() 69 70 … … 105 106 print("fields") 106 107 for f in fields: 107 print("{} ({})".format(f, funit(f)))108 print("{}".format(f)) 108 109 109 plot(data, "Number of processors", " Ops per second")110 plot(data, "Number of processors", "ns per ops")
Note: See TracChangeset
for help on using the changeset viewer.