Changeset 71cf630 for benchmark/plot.py
- Timestamp:
- Aug 16, 2022, 4:04:47 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- aec2c022
- Parents:
- 741e22c (diff), 17c6edeb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/plot.py
r741e22c r71cf630 18 18 import statistics 19 19 import sys 20 20 import time 21 22 import matplotlib 21 23 import matplotlib.pyplot as plt 22 from matplotlib.ticker import EngFormatter 24 from matplotlib.ticker import EngFormatter, ScalarFormatter 25 26 def fmtDur( duration ): 27 if duration : 28 hours, rem = divmod(duration, 3600) 29 minutes, rem = divmod(rem, 60) 30 seconds, millis = divmod(rem, 1) 31 return "%2d:%02d.%03d" % (minutes, seconds, millis * 1000) 32 return " n/a" 23 33 24 34 class Field: … … 32 42 field_names = { 33 43 "ns per ops" : Field('ns' , 0, False), 34 "Number of processors" : Field('' , 1, False),44 "Number of processors" : Field('' , 1, "exact"), 35 45 "Ops per procs" : Field('Ops' , 0, False), 36 46 "Ops per threads" : Field('Ops' , 0, False), 37 "ns per ops/procs" : Field('' , 0, False, _name = " Latency (ns $/$ (Processor $\\times$ Operation))" ),47 "ns per ops/procs" : Field('' , 0, False, _name = "ns $\\times$ (Processor $/$ Total Ops)" ), 38 48 "Number of threads" : Field('' , 1, False), 39 49 "Total Operations(ops)" : Field('Ops' , 0, False), … … 45 55 "Target QPS" : Field('' , 0, False), 46 56 "Actual QPS" : Field('' , 0, False), 47 "Average Read Latency" : Field('s' , 0, True, _factor = 0.000001),57 "Average Read Latency" : Field('s' , 0, False, _factor = 0.000001), 48 58 "Median Read Latency" : Field('s' , 0, True, _factor = 0.000001), 49 59 "Tail Read Latency" : Field('s' , 0, True, _factor = 0.000001), … … 51 61 "Median Update Latency" : Field('s' , 0, True, _factor = 0.000001), 52 62 "Tail Update Latency" : Field('s' , 0, True, _factor = 0.000001), 53 "Update Ratio" : Field(' \%', 0, False),63 "Update Ratio" : Field('%' , 0, False), 54 64 "Request Rate" : Field('req/s' , 0, False), 55 65 "Data Rate" : Field('b/s' , 0, False, _factor = 1000 * 1000, _name = "Response Throughput"), 66 "Errors" : Field('%' , 0, False), 56 67 } 57 68 … … 66 77 for entry in in_data: 67 78 name = entry[0] 79 if options.filter and not name.startswith(options.filter): 80 continue 81 68 82 if not name in series: 69 83 series[name] = {'x':[], 'y':[]} … … 123 137 elif field_names[x].log: 124 138 ax.set_xscale('log') 139 if field_names[x].log == "exact": 140 xvals = set() 141 for s in series.values(): 142 xvals |= set(s['x']) 143 ax.set_xticks(sorted(xvals)) 144 ax.get_xaxis().set_major_formatter(ScalarFormatter()) 145 plt.xticks(rotation = 45) 125 146 else: 126 147 plt.xlim(field_names[x].min, mx + 0.25) … … 138 159 139 160 print("Results Ready") 161 start = time.time() 140 162 if options.out: 141 163 plt.savefig(options.out, bbox_inches='tight') 142 164 else: 143 165 plt.show() 166 end = time.time() 167 print("Took {}".format(fmtDur(end - start))) 144 168 145 169 … … 155 179 parser.add_argument('--logy', action='store_true', help="if set, makes the y-axis logscale") 156 180 parser.add_argument('--MaxY', nargs='?', type=int, help="maximum value of the y-axis") 181 parser.add_argument('--filter', nargs='?', type=str, default="", help="if not empty, only print series that start with specified filter") 157 182 158 183 options = parser.parse_args() 184 185 # if not options.out: 186 # matplotlib.use('SVG') 159 187 160 188 # ================================================================================ … … 178 206 fields.add(label) 179 207 180 # find the common prefix on series for removal 208 # filter out the series if needed 209 if options.filter: 210 series = set(filter(lambda elem: elem.startswith(options.filter), series)) 211 212 # find the common prefix on series for removal (only if no filter) 181 213 prefix = os.path.commonprefix(list(series)) 182 214
Note: See TracChangeset
for help on using the changeset viewer.