| 16 | fignum = 0 |
| 17 | |
| 18 | def plot_to_file(report, filename): |
| 19 | global fignum |
| 20 | fignum += 1 |
| 21 | pylab.figure(fignum) |
| 22 | |
| 23 | run_to_label = { |
| 24 | "stl" : "C++ STL", |
| 25 | "thrust" : "Thrust", |
| 26 | "compute" : "Boost.Compute", |
| 27 | "bolt" : "Bolt" |
| 28 | } |
| 29 | |
| 30 | for run in sorted(report.samples.keys()): |
| 31 | x = [] |
| 32 | y = [] |
| 33 | |
| 34 | for sample in report.samples[run]: |
| 35 | x.append(sample[0]) |
| 36 | y.append(sample[1]) |
| 37 | |
| 38 | pylab.loglog(x, y, marker='o', label=run_to_label[run]) |
| 39 | |
| 40 | pylab.xlabel("Size") |
| 41 | pylab.ylabel("Time (ms)") |
| 42 | pylab.legend(loc='upper left') |
| 43 | pylab.savefig(filename) |
| 44 | |
| 45 | if __name__ == '__main__': |
| 46 | sizes = [pow(2, x) for x in range(10, 26)] |