-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmarks.py
79 lines (58 loc) · 2.18 KB
/
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
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
#!/bin/python3
import pytest
import random
from negotiation import negotiation, dynamicTrust, analysis, planning, execution
from dataset_reader import getServicesFromDataset
@pytest.mark.benchmark(
group = "negotiation",
min_rounds = 5,
disable_gc = True,
warmup = False
)
def test_negotiation(benchmark, request):
services = getServicesFromDataset(f"{request.config.getoption('--path')}/datasets/execution1/dataset_{request.config.getoption('--setting')}.csv")
benchmark(negotiation, services)
@pytest.mark.benchmark(
group = "dynamic_trust",
min_rounds = 5,
disable_gc = True,
warmup = False
)
def test_dynamicTrust(benchmark, request):
system = negotiation(getServicesFromDataset(f"{request.config.getoption('--path')}/datasets/execution1/dataset_{request.config.getoption('--setting')}.csv"))
benchmark(dynamicTrust, system)
@pytest.mark.benchmark(
group = "analysis",
min_rounds = 5,
disable_gc = True,
warmup = False
)
def test_analysis(benchmark, request):
services = negotiation(getServicesFromDataset(f"{request.config.getoption('--path')}/datasets/execution1/dataset_{request.config.getoption('--setting')}.csv"))
tmp = None
for n in services:
if n[0]['change'] != (None, None):
tmp = n
break
if tmp is None:
services[0][0]['change'] != ('sd0', 1)
tmp = services[0]
benchmark(analysis, tmp, services)
@pytest.mark.benchmark(
group = "planning",
min_rounds = 5,
disable_gc = True,
warmup = False
)
def test_planning(benchmark, request):
services = negotiation(getServicesFromDataset(f"{request.config.getoption('--path')}/datasets/execution1/dataset_{request.config.getoption('--setting')}.csv"))
benchmark(planning, services[0], services)
@pytest.mark.benchmark(
group = "execution",
min_rounds = 5,
disable_gc = True,
warmup = False
)
def test_execution(benchmark, request):
services = negotiation(getServicesFromDataset(f"{request.config.getoption('--path')}/datasets/execution1/dataset_{request.config.getoption('--setting')}.csv"))
benchmark(execution, bool(random.getrandbits(1)), services[0], services)