smbinterp/plots/scalability/scalability_histograms.py

36 lines
859 B
Python

import sys
import shelve
import pickle
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
if len(sys.argv) != 2:
print "usage: %s <interp.shelve>" % sys.argv[0]
sys.exit(1)
s = shelve.open(sys.argv[1])
d = dict(s)
s.close()
c = 0
for line in (i[1] for i in sorted(d.iteritems(), key = lambda x: x[1]['stats']['participants'])):
c += 1
run = line['stats']
x = np.array(run['tasks'].values())
# the histogram of the data
plt.figure(c)
plt.title("Histogram of Interpolation Performance")
plt.xlabel("Number of Interpolations Performed")
plt.ylabel("Number of minions")
n, bins, patches = plt.hist(x) # , 50, normed=1, facecolor='green', alpha=0.5)
plt.grid(True)
output_file_name = 'asdf.%0.3d.%d.png' % (run['participants'], str(run['count']).count("0"))
plt.savefig(output_file_name)