Changes in benchmark/plot.py [76f5e9f:3b5dcfa]
- File:
-
- 1 edited
-
benchmark/plot.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
benchmark/plot.py
r76f5e9f r3b5dcfa 22 22 23 23 class Field: 24 def __init__(self, unit, _min, _log , _name=None):24 def __init__(self, unit, _min, _log): 25 25 self.unit = unit 26 26 self.min = _min 27 27 self.log = _log 28 self.name = _name29 28 30 29 field_names = { … … 33 32 "Ops per procs" : Field('Ops' , 0, False), 34 33 "Ops per threads" : Field('Ops' , 0, False), 35 "ns per ops/procs" : Field(' ' , 0, False, _name = "Latency (ns $/$ (Processor $\\times$ Operation))"),34 "ns per ops/procs" : Field('ns' , 0, False), 36 35 "Number of threads" : Field('' , 1, False), 37 36 "Total Operations(ops)" : Field('Ops' , 0, False), 38 37 "Ops/sec/procs" : Field('Ops' , 0, False), 39 38 "Total blocks" : Field('Blocks', 0, False), 40 "Ops per second" : Field(' ' , 0, False),39 "Ops per second" : Field('Ops' , 0, False), 41 40 "Cycle size (# thrds)" : Field('thrd' , 1, False), 42 41 "Duration (ms)" : Field('ms' , 0, False), … … 52 51 } 53 52 54 def plot(in_data, x, y, o ptions):53 def plot(in_data, x, y, out): 55 54 fig, ax = plt.subplots() 56 55 colors = itertools.cycle(['#0095e3','#006cb4','#69df00','#0aa000','#fb0300','#e30002','#fd8f00','#ff7f00','#8f00d6','#4b009a','#ffff00','#b13f00']) … … 110 109 print("Finishing Plots") 111 110 112 plt.ylabel( field_names[y].name if field_names[y].name elsey)111 plt.ylabel(y) 113 112 # plt.xticks(range(1, math.ceil(mx) + 1)) 114 plt.xlabel( field_names[x].name if field_names[x].name elsex)113 plt.xlabel(x) 115 114 plt.grid(b = True) 116 115 ax.xaxis.set_major_formatter( EngFormatter(unit=field_names[x].unit) ) 117 if options.logx: 118 ax.set_xscale('log') 119 elif field_names[x].log: 116 if field_names[x].log: 120 117 ax.set_xscale('log') 121 118 else: … … 123 120 124 121 ax.yaxis.set_major_formatter( EngFormatter(unit=field_names[y].unit) ) 125 if options.logy: 126 ax.set_yscale('log') 127 elif field_names[y].log: 122 if field_names[y].log: 128 123 ax.set_yscale('log') 129 124 else: 130 plt.ylim(field_names[y].min, options.MaxY if options.MaxY elsemy*1.2)125 plt.ylim(field_names[y].min, my*1.2) 131 126 132 127 plt.legend(loc='upper left') 133 128 134 129 print("Results Ready") 135 if o ptions.out:136 plt.savefig(o ptions.out, bbox_inches='tight')130 if out: 131 plt.savefig(out) 137 132 else: 138 133 plt.show() … … 147 142 parser.add_argument('-y', nargs='?', type=str, default="", help="Which field to use as the Y axis") 148 143 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")152 144 153 145 options = parser.parse_args() … … 193 185 194 186 195 plot(data, wantx, wanty, options )187 plot(data, wantx, wanty, options.out)
Note:
See TracChangeset
for help on using the changeset viewer.