aboutsummaryrefslogtreecommitdiffstats
path: root/schedcat/sched/__init__.py
blob: fb5d295ae871a34bd34219ce015be2121c7125c0 (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

# Python model to C++ model conversion code.


try:
    from .native import TaskSet

    using_native = True

    def get_native_taskset(tasks):
        ts = TaskSet()
        for t in tasks:
            if (hasattr(t, 'prio_pt')):
                ts.add_task(t.cost, t.period, t.deadline, t.prio_pt)
            else:
                ts.add_task(t.cost, t.period, t.deadline)
        return ts

except ImportError:
    # Nope, C++ impl. not available. Use Python implementation.
    using_native = False
    def get_native_taskset(tasks):
        assert False # C++ implementation not available