aboutsummaryrefslogtreecommitdiffstats
path: root/gen/edf_generators.py
diff options
context:
space:
mode:
Diffstat (limited to 'gen/edf_generators.py')
-rw-r--r--gen/edf_generators.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/gen/edf_generators.py b/gen/edf_generators.py
index 3f05b76..a722c21 100644
--- a/gen/edf_generators.py
+++ b/gen/edf_generators.py
@@ -16,10 +16,10 @@ class EdfGenerator(gen.Generator):
16 16
17 def __make_options(self): 17 def __make_options(self):
18 '''Return generic EDF options.''' 18 '''Return generic EDF options.'''
19 return [gen.Generator._dist_option('utils', ['uni-medium'], 19 return [gen.Generator._dist_option('utils', 'uni-medium',
20 gen.NAMED_UTILIZATIONS, 20 gen.NAMED_UTILIZATIONS,
21 'Task utilization distributions.'), 21 'Task utilization distributions.'),
22 gen.Generator._dist_option('periods', ['harmonic'], 22 gen.Generator._dist_option('periods', 'harmonic',
23 gen.NAMED_PERIODS, 23 gen.NAMED_PERIODS,
24 'Task period distributions.')] 24 'Task period distributions.')]
25 25
@@ -50,10 +50,22 @@ class PartitionedGenerator(EdfGenerator):
50 templates + [TP_PART_TASK], options, params) 50 templates + [TP_PART_TASK], options, params)
51 51
52 def _customize(self, taskset, exp_params): 52 def _customize(self, taskset, exp_params):
53 start = 1 if exp_params['release_master'] else 0 53 cpus = exp_params['cpus']
54 # Random partition for now: could do a smart partitioning 54 start = 0
55 if exp_params['release_master']:
56 cpus -= 1
57 start = 1
58
59 # Partition using worst-fit for most even distribution
60 utils = [0]*cpus
61 tasks = [0]*cpus
55 for t in taskset: 62 for t in taskset:
56 t.cpu = random.randint(start, exp_params['cpus'] - 1) 63 t.cpu = utils.index(min(utils))
64 utils[t.cpu] += t.utilization()
65 tasks[t.cpu] += 1
66
67 # Increment by one so release master has no tasks
68 t.cpu += start
57 69
58class PedfGenerator(PartitionedGenerator): 70class PedfGenerator(PartitionedGenerator):
59 def __init__(self, params={}): 71 def __init__(self, params={}):
@@ -61,7 +73,7 @@ class PedfGenerator(PartitionedGenerator):
61 73
62class CedfGenerator(PartitionedGenerator): 74class CedfGenerator(PartitionedGenerator):
63 TP_CLUSTER = "plugins/C-EDF/cluster{$level}" 75 TP_CLUSTER = "plugins/C-EDF/cluster{$level}"
64 CLUSTER_OPTION = gen.GenOption('level', ['L2', 'L3', 'All'], ['L2'], 76 CLUSTER_OPTION = gen.GenOption('level', ['L2', 'L3', 'All'], 'L2',
65 'Cache clustering level.',) 77 'Cache clustering level.',)
66 78
67 def __init__(self, params={}): 79 def __init__(self, params={}):