Changeset 107
- Timestamp:
- 06/01/10 08:38:02 (3 years ago)
- File:
-
- 1 edited
-
trunk/bench/plot-speeds.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bench/plot-speeds.py
r99 r107 1 """Script for plotting the results of the 'suite' benchmark. 2 Invoke without parameters for usage hints. 3 4 :Author: Francesc Alted 5 :Date: 2010-06-01 6 """ 7 8 import matplotlib as mpl 1 9 from pylab import * 10 11 MB_ = 1024*1024 12 NCHUNKS = 128 # keep in sync with bench.c 2 13 3 14 linewidth=2 … … 9 20 def get_values(filename): 10 21 f = open(filename) 11 values = { }22 values = {"memcpyw": [], "memcpyr": []} 12 23 13 24 for line in f: … … 15 26 tmp = line.split('-->')[1] 16 27 nthreads, size, elsize, sbits = [int(i) for i in tmp.split(', ')] 28 values["size"] = size * NCHUNKS / MB_; 29 values["elsize"] = elsize; 30 values["sbits"] = sbits; 17 31 # New run for nthreads 18 32 (ratios, speedsw, speedsr) = ([], [], []) 19 33 # Add a new entry for (ratios, speedw, speedr) 20 34 values[nthreads] = (ratios, speedsw, speedsr) 21 print "-->", nthreads, size, elsize, sbits35 #print "-->", nthreads, size, elsize, sbits 22 36 elif line.startswith('memcpy(write):'): 23 37 tmp = line.split(',')[1] 24 38 memcpyw = float(tmp.split(' ')[1]) 25 print "memcpyw-->", memcpyw39 values["memcpyw"].append(memcpyw) 26 40 elif line.startswith('memcpy(read):'): 27 41 tmp = line.split(',')[1] 28 42 memcpyr = float(tmp.split(' ')[1]) 29 print "memcpyr-->", memcpyr43 values["memcpyr"].append(memcpyr) 30 44 elif line.startswith('comp(write):'): 31 45 tmp = line.split(',')[1] … … 50 64 title(gtitle) 51 65 #ylim(0, 10000) 66 ylim(0, None) 52 67 grid(True) 53 68 … … 55 70 # legends = [l.replace('-', ' ') for l in legends] 56 71 #legend([p[0] for p in plots], legends, loc = "upper left") 57 legend([p[0] for p in plots], legends, loc = "best") 72 legend([p[0] for p in plots 73 if not isinstance(p, mpl.lines.Line2D)], 74 legends, loc = "best") 58 75 59 76 60 77 #subplots_adjust(bottom=0.2, top=None, wspace=0.2, hspace=0.2) 61 78 if outfile: 79 print "Saving plot to:", outfile 62 80 savefig(outfile) 63 81 else: … … 93 111 tit = None 94 112 cspeed = False 113 gtitle = "Decompression speed" 95 114 dspeed = True 96 115 yaxis = "No axis name" 97 gtitle = "Please set a title!"98 116 99 117 # Get the options … … 114 132 filename = pargs[0] 115 133 116 if tit:117 gtitle = tit118 119 134 plots = [] 120 135 legends = [] 121 136 nthreads, values = get_values(filename) 137 #print "Values:", values 138 139 if tit: 140 gtitle = tit 141 else: 142 gtitle += " (%(size).1f MB, %(elsize)d bytes, %(sbits)d bits)" % values 143 122 144 for nt in range(1, nthreads+1): 123 print "Values for %s threads --> %s" % (nt, values)145 #print "Values for %s threads --> %s" % (nt, values[nt]) 124 146 (ratios, speedw, speedr) = values[nt] 125 147 if cspeed: … … 137 159 legends.append("%d threads" % nt) 138 160 161 # Add memcpy lines 162 if cspeed: 163 mean = sum(values["memcpyw"]) / nthreads 164 message = "memcpy (write to memory)" 165 else: 166 mean = sum(values["memcpyr"]) / nthreads 167 message = "memcpy (read from memory)" 168 plot_ = axhline(mean, linewidth=3, linestyle='-.', color='black') 169 text(0.5, mean+50, message) 170 plots.append(plot_) 139 171 show_plot(plots, yaxis, legends, gtitle) 172 173
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/images/blosc-logo-small.png)