-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtesting.py
106 lines (81 loc) · 3.27 KB
/
testing.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
"""Module for different testing scenarios."""
import logging
import os
import simsogui
import time
from database_interface import Database
from rta import rta_audsley, rta_buttazzo
from simulation import simulate
from utilization import basic_utilization_test, rm_utilization_test, hb_utilization_test
from workload import rm_workload_test, het_workload_test
def test_schedulability_test():
"""Main function for testing of single schedulability tests."""
my_database = Database(os.getcwd(), "panda_v3.db")
taskset_46429 = my_database.read_table_taskset(taskset_id=46429)[0]
print("----- Simulation -----")
start_t = time.time()
result = simulate(taskset_46429)
end_t = time.time()
print("Result: %r -- Time elapsed: %f s" % (result, end_t - start_t))
print("----- Basic Utilization -----")
start_t = time.time()
result = basic_utilization_test(taskset_46429)
end_t = time.time()
print("Result: %r -- Time elapsed: %f s" % (result, end_t - start_t))
print("----- RM Utilization -----")
start_t = time.time()
result = rm_utilization_test(taskset_46429)
end_t = time.time()
print("Result: %r -- Time elapsed: %f s" % (result, end_t - start_t))
print("----- HB Utilization -----")
start_t = time.time()
result = hb_utilization_test(taskset_46429)
end_t = time.time()
print("Result: %r -- Time elapsed: %f s" % (result, end_t - start_t))
print("----- RTA Audsley -----")
start_t = time.time()
result = rta_audsley(taskset_46429)
end_t = time.time()
print("Result: %r -- Time elapsed: %f s" % (result, end_t - start_t))
print("----- RTA Buttazzo -----")
start_t = time.time()
result = rta_buttazzo(taskset_46429)
end_t = time.time()
print("Result: %r -- Time elapsed: %f s" % (result, end_t - start_t))
print("----- RM Workload -----")
start_t = time.time()
result = rm_workload_test(taskset_46429)
end_t = time.time()
print("Result: %r -- Time elapsed: %f s" % (result, end_t - start_t))
print("----- HET Workload -----")
start_t = time.time()
result = het_workload_test(taskset_46429)
end_t = time.time()
print("Result: %r -- Time elapsed: %f s" % (result, end_t - start_t))
def start_simso():
"""Start SimSo GUI."""
simsogui.run_gui()
def time_per_taskset():
# load the dataset
my_database = Database(os.getcwd(), "panda_v3.db")
dataset = my_database.read_table_taskset()
# create empty list for times
times = []
for taskset in dataset: # iterate over all task-sets
# do schedulability analysis
start_t = time.time()
simulate(taskset)
end_t = time.time()
# add time
times.append(end_t - start_t)
# calculate average time
average_t = sum(times) / len(times)
print("SIMULATION -- Average time per task-set: %f s" % (average_t))
if __name__ == "__main__":
# Configure logging: format should be "LEVELNAME: Message",
# logging level should be DEBUG (all messages are shown)
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
# start_simso()
test_schedulability_test()
# start SimSo GUI
start_simso()