import matplotlib.pyplot as plt from memcached_conn_scan import collect_data from config import markers, colors import os def plot(threads, include_caladan = False): data = collect_data(threads, include_caladan) plt.cla() if include_caladan: plt.title('Memcached connections vs QPS, %d threads, with Caladan' % (threads,), y = 1.05) else: plt.title('Memcached connections vs QPS, %d threads' % (threads,), y = 1.05) for k in data: plt.errorbar(data[k][0], data[k][1], yerr = data[k][2], capsize = 4, label = k, marker = markers[k], color = colors[k]) plt.ticklabel_format(axis = 'both', style = 'sci', scilimits = (0, 4)) plt.xlabel('Connections (per client w/ 7 * 8 clients)') plt.ylabel('QPS') plt.ylim(ymin = 0) plt.legend() if os.getenv('SAVE_FIGURE') != 'true': plt.rcParams.update({'font.size': 16}) plt.show() else: if include_caladan: plt.savefig('../data/figs/memcached_conn_scan.t%d.caladan.png' % (threads,), dpi = 192) else: plt.savefig('../data/figs/memcached_conn_scan.t%d.png' % (threads,), dpi = 192) plot(1) plot(1, True) plot(8) plot(8, True)