-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathplot.py
57 lines (42 loc) · 1.03 KB
/
plot.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
import csv
import matplotlib.pyplot as plt
import numpy as np
data = []
# loading load data without balance
load = []
for i in range(0, 100):
load.append(0)
for i in range(1,4):
fload = open("./log/log-c"+str(i)+"-load.txt")
j = 0
for row in csv.reader(fload):
load[j] = load[j] + float(row[0])*1000
j = j + 1
# loading load data with balance
bal = []
for i in range(0, 100):
bal.append(0)
for i in range(1,4):
fbal = open("./log/log-c"+str(i)+"-bal.txt")
j = 0
for row in csv.reader(fbal):
bal[j] = bal[j] + float(row[0])*1000
j = j + 1
for i in range(0, 100):
load[i] = load[i]/3
bal[i] = bal[i]/3
data.append(load)
data.append(bal)
f = open("./log/log-local.txt")
c = []
for row in csv.reader(f):
c.append(float(row[0])*1000)
data.append(c)
# plotting graph
x = np.linspace(0,len(data[0]), len(data[0]))
for i in data:
plt.plot(x, i)
plt.legend(['Non-Balanced under load', 'Balanced under load', 'Off Load'], prop={'size': 6})
plt.xlabel("Number of Requests")
plt.ylabel("Average Response Time (ms)")
plt.show()