diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-02-07 22:58:06 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-02-07 22:58:06 -0500 |
commit | 533e01b2b5c0d6b41d14dfc4e4166d83bf0895c1 (patch) | |
tree | 501b77e6218607427873777db2a7abb83b1efe3c | |
parent | ed2742a29674222173147b73f223bc7be01e1eaf (diff) |
Add support for static priority tasks.
-rw-r--r-- | bin/rtspin.c | 10 | ||||
-rw-r--r-- | include/litmus.h | 10 | ||||
-rw-r--r-- | src/litmus.c | 11 |
3 files changed, 21 insertions, 10 deletions
diff --git a/bin/rtspin.c b/bin/rtspin.c index ae76941..1244073 100644 --- a/bin/rtspin.c +++ b/bin/rtspin.c | |||
@@ -161,7 +161,7 @@ static int job(double exec_time, double program_end) | |||
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | #define OPTSTR "p:c:wlveo:f:s:" | 164 | #define OPTSTR "p:c:wlveo:f:s:q:" |
165 | 165 | ||
166 | int main(int argc, char** argv) | 166 | int main(int argc, char** argv) |
167 | { | 167 | { |
@@ -169,6 +169,7 @@ int main(int argc, char** argv) | |||
169 | lt_t wcet; | 169 | lt_t wcet; |
170 | lt_t period; | 170 | lt_t period; |
171 | double wcet_ms, period_ms; | 171 | double wcet_ms, period_ms; |
172 | unsigned int priority = 0; | ||
172 | int migrate = 0; | 173 | int migrate = 0; |
173 | int cpu = 0; | 174 | int cpu = 0; |
174 | int opt; | 175 | int opt; |
@@ -194,6 +195,11 @@ int main(int argc, char** argv) | |||
194 | cpu = atoi(optarg); | 195 | cpu = atoi(optarg); |
195 | migrate = 1; | 196 | migrate = 1; |
196 | break; | 197 | break; |
198 | case 'q': | ||
199 | priority = atoi(optarg); | ||
200 | if (priority == 0 || priority > LITMUS_MAX_PRIORITY) | ||
201 | usage("Invalid priority."); | ||
202 | break; | ||
197 | case 'c': | 203 | case 'c': |
198 | class = str2class(optarg); | 204 | class = str2class(optarg); |
199 | if (class == -1) | 205 | if (class == -1) |
@@ -274,7 +280,7 @@ int main(int argc, char** argv) | |||
274 | bail_out("could not migrate to target partition"); | 280 | bail_out("could not migrate to target partition"); |
275 | } | 281 | } |
276 | 282 | ||
277 | ret = sporadic_task_ns(wcet, period, 0, cpu, class, | 283 | ret = sporadic_task_ns(wcet, period, 0, cpu, priority, class, |
278 | want_enforcement ? PRECISE_ENFORCEMENT | 284 | want_enforcement ? PRECISE_ENFORCEMENT |
279 | : NO_ENFORCEMENT, | 285 | : NO_ENFORCEMENT, |
280 | migrate); | 286 | migrate); |
diff --git a/include/litmus.h b/include/litmus.h index 52435d8..c2ec40d 100644 --- a/include/litmus.h +++ b/include/litmus.h | |||
@@ -31,20 +31,22 @@ int get_rt_task_param(pid_t pid, struct rt_task* param); | |||
31 | /* times are given in ms */ | 31 | /* times are given in ms */ |
32 | int sporadic_task( | 32 | int sporadic_task( |
33 | lt_t e, lt_t p, lt_t phase, | 33 | lt_t e, lt_t p, lt_t phase, |
34 | int partition, task_class_t cls, | 34 | int partition, unsigned int priority, |
35 | task_class_t cls, | ||
35 | budget_policy_t budget_policy, int set_cpu_set); | 36 | budget_policy_t budget_policy, int set_cpu_set); |
36 | 37 | ||
37 | /* times are given in ns */ | 38 | /* times are given in ns */ |
38 | int sporadic_task_ns( | 39 | int sporadic_task_ns( |
39 | lt_t e, lt_t p, lt_t phase, | 40 | lt_t e, lt_t p, lt_t phase, |
40 | int cpu, task_class_t cls, | 41 | int cpu, unsigned int priority, |
42 | task_class_t cls, | ||
41 | budget_policy_t budget_policy, int set_cpu_set); | 43 | budget_policy_t budget_policy, int set_cpu_set); |
42 | 44 | ||
43 | /* budget enforcement off by default in these macros */ | 45 | /* budget enforcement off by default in these macros */ |
44 | #define sporadic_global(e, p) \ | 46 | #define sporadic_global(e, p) \ |
45 | sporadic_task(e, p, 0, 0, RT_CLASS_SOFT, NO_ENFORCEMENT, 0) | 47 | sporadic_task(e, p, 0, 0, 0, RT_CLASS_SOFT, NO_ENFORCEMENT, 0) |
46 | #define sporadic_partitioned(e, p, cpu) \ | 48 | #define sporadic_partitioned(e, p, cpu) \ |
47 | sporadic_task(e, p, 0, cpu, RT_CLASS_SOFT, NO_ENFORCEMENT, 1) | 49 | sporadic_task(e, p, 0, cpu, 0, RT_CLASS_SOFT, NO_ENFORCEMENT, 1) |
48 | 50 | ||
49 | /* file descriptor attached shared objects support */ | 51 | /* file descriptor attached shared objects support */ |
50 | typedef enum { | 52 | typedef enum { |
diff --git a/src/litmus.c b/src/litmus.c index d3cc6bb..d478ffc 100644 --- a/src/litmus.c +++ b/src/litmus.c | |||
@@ -42,16 +42,18 @@ int be_migrate_to(int target_cpu) | |||
42 | } | 42 | } |
43 | 43 | ||
44 | int sporadic_task(lt_t e, lt_t p, lt_t phase, | 44 | int sporadic_task(lt_t e, lt_t p, lt_t phase, |
45 | int cpu, task_class_t cls, | 45 | int cpu, unsigned int priority, |
46 | task_class_t cls, | ||
46 | budget_policy_t budget_policy, int set_cpu_set) | 47 | budget_policy_t budget_policy, int set_cpu_set) |
47 | { | 48 | { |
48 | return sporadic_task_ns(e * NS_PER_MS, p * NS_PER_MS, phase * NS_PER_MS, | 49 | return sporadic_task_ns(e * NS_PER_MS, p * NS_PER_MS, phase * NS_PER_MS, |
49 | cpu, cls, budget_policy, set_cpu_set); | 50 | cpu, priority, cls, budget_policy, set_cpu_set); |
50 | } | 51 | } |
51 | 52 | ||
52 | int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, | 53 | int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, |
53 | int cpu, task_class_t cls, | 54 | int cpu, unsigned int priority, |
54 | budget_policy_t budget_policy, int set_cpu_set) | 55 | task_class_t cls, |
56 | budget_policy_t budget_policy, int set_cpu_set) | ||
55 | { | 57 | { |
56 | struct rt_task param; | 58 | struct rt_task param; |
57 | int ret; | 59 | int ret; |
@@ -67,6 +69,7 @@ int sporadic_task_ns(lt_t e, lt_t p, lt_t phase, | |||
67 | param.cls = cls; | 69 | param.cls = cls; |
68 | param.phase = phase; | 70 | param.phase = phase; |
69 | param.budget_policy = budget_policy; | 71 | param.budget_policy = budget_policy; |
72 | param.priority = priority; | ||
70 | 73 | ||
71 | if (set_cpu_set) { | 74 | if (set_cpu_set) { |
72 | ret = be_migrate_to(cpu); | 75 | ret = be_migrate_to(cpu); |