11 NAMEPAT='istc3-8-1-13%s.py'
15 def split_results_by_predicate(results, pred):
26 (N('_fake_compress'), True),
28 (N('_newbench'), True),
29 (N('_compress'), True),
31 #(N('_fake_writes'), True),
32 #(N('_fake_writes_stride'), True),
33 #(N('_fake_writes_stride1'), True),
34 #(N('_log_reduce_size'), True),
37 def datafromfile(f, persist):
40 res, _ = split_results_by_predicate(
42 lambda x: x[0]['persist'] if persist else not x[0]['persist'])
45 if __name__ == '__main__':
46 def order_results_by_threads(results):
47 # res is list[(config, results)], change to
48 # list[(num_threads, results)]
50 return (ent[0]['threads'], ent[1])
51 return map(trfm, results)
53 def extract_result_position(k, res):
55 return [x[k] for x in res]
58 def extract_throughput(results, persist):
60 return (ent[0], extract_result_position(0 if not persist else 1, ent[1]))
61 return map(trfm, results)
63 def extract_latency(results, persist):
65 return (ent[0], extract_result_position(2 if not persist else 3, ent[1]))
66 return map(trfm, results)
68 def filter_name(results, name):
70 return ent[0]['name'] == name
71 return [x for x in results if match(x)]
74 return [e[0] for e in x]
77 return [np.random.normal(loc=0.0, scale=0.2) + e for e in x]
80 return [e + s for e in x]
83 return [e / s for e in x]
85 def median(x): return sorted(x)[len(x)/2]
88 return [ (e[0], [ee/e[0] for ee in e[1]]) for e in x ]
95 return [checked(e[1]) for e in x]
102 return [checked(e[1])/float(e[0]) for e in x]
105 ypts = [e[1] for e in x]
106 ymins = np.array([min(x) for x in ypts])
107 ymaxs = np.array([max(x) for x in ypts])
108 ymid = np.array([median(x) for x in ypts])
109 yerr=np.array([ymid - ymins, ymaxs - ymid])
113 ypts = [[ee/float(e[0]) for ee in e[1]] for e in x]
114 ymins = np.array([min(x) for x in ypts])
115 ymaxs = np.array([max(x) for x in ypts])
116 ymid = np.array([median(x) for x in ypts])
117 yerr=np.array([ymid - ymins, ymaxs - ymid])
122 fname = fname.replace('istc3-8-1-13', '').replace('.py', '')
124 return 'base-persist' if persist else 'base'
127 fig, fig1 = plt.figure(), plt.figure()
128 ax, ax1 = fig.add_subplot(111), fig1.add_subplot(111)
130 from matplotlib.font_manager import FontProperties
131 fontP = FontProperties()
132 fontP.set_size('small')
135 for fname, persist in FILES:
136 res = datafromfile(fname, persist)
137 res = order_results_by_threads(res)
138 throughput = extract_throughput(res, persist)
139 percorethroughput = percorify(throughput)
140 print percorethroughput
141 ax.errorbar(scalaradd(XX(throughput), off), YY(percorethroughput), yerr=YERR(percorethroughput))
144 ax.legend(map(nameit, FILES), loc='lower right', prop=fontP)
145 ax.set_xlabel('threads')
146 ax.set_ylabel('throughput (txns/sec/core)')
147 ax.set_ylim([0, 32000])
148 fig.savefig('istc3-8-1-13_summary.pdf')