Changeset 74ec742 for benchmark/plot.py
- Timestamp:
- May 20, 2022, 10:36:45 AM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 25fa20a
- Parents:
- 29d8c02 (diff), 7831e8fb (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
-
benchmark/plot.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/plot.py
r29d8c02 r74ec742 22 22 23 23 class Field: 24 def __init__(self, unit, _min, _log ):24 def __init__(self, unit, _min, _log, _name=None): 25 25 self.unit = unit 26 26 self.min = _min 27 27 self.log = _log 28 self.name = _name 28 29 29 30 field_names = { … … 32 33 "Ops per procs" : Field('Ops' , 0, False), 33 34 "Ops per threads" : Field('Ops' , 0, False), 34 "ns per ops/procs" : Field(' ns' , 0, False),35 "Number of threads" : Field(' thrd', 1, False),35 "ns per ops/procs" : Field('' , 0, False, _name = "Latency (ns $/$ (Processor $\\times$ Operation))" ), 36 "Number of threads" : Field('' , 1, False), 36 37 "Total Operations(ops)" : Field('Ops' , 0, False), 37 38 "Ops/sec/procs" : Field('Ops' , 0, False), 38 39 "Total blocks" : Field('Blocks', 0, False), 39 "Ops per second" : Field(' Ops' , 0, False),40 "Ops per second" : Field('' , 0, False), 40 41 "Cycle size (# thrds)" : Field('thrd' , 1, False), 41 42 "Duration (ms)" : Field('ms' , 0, False), 42 "Target QPS" : Field('QPS' , 0, False), 43 "Actual QPS" : Field('QPS' , 0, False), 43 "Target QPS" : Field('' , 0, False), 44 "Actual QPS" : Field('' , 0, False), 45 "Average Read Latency" : Field('us' , 0, True), 44 46 "Median Read Latency" : Field('us' , 0, True), 45 47 "Tail Read Latency" : Field('us' , 0, True), 48 "Average Update Latency": Field('us' , 0, True), 46 49 "Median Update Latency" : Field('us' , 0, True), 47 50 "Tail Update Latency" : Field('us' , 0, True), 51 "Update Ratio" : Field('\%' , 0, False), 48 52 } 49 53 50 def plot(in_data, x, y, o ut):54 def plot(in_data, x, y, options): 51 55 fig, ax = plt.subplots() 52 56 colors = itertools.cycle(['#0095e3','#006cb4','#69df00','#0aa000','#fb0300','#e30002','#fd8f00','#ff7f00','#8f00d6','#4b009a','#ffff00','#b13f00']) … … 92 96 print("Making Plots") 93 97 94 for name, data in s eries.items():98 for name, data in sorted(series.items()): 95 99 _col = next(colors) 96 100 plt.scatter(data['x'], data['y'], color=_col, label=name, marker='x') … … 106 110 print("Finishing Plots") 107 111 108 plt.ylabel( y)112 plt.ylabel(field_names[y].name if field_names[y].name else y) 109 113 # plt.xticks(range(1, math.ceil(mx) + 1)) 110 plt.xlabel( x)114 plt.xlabel(field_names[x].name if field_names[x].name else x) 111 115 plt.grid(b = True) 112 116 ax.xaxis.set_major_formatter( EngFormatter(unit=field_names[x].unit) ) 113 if field_names[x].log: 117 if options.logx: 118 ax.set_xscale('log') 119 elif field_names[x].log: 114 120 ax.set_xscale('log') 115 121 else: … … 117 123 118 124 ax.yaxis.set_major_formatter( EngFormatter(unit=field_names[y].unit) ) 119 if field_names[y].log: 125 if options.logy: 126 ax.set_yscale('log') 127 elif field_names[y].log: 120 128 ax.set_yscale('log') 121 129 else: 122 plt.ylim(field_names[y].min, my*1.2)130 plt.ylim(field_names[y].min, options.MaxY if options.MaxY else my*1.2) 123 131 124 132 plt.legend(loc='upper left') 125 133 126 134 print("Results Ready") 127 if o ut:128 plt.savefig(o ut)135 if options.out: 136 plt.savefig(options.out, bbox_inches='tight') 129 137 else: 130 138 plt.show() … … 139 147 parser.add_argument('-y', nargs='?', type=str, default="", help="Which field to use as the Y axis") 140 148 parser.add_argument('-x', nargs='?', type=str, default="", help="Which field to use as the X axis") 149 parser.add_argument('--logx', action='store_true', help="if set, makes the x-axis logscale") 150 parser.add_argument('--logy', action='store_true', help="if set, makes the y-axis logscale") 151 parser.add_argument('--MaxY', nargs='?', type=int, help="maximum value of the y-axis") 141 152 142 153 options = parser.parse_args() … … 182 193 183 194 184 plot(data, wantx, wanty, options .out)195 plot(data, wantx, wanty, options)
Note:
See TracChangeset
for help on using the changeset viewer.