-
Notifications
You must be signed in to change notification settings - Fork 0
/
search_tests_memory.py
86 lines (70 loc) · 2.54 KB
/
search_tests_memory.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import os
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
def main():
matplotlib.rcParams['text.usetex'] = True
sns.set(font_scale=1.7, style="whitegrid")
x_label = "Number of Concurrent Requests"
y_label = "memory Util (\%)"
title = "Access Requests"
base_dir = "results_resource_usage/"
base_filename = "searchtests_memory_search"
y_min = 0
y_tick = None
x_min = 5
x_max = 50
x_tick = 5
linewidth = 3
reqs = np.arange(x_min, x_max + 1, x_tick)
files = [("search 100 - without server authentication", base_dir+"search_memory_searchtests_false_100"),
("search 1000 - without server authentication", base_dir+"search_memory_searchtests_false_1000"),
("search 10000 - without server authentication", base_dir+"search_memory_searchtests_false_10000"),
("search 100 - with server authentication", base_dir+"search_memory_searchtests_true_100"),
("search 1000 - with server authentication", base_dir+"search_memory_searchtests_true_1000"),
("search 10000 - with server authentication", base_dir+"search_memory_searchtests_true_10000")]
font = {
'family': 'Liberation Sans',
'weight': 'normal'
}
xmin = 0
y_max = 100
plt.ylim(ymax=y_max)
plt.ylim(ymin=0)
plt.rc('font', **font)
#plt.yticks(np.arange(0, y_max, y_tick))
plt.xticks(np.arange(0, x_max+5, x_tick))
plt.xlabel(x_label)
plt.ylabel(y_label)
plt.title(title)
plt.xlim(xmin=0)
plt.xlim(xmax=x_max+5)
mem_max = 0
for file in files:
f_name = file[1]
memory_usage = []
with open(f_name,'r') as f:
for line in f.readlines():
r_x = line.split("\t")[0]
memory = line.split("\t")[1]
memory_usage.append(float(memory))
memory_max = max(memory_usage)
y_max = max(y_max, memory_max)
plt.ylim(ymax=2.2*y_max)
plt.plot(reqs, memory_usage, marker='o', label=file[0])
plt.legend(['True Positive Ratio'], shadow=False)
plt.legend(loc='upper left', prop={'size': 15})
# plt.legend(fancybox=True, framealpha=0.3, bbox_to_anchor=(0, 0))
plt.legend(framealpha=0.2)
# plt.grid(axis='y')
# plt.grid(axis='x')
fig = plt.gcf()
# fig.tight_layout(pad=0.7 * 22 / font_size)
fig.tight_layout()
fig.set_size_inches(10, 7)
# plt.show()
plt.savefig("eps/" + base_filename + ".eps")
#
if __name__ == "__main__":
main()