aboutsummaryrefslogtreecommitdiffstats
path: root/example/overheads.py
diff options
context:
space:
mode:
Diffstat (limited to 'example/overheads.py')
-rw-r--r--example/overheads.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/example/overheads.py b/example/overheads.py
new file mode 100644
index 0000000..a022bae
--- /dev/null
+++ b/example/overheads.py
@@ -0,0 +1,39 @@
1#Necessary includes and stuff
2
3from schedcat.overheads.model import Overheads, CacheDelay
4from schedcat.overheads.jlfp import charge_scheduling_overheads, \
5 quantize_params
6from schedcat.sched.edf.gel_pl import bound_gfl_response_times, \
7 has_bounded_tardiness
8
9def copy_lock_overheads(oh, lock_oh):
10 oh.lock = lock_oh.lock
11 oh.unlock = lock_oh.unlock
12 oh.read_lock = lock_oh.read_lock
13 oh.read_unlock = lock_oh.read_unlock
14 oh.syscall_in = lock_oh.syscall_in
15 oh.syscall_out = lock_oh.syscall_out
16
17def get_oh_object(basic_oh, lock_oh, cache_oh, cache_level):
18 oh = Overheads.from_file(basic_oh)
19 oh.initial_cache_loss = \
20 CacheDelay.from_file(cache_oh).__dict__[cache_level]
21 oh.cache_affinity_loss = \
22 CacheDelay.from_file(cache_oh).__dict__[cache_level]
23 if lock_oh is not None:
24 lock_oh = Overheads.from_file(lock_oh)
25 copy_lock_overheads(oh, lock_oh)
26 return oh
27
28#Assumes absence of locking
29def bound_cfl_with_oh(oheads, dedicated_irq, clusts):
30 for clust in clusts:
31 success = charge_scheduling_overheads(oheads, clust.cpus,
32 dedicated_irq,
33 clust)
34 quantize_params(clust)
35 if (success and has_bounded_tardiness(clust.cpus, clust)):
36 bound_gfl_response_times(clust.cpus, clust, 15)
37 else:
38 return False
39 return True