-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsim_graph.py
More file actions
75 lines (66 loc) · 2.11 KB
/
Copy pathsim_graph.py
File metadata and controls
75 lines (66 loc) · 2.11 KB
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
import model_multipaxos as model
import paxos_defaults as params
import matplotlib.pyplot as plt
import numpy as np
from cycler import cycler
repeats = 1
start_tp = 5
tp_step = 200
n_p = 1
fig, ax = plt.subplots()
plt.xlabel('Throughput (rounds/sec)')
plt.ylabel('Latency (ms)')
#plt.title('Throughput vs. Latency [Model]')
plt.rc('lines', linewidth=1)
colors = ['g', 'r', 'b', 'c', 'k']
markers = ['o', 's', '*', 'X', 'D']
colorID = 0
for n in range(300, 1300, 200):
lats = {}
Rmax = model.computeRmax(n, n_p, params.mu_md, params.mu_ms, params.ttx)
tp_step = 5
end_tp = int(Rmax)-4
print "end tp = " + str(end_tp)
print "Rmax = " + str(Rmax)
tp = []
r = start_tp
#for r in range(start_tp, end_tp, tp_step):
while r < end_tp:
tp.append(r)
r += tp_step
for i in range(0, repeats):
print "tick: " + str(n) + "," + str(r) + ","+str(i)
mu_r = 1000.0 / r
sigma_r = mu_r / 0.5
numops, simlats = model.model_random_round_arrival(
N=n,
qs=n / 2 + 1, # majority quorum
mu_local=params.mu_local,
sigma_local=params.sigma_local,
mu_ms=params.mu_ms,
sigma_ms=params.sigma_ms,
mu_md=params.mu_md,
sigma_md=params.sigma_md,
ttx=params.ttx,
ttx_stddev=params.ttx_stddev,
n_p=n_p,
mu_r=mu_r,
sigma_r=sigma_r,
sim_clients=True
)
l = np.average(simlats) * 1000 # convert to ms
# print "average = " + str(l) + " ms"
if r in lats:
lats[r] += l
else:
lats[r] = l
lats[r] /= repeats
# print lats
#tp = range(start_tp, end_tp, tp_step)
lat = [lats[key] for key in sorted(lats.keys(), reverse=False)]
print lat
p2 = ax.plot(tp, lat, marker=markers[colorID % 5], color=colors[colorID % 5], label=str(n) + " Nodes")
colorID += 1
plt.ylim(0,500)
legend = ax.legend(loc='lower right', shadow=True)
plt.show()