diff options
author | Kali Kaneko <kali@leap.se> | 2017-06-26 16:48:40 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2017-06-26 16:48:40 +0200 |
commit | a653032662c990c662bf6706b0784bce1c553cbd (patch) | |
tree | bd126e8d3614f6a29f055c89e0546108b4aefc1f /docs/client_examples/plot-async-db.py | |
parent | 80699961145de3941c645ab3d8f3a4f9c2775ef3 (diff) |
[pkg] move examples folder to docs/
Diffstat (limited to 'docs/client_examples/plot-async-db.py')
-rw-r--r-- | docs/client_examples/plot-async-db.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/docs/client_examples/plot-async-db.py b/docs/client_examples/plot-async-db.py new file mode 100644 index 00000000..018a1a1d --- /dev/null +++ b/docs/client_examples/plot-async-db.py @@ -0,0 +1,45 @@ +import csv +from matplotlib import pyplot as plt + +FILE = "bench.csv" + +# config the plot +plt.xlabel('number of inserts') +plt.ylabel('time (seconds)') +plt.title('SQLCipher parallelization') + +kwargs = { + 'linewidth': 1.0, + 'linestyle': '-', +} + +series = (('sync', 'r'), + ('async', 'g')) + +data = {'mark': [], + 'sync': [], + 'async': []} + +with open(FILE, 'rb') as csvfile: + series_reader = csv.reader(csvfile, delimiter=',') + for m, s, a in series_reader: + data['mark'].append(int(m)) + data['sync'].append(float(s)) + data['async'].append(float(a)) + +xmax = max(data['mark']) +xmin = min(data['mark']) +ymax = max(data['sync'] + data['async']) +ymin = min(data['sync'] + data['async']) + +for run in series: + name = run[0] + color = run[1] + plt.plot(data['mark'], data[name], label=name, color=color, **kwargs) + +plt.axes().annotate("", xy=(xmax, ymax)) +plt.axes().annotate("", xy=(xmin, ymin)) + +plt.grid() +plt.legend() +plt.show() |