forked from lorca/flat_file_benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_benchmarks.py
40 lines (30 loc) · 1.01 KB
/
plot_benchmarks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
import pickle
import numpy as np
import matplotlib
matplotlib.use('Cairo')
import matplotlib.pyplot as plt
import os
fig = plt.figure()
def plot(label, filename):
global fig
stat = pickle.load(open(filename))["mem"]["Active"]
stat = [int((int(number) - int(stat[0]))/1024.0) for number in stat]
ax = fig.add_subplot(111)
ax.plot(stat, label=label)
ax.set_xlabel("Time (s)")
ax.set_ylabel("Memory Usage (M)")
leg = ax.legend(loc="lower right")
# print ",".join([label,str(len(stat)),str(stat[-1])])
print "<tr><td>", label, "</td><td>", str(len(stat)), "</td><td>", str(stat[-1]), "</td></tr>"
filenames = []
for root, dirs, files in os.walk("output"):
for name in files: filenames.append((root,name))
filenames.sort()
for filename in filenames:
path = filename[0]
name = filename[1]
label = name.replace(".benchmark","")
plot(label, path + "/" + name)
fig.suptitle("Reading a 135M TSV File into Memory")
plt.savefig("pics/benchmark.png")