-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgraph_random_actions.py
46 lines (33 loc) · 1.17 KB
/
graph_random_actions.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
40
41
42
43
44
45
46
import matplotlib.pyplot as plt
import os
BENCHMARK_RESULTS_DIR = 'benchmark_results/'
BENCHMARK_RESULT_GRAPHS_DIR = 'talc/benchmark_graphs/'
def get_benchmark_data(filename):
with open(filename, 'r') as f:
rows = f.readlines()
max_sizes = [int(i) for i in rows[0].split(',')[1:]]
allocators = {}
for row in rows[1:]:
lst = row.split(',')
allocators[lst[0]] = [float(i) for i in lst[1:]]
return max_sizes, allocators
def main():
if not os.path.exists(BENCHMARK_RESULTS_DIR):
os.mkdir(BENCHMARK_RESULTS_DIR)
filename = "Random Actions Benchmark.csv"
max_sizes, data = get_benchmark_data(BENCHMARK_RESULTS_DIR + filename)
yvalues = []
for k, v in data.items():
plt.plot(max_sizes, v, label=k)
yvalues.append(v)
plt.xscale('log')
plt.yscale('log')
plt.legend()
plt.title(filename[:filename.find('.csv')])
plt.xticks(ticks=max_sizes, labels=[str(x) + " / " + str(x*10) for x in max_sizes], rotation=15)
plt.xlabel('Max Allocation Size (bytes) / Max Reallocation Size (bytes)')
plt.ylabel('score')
plt.tight_layout()
plt.show()
if __name__ == '__main__':
main()