diff --git a/analyze/memcached_conn_scan.py b/analyze/memcached_conn_scan.py index fbd046f7499c02e472ee327c56f0e966e5d73050..9f98613dd4741c8a8e88ee3dbec8909d62e92406 100644 --- a/analyze/memcached_conn_scan.py +++ b/analyze/memcached_conn_scan.py @@ -1,6 +1,4 @@ import os -import matplotlib.pyplot as plt -from config import markers, colors import util experiments = [f for f in os.listdir('../data') @@ -55,13 +53,7 @@ def extract_conn_qps(threads, include_caladan = False): return ret -def show_plot(threads, include_caladan = False): - 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) - +def collect_data(threads, include_caladan = False): data = extract_conn_qps(threads, include_caladan) if include_caladan and threads == 1: @@ -71,67 +63,4 @@ def show_plot(threads, include_caladan = False): data[name] = extract_conn_qps_exp('memcached_conn_scan.5.4.0-136-generic.caladan.t2') data[name] = (data[name][0], [qps / 2 for qps in data[name][1]], [qps / 2 for qps in data[name][2]], data[name][3], data[name][4], data[name][5], data[name][6]) - 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.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) - - plt.cla() - if include_caladan: - plt.title('Memcached connections vs LLC misses, %d threads, with Caladan' % (threads,)) - else: - plt.title('Memcached connections vs LLC misses, %d threads' % (threads,)) - - for k in data: - plt.errorbar(data[k][0], data[k][3], yerr=data[k][4], capsize = 4, label = k, marker = markers[k], color = colors[k]) - - plt.xlabel('Connections (per client w/ 7 * 8 clients)') - plt.ylabel('LLC misses per request') - - 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.llc_misses.t%d.caladan.png' % (threads,), dpi = 192) - else: - plt.savefig('../data/figs/memcached_conn_scan.llc_misses.t%d.png' % (threads,), dpi = 192) - - if not include_caladan or threads == 1: - return - - plt.cla() - plt.title('Memcached Instructions per Request, c160, %d threads' % (threads,)) - - plt.bar(range(len(data)), [data[k][5][4] for k in data], yerr = [data[k][6][4] for k in data], capsize=4) - plt.xticks(range(len(data)), data.keys()) - - plt.ylabel('Instructions per Request') - - 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.ipr.t%d.caladan.png' % (threads,), dpi = 192) - else: - plt.savefig('../data/figs/memcached_conn_scan.ipr.t%d.png' % (threads,), dpi = 192) - -show_plot(1) -show_plot(1, True) -show_plot(8) -show_plot(8, True) + return data diff --git a/analyze/memcached_conn_vs_llc_misses.py b/analyze/memcached_conn_vs_llc_misses.py new file mode 100644 index 0000000000000000000000000000000000000000..3b21cf60adbbbc867974da412ff00c8644f73f31 --- /dev/null +++ b/analyze/memcached_conn_vs_llc_misses.py @@ -0,0 +1,34 @@ +import matplotlib.pyplot as plt +from memcached_conn_scan import collect_data +import os +from config import markers, colors + +def plot(threads, include_caladan = False): + data = collect_data(threads, include_caladan) + + plt.cla() + if include_caladan: + plt.title('Memcached connections vs LLC misses, %d threads, with Caladan' % (threads,)) + else: + plt.title('Memcached connections vs LLC misses, %d threads' % (threads,)) + + for k in data: + plt.errorbar(data[k][0], data[k][3], yerr=data[k][4], capsize = 4, label = k, marker = markers[k], color = colors[k]) + + plt.xlabel('Connections (per client w/ 7 * 8 clients)') + plt.ylabel('LLC misses per request') + + 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.llc_misses.t%d.caladan.png' % (threads,), dpi = 192) + else: + plt.savefig('../data/figs/memcached_conn_scan.llc_misses.t%d.png' % (threads,), dpi = 192) + +plot(1) +plot(1, True) +plot(8) +plot(8, True) diff --git a/analyze/memcached_ipr.py b/analyze/memcached_ipr.py new file mode 100644 index 0000000000000000000000000000000000000000..6af9c5c79d62c1449871f9b93905dbe60419000b --- /dev/null +++ b/analyze/memcached_ipr.py @@ -0,0 +1,26 @@ +import matplotlib.pyplot as plt +from memcached_conn_scan import collect_data +import os + +def plot(threads): + data = collect_data(threads, True) + plt.cla() + plt.title('Memcached Instructions per Request, c160, %d threads' % (threads,)) + + plt.bar(range(len(data)), [data[k][5][4] for k in data], yerr = [data[k][6][4] for k in data], capsize=4) + plt.xticks(range(len(data)), data.keys()) + + plt.ylabel('Instructions per Request') + + 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.ipr.t%d.caladan.png' % (threads,), dpi = 192) + else: + plt.savefig('../data/figs/memcached_conn_scan.ipr.t%d.png' % (threads,), dpi = 192) + +plot(1) +plot(8) diff --git a/analyze/memcached_qps_vs_conn.py b/analyze/memcached_qps_vs_conn.py new file mode 100644 index 0000000000000000000000000000000000000000..626d2307d4cde2eac5897ddd920d6f8a793248cc --- /dev/null +++ b/analyze/memcached_qps_vs_conn.py @@ -0,0 +1,34 @@ +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.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)