|
| 1 | +#!/usr/bin/env python |
| 2 | +import pickle |
| 3 | +import numpy as np |
| 4 | +import matplotlib |
| 5 | +matplotlib.use('Cairo') |
| 6 | +import matplotlib.pyplot as plt |
| 7 | +import os |
| 8 | +import json |
| 9 | + |
| 10 | +fig = plt.figure() |
| 11 | + |
| 12 | +def plot(label, filename): |
| 13 | + stat = pickle.load(open(filename))["mem"]["Active"] |
| 14 | + stat = [int((int(number) - int(stat[0]))/1024.0) for number in stat] |
| 15 | + print "<tr><td>", label, "</td><td>", str(len(stat)), "</td><td>", str(stat[-1]), "</td></tr>" |
| 16 | + return (stat[-1],label) |
| 17 | + |
| 18 | +filenames = [] |
| 19 | +for root, dirs, files in os.walk("output"): |
| 20 | + for name in files: filenames.append((root,name)) |
| 21 | + |
| 22 | +filenames.sort() |
| 23 | + |
| 24 | +stats=[] |
| 25 | +labels=[] |
| 26 | +for filename in filenames: |
| 27 | + path = filename[0] |
| 28 | + name = filename[1] |
| 29 | + label = name.replace(".benchmark","") |
| 30 | + stat = plot(label, path + "/" + name) |
| 31 | + stats.append(stat) |
| 32 | + |
| 33 | +from pylab import * |
| 34 | +pos = arange(len(stats))+.25 # the bar centers on the y axis |
| 35 | + |
| 36 | +figure(1) |
| 37 | +barh(pos, map(lambda x: x[0], stats), align='center') |
| 38 | +yticks(pos, map(lambda x: x[1], stats)) |
| 39 | +xlabel('Memory Usage (M)') |
| 40 | +title('Reading a 135M TSV File into a List of Lists') |
| 41 | +grid(True) |
| 42 | +plt.savefig("pics/benchmark.png") |
| 43 | + |
| 44 | + |
| 45 | +#figure(2) |
| 46 | +#barh(pos,val, xerr=rand(5), ecolor='r', align='center') |
| 47 | +#yticks(pos, ('Tom', 'Dick', 'Harry', 'Slim', 'Jim')) |
| 48 | +#xlabel('Performance') |
0 commit comments