From eff718df52ffeb21bff6b59a5584e5b641887832 Mon Sep 17 00:00:00 2001 From: Jeremy Erickson Date: Mon, 25 Nov 2013 16:00:17 -0500 Subject: Add example code and related end-to-end tests. --- example/overheads.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 example/overheads.py (limited to 'example/overheads.py') 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 @@ +#Necessary includes and stuff + +from schedcat.overheads.model import Overheads, CacheDelay +from schedcat.overheads.jlfp import charge_scheduling_overheads, \ + quantize_params +from schedcat.sched.edf.gel_pl import bound_gfl_response_times, \ + has_bounded_tardiness + +def copy_lock_overheads(oh, lock_oh): + oh.lock = lock_oh.lock + oh.unlock = lock_oh.unlock + oh.read_lock = lock_oh.read_lock + oh.read_unlock = lock_oh.read_unlock + oh.syscall_in = lock_oh.syscall_in + oh.syscall_out = lock_oh.syscall_out + +def get_oh_object(basic_oh, lock_oh, cache_oh, cache_level): + oh = Overheads.from_file(basic_oh) + oh.initial_cache_loss = \ + CacheDelay.from_file(cache_oh).__dict__[cache_level] + oh.cache_affinity_loss = \ + CacheDelay.from_file(cache_oh).__dict__[cache_level] + if lock_oh is not None: + lock_oh = Overheads.from_file(lock_oh) + copy_lock_overheads(oh, lock_oh) + return oh + +#Assumes absence of locking +def bound_cfl_with_oh(oheads, dedicated_irq, clusts): + for clust in clusts: + success = charge_scheduling_overheads(oheads, clust.cpus, + dedicated_irq, + clust) + quantize_params(clust) + if (success and has_bounded_tardiness(clust.cpus, clust)): + bound_gfl_response_times(clust.cpus, clust, 15) + else: + return False + return True -- cgit v1.2.2