- Timestamp:
- Jul 29, 2022, 2:16:38 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- 0d24ff2
- Parents:
- ce1d721
- Location:
- benchmark
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/plot.py
rce1d721 rc0458be3 14 14 import math 15 15 import numpy 16 import os 16 17 import re 17 18 import statistics … … 22 23 23 24 class Field: 24 def __init__(self, unit, _min, _log, _name=None ):25 def __init__(self, unit, _min, _log, _name=None, _factor=1.0): 25 26 self.unit = unit 26 27 self.min = _min 27 28 self.log = _log 28 29 self.name = _name 30 self.factor = _factor 29 31 30 32 field_names = { … … 33 35 "Ops per procs" : Field('Ops' , 0, False), 34 36 "Ops per threads" : Field('Ops' , 0, False), 35 "ns per ops/procs" : Field('' , 0, False, _name = "Latency (ns $/$ (Processor $\\times$ Operation))" ),37 "ns per ops/procs" : Field('' , 0, False, _name = "Latency (ns $/$ (Processor $\\times$ Operation))" ), 36 38 "Number of threads" : Field('' , 1, False), 37 39 "Total Operations(ops)" : Field('Ops' , 0, False), 38 40 "Ops/sec/procs" : Field('Ops' , 0, False), 39 41 "Total blocks" : Field('Blocks', 0, False), 40 "Ops per second" : Field('' , 0, False),42 "Ops per second" : Field('' , 0, False), 41 43 "Cycle size (# thrds)" : Field('thrd' , 1, False), 42 44 "Duration (ms)" : Field('ms' , 0, False), 43 45 "Target QPS" : Field('' , 0, False), 44 46 "Actual QPS" : Field('' , 0, False), 45 "Average Read Latency" : Field(' us' , 0, True),46 "Median Read Latency" : Field(' us' , 0, True),47 "Tail Read Latency" : Field(' us' , 0, True),48 "Average Update Latency": Field(' us' , 0, True),49 "Median Update Latency" : Field(' us' , 0, True),50 "Tail Update Latency" : Field(' us' , 0, True),47 "Average Read Latency" : Field('s' , 0, True, _factor = 0.000001), 48 "Median Read Latency" : Field('s' , 0, True, _factor = 0.000001), 49 "Tail Read Latency" : Field('s' , 0, True, _factor = 0.000001), 50 "Average Update Latency": Field('s' , 0, True, _factor = 0.000001), 51 "Median Update Latency" : Field('s' , 0, True, _factor = 0.000001), 52 "Tail Update Latency" : Field('s' , 0, True, _factor = 0.000001), 51 53 "Update Ratio" : Field('\%' , 0, False), 54 "Request Rate" : Field('req/s' , 0, False), 55 "Data Rate" : Field('b/s' , 0, False, _factor = 1000 * 1000, _name = "Response Throughput"), 52 56 } 53 57 54 def plot(in_data, x, y, options ):58 def plot(in_data, x, y, options, prefix): 55 59 fig, ax = plt.subplots() 56 colors = itertools.cycle(['#00 95e3','#006cb4','#69df00','#0aa000','#fb0300','#e30002','#fd8f00','#ff7f00','#8f00d6','#4b009a','#ffff00','#b13f00'])60 colors = itertools.cycle(['#006cb4','#0aa000','#ff6600','#8510a1','#0095e3','#fd8f00','#e30002','#8f00d6','#4b009a','#ffff00','#69df00','#fb0300','#b13f00']) 57 61 series = {} # scatter data for each individual data point 58 62 groups = {} # data points for x value … … 70 74 if x in entry[2] and y in entry[2]: 71 75 xval = entry[2][x] 72 yval = entry[2][y] 76 yval = entry[2][y] * field_names[y].factor 73 77 series[name]['x'].append(xval) 74 78 series[name]['y'].append(yval) … … 98 102 for name, data in sorted(series.items()): 99 103 _col = next(colors) 100 plt.scatter(data['x'], data['y'], color=_col, label=name , marker='x')104 plt.scatter(data['x'], data['y'], color=_col, label=name[len(prefix):], marker='x') 101 105 plt.plot(lines[name]['x'], lines[name]['min'], '--', color=_col) 102 106 plt.plot(lines[name]['x'], lines[name]['max'], '--', color=_col) … … 122 126 plt.xlim(field_names[x].min, mx + 0.25) 123 127 124 ax.yaxis.set_major_formatter( EngFormatter(unit=field_names[y].unit) )125 128 if options.logy: 126 129 ax.set_yscale('log') … … 129 132 else: 130 133 plt.ylim(field_names[y].min, options.MaxY if options.MaxY else my*1.2) 134 135 ax.yaxis.set_major_formatter( EngFormatter(unit=field_names[y].unit) ) 131 136 132 137 plt.legend(loc='upper left') … … 173 178 fields.add(label) 174 179 180 # find the common prefix on series for removal 181 prefix = os.path.commonprefix(list(series)) 182 175 183 if not options.out : 176 184 print(series) … … 193 201 194 202 195 plot(data, wantx, wanty, options )203 plot(data, wantx, wanty, options, prefix)
Note: See TracChangeset
for help on using the changeset viewer.