diff options
author | Namhoon Kim <namhoonk@cs.unc.edu> | 2017-04-03 23:35:59 -0400 |
---|---|---|
committer | Namhoon Kim <namhoonk@cs.unc.edu> | 2017-04-03 23:35:59 -0400 |
commit | fb72dd09cfc16d0260363d38df1225b6663bc084 (patch) | |
tree | db1472467249286171d3e35c4b7a77c165571892 /gen/edf_generators.py | |
parent | e15736509ab36e33bc71a0fe1120f2974e389725 (diff) |
MC2 supportHEADmc2-supportmaster
Diffstat (limited to 'gen/edf_generators.py')
-rw-r--r-- | gen/edf_generators.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/gen/edf_generators.py b/gen/edf_generators.py index 8e4b8df..c769e46 100644 --- a/gen/edf_generators.py +++ b/gen/edf_generators.py | |||
@@ -6,6 +6,7 @@ TP_TBASE = """#for $t in $task_set | |||
6 | #end for""" | 6 | #end for""" |
7 | TP_GLOB_TASK = TP_TBASE.format("") | 7 | TP_GLOB_TASK = TP_TBASE.format("") |
8 | TP_PART_TASK = TP_TBASE.format("-p $t.cpu") | 8 | TP_PART_TASK = TP_TBASE.format("-p $t.cpu") |
9 | TP_MC_TASK = TP_TBASE.format("-p $t.cpu -m $t.crit -i $t.id") | ||
9 | 10 | ||
10 | class EdfGenerator(gen.Generator): | 11 | class EdfGenerator(gen.Generator): |
11 | '''Creates sporadic task sets with the most common Litmus options.''' | 12 | '''Creates sporadic task sets with the most common Litmus options.''' |
@@ -16,7 +17,7 @@ class EdfGenerator(gen.Generator): | |||
16 | 17 | ||
17 | def __make_options(self): | 18 | def __make_options(self): |
18 | '''Return generic EDF options.''' | 19 | '''Return generic EDF options.''' |
19 | return [gen.Generator._dist_option('utils', 'uni-medium', | 20 | return [gen.Generator._dist_option('utils', 'uni-very-light', |
20 | gen.NAMED_UTILIZATIONS, | 21 | gen.NAMED_UTILIZATIONS, |
21 | 'Task utilization distributions.'), | 22 | 'Task utilization distributions.'), |
22 | gen.Generator._dist_option('periods', 'harmonic', | 23 | gen.Generator._dist_option('periods', 'harmonic', |
@@ -87,3 +88,33 @@ class GedfGenerator(EdfGenerator): | |||
87 | def __init__(self, params={}): | 88 | def __init__(self, params={}): |
88 | super(GedfGenerator, self).__init__("GSN-EDF", [TP_GLOB_TASK], | 89 | super(GedfGenerator, self).__init__("GSN-EDF", [TP_GLOB_TASK], |
89 | [], params) | 90 | [], params) |
91 | |||
92 | class Mc2Generator(EdfGenerator): | ||
93 | def __init__(self, params={}): | ||
94 | super(Mc2Generator, self).__init__("MC2", [TP_MC_TASK], | ||
95 | [], params) | ||
96 | |||
97 | def _customize(self, taskset, exp_params): | ||
98 | cpus = exp_params['cpus'] | ||
99 | start = 0 | ||
100 | |||
101 | # Partition using worst-fit for most even distribution | ||
102 | utils = [0]*cpus | ||
103 | tasks = [0]*cpus | ||
104 | index = [1]*cpus | ||
105 | taskset = sorted(taskset, key=lambda task: task.period) | ||
106 | for t in taskset: | ||
107 | t.cpu = utils.index(min(utils)) | ||
108 | t.id = index[t.cpu] | ||
109 | if utils[t.cpu] < 0.05: | ||
110 | t.crit = 0 | ||
111 | elif utils[t.cpu] < 0.10: | ||
112 | t.crit = 1 | ||
113 | else: | ||
114 | t.crit = 2 | ||
115 | utils[t.cpu] += t.utilization() | ||
116 | tasks[t.cpu] += 1 | ||
117 | index[t.cpu] += 1 | ||
118 | |||
119 | # Increment by one so release master has no tasks | ||
120 | t.cpu += start | ||