diff options
author | Tomás Touceda <chiiph@leap.se> | 2014-04-09 16:16:47 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2014-04-09 16:16:47 -0300 |
commit | 8935765a0d0a6956f1140bb7ab0bd1af57b4303f (patch) | |
tree | ec4f2147fcf0f94a8e3d11e47e27566d30a226bd /scripts/profiling/doc_put_memory_usage/plot-mem.py | |
parent | 8b8d9befbe3e60753e73bc7aaf1b8842a1846046 (diff) | |
parent | 11757fb0d071b753819a04d8504a72baed80db2f (diff) |
Merge remote-tracking branch 'refs/remotes/drebs/feature/5386_improve-sync' into develop
Diffstat (limited to 'scripts/profiling/doc_put_memory_usage/plot-mem.py')
-rwxr-xr-x | scripts/profiling/doc_put_memory_usage/plot-mem.py | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/scripts/profiling/doc_put_memory_usage/plot-mem.py b/scripts/profiling/doc_put_memory_usage/plot-mem.py new file mode 100755 index 00000000..e24679a2 --- /dev/null +++ b/scripts/profiling/doc_put_memory_usage/plot-mem.py @@ -0,0 +1,73 @@ +#!/usr/bin/python + + +from matplotlib import pyplot as plt + + +files = [ + ('local', 'couchdb-json', 'b'), + ('local', 'bigcouch-json', 'r'), + ('local', 'couchdb-multipart', 'g'), + ('local', 'bigcouch-multipart', 'm'), +] + + +# config the plot +plt.xlabel('time') +plt.ylabel('memory usage') +plt.title('bigcouch versus couch memory usage') + + +for fi in files: + + machine = fi[0] + database = fi[1] + color = fi[2] + filename = '%s-%s.txt' % (machine, database) + + x = [] + y = [] + + xmax = None + xmin = None + ymax = None + ymin = None + + # read data from file + with open(filename, 'r') as f: + line = f.readline() + while line is not None: + time, mem = tuple(line.strip().split(' ')) + mem = float(mem) / (10**9) + x.append(float(time)) + y.append(mem) + if ymax == None or mem > ymax: + ymax = mem + xmax = time + if ymin == None or mem < ymin: + ymin = mem + xmin = time + line = f.readline() + if line == '': + break + + kwargs = { + 'linewidth': 1.0, + 'linestyle': '-', + # 'marker': '.', + 'color': color, + } + plt.plot(x, y, label=database, **kwargs) + + #plt.axes().get_xaxis().set_ticks(x) + #plt.axes().get_xaxis().set_ticklabels(x) + + # annotate max and min values + #plt.axes().annotate("%.2f GB" % ymax, xy=(xmax, ymax)) + #plt.axes().annotate("%.2f GB" % ymin, xy=(xmin, ymin)) + + +plt.grid() +plt.legend() +plt.show() + |