aboutsummaryrefslogtreecommitdiffstats
path: root/example/overheads.py
blob: a022bae830b195d6f57c702bb3bdc103a0628d42 (plain) (blame)
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
#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