diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2013-03-12 13:13:22 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2013-03-12 13:42:34 -0400 |
commit | 0e71f86251307a37161cf3de2704a59882e25258 (patch) | |
tree | f6f28c6c1f9ff2edc68b64c164575728aa349bba /bin | |
parent | fccb957780cf9685539b1d0717a5193248b30e48 (diff) |
Change convenience API routines.
The sproadic_*() macros have become unwieldy. This patch
replaces those convenience macros for global, clustered,
and partitioned scheduling. A part of this API change
is the explicit use of nanosecond time-values. Prior APIs
have used lt_t (litmus time), which had an implied time
scale of nanoseconds.
/bin apps and test suite also updated to use revised API.
Modifications to the test suite are mostly centered around
using nanoseconds instead of milliseconds.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/base_mt_task.c | 10 | ||||
-rw-r--r-- | bin/base_task.c | 10 | ||||
-rw-r--r-- | bin/release_ts.c | 5 | ||||
-rw-r--r-- | bin/rt_launch.c | 4 | ||||
-rw-r--r-- | bin/rtspin.c | 27 |
5 files changed, 31 insertions, 25 deletions
diff --git a/bin/base_mt_task.c b/bin/base_mt_task.c index 8090cc3..aec79a4 100644 --- a/bin/base_mt_task.c +++ b/bin/base_mt_task.c | |||
@@ -26,8 +26,6 @@ | |||
26 | #define RELATIVE_DEADLINE 100 | 26 | #define RELATIVE_DEADLINE 100 |
27 | #define EXEC_COST 10 | 27 | #define EXEC_COST 10 |
28 | 28 | ||
29 | #define NS_PER_MS 1e6 | ||
30 | |||
31 | /* Let's create 10 threads in the example, | 29 | /* Let's create 10 threads in the example, |
32 | * for a total utilization of 1. | 30 | * for a total utilization of 1. |
33 | */ | 31 | */ |
@@ -129,10 +127,10 @@ void* rt_thread(void *tcontext) | |||
129 | struct rt_task param; | 127 | struct rt_task param; |
130 | 128 | ||
131 | /* Set up task parameters */ | 129 | /* Set up task parameters */ |
132 | memset(¶m, 0, sizeof(param)); | 130 | init_rt_task_param(¶m); |
133 | param.exec_cost = EXEC_COST * NS_PER_MS; | 131 | param.exec_cost = ms2ns(EXEC_COST); |
134 | param.period = PERIOD * NS_PER_MS; | 132 | param.period = ms2ns(PERIOD); |
135 | param.relative_deadline = RELATIVE_DEADLINE * NS_PER_MS; | 133 | param.relative_deadline = ms2ns(RELATIVE_DEADLINE); |
136 | 134 | ||
137 | /* What to do in the case of budget overruns? */ | 135 | /* What to do in the case of budget overruns? */ |
138 | param.budget_policy = NO_ENFORCEMENT; | 136 | param.budget_policy = NO_ENFORCEMENT; |
diff --git a/bin/base_task.c b/bin/base_task.c index df0c5a2..09edba9 100644 --- a/bin/base_task.c +++ b/bin/base_task.c | |||
@@ -30,8 +30,6 @@ | |||
30 | #define RELATIVE_DEADLINE 100 | 30 | #define RELATIVE_DEADLINE 100 |
31 | #define EXEC_COST 10 | 31 | #define EXEC_COST 10 |
32 | 32 | ||
33 | #define NS_PER_MS 1e6 | ||
34 | |||
35 | /* Catch errors. | 33 | /* Catch errors. |
36 | */ | 34 | */ |
37 | #define CALL( exp ) do { \ | 35 | #define CALL( exp ) do { \ |
@@ -69,10 +67,10 @@ int main(int argc, char** argv) | |||
69 | struct rt_task param; | 67 | struct rt_task param; |
70 | 68 | ||
71 | /* Setup task parameters */ | 69 | /* Setup task parameters */ |
72 | memset(¶m, 0, sizeof(param)); | 70 | init_rt_task_param(¶m); |
73 | param.exec_cost = EXEC_COST * NS_PER_MS; | 71 | param.exec_cost = ms2ns(EXEC_COST); |
74 | param.period = PERIOD * NS_PER_MS; | 72 | param.period = ms2ns(PERIOD); |
75 | param.relative_deadline = RELATIVE_DEADLINE * NS_PER_MS; | 73 | param.relative_deadline = ms2ns(RELATIVE_DEADLINE); |
76 | 74 | ||
77 | /* What to do in the case of budget overruns? */ | 75 | /* What to do in the case of budget overruns? */ |
78 | param.budget_policy = NO_ENFORCEMENT; | 76 | param.budget_policy = NO_ENFORCEMENT; |
diff --git a/bin/release_ts.c b/bin/release_ts.c index c2f6d4c..feca5ef 100644 --- a/bin/release_ts.c +++ b/bin/release_ts.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include "internal.h" | 10 | #include "internal.h" |
11 | 11 | ||
12 | #define OPTSTR "d:wf:" | 12 | #define OPTSTR "d:wf:" |
13 | #define NS_PER_MS 1000000 | ||
14 | 13 | ||
15 | #define LITMUS_STATS_FILE "/proc/litmus/stats" | 14 | #define LITMUS_STATS_FILE "/proc/litmus/stats" |
16 | 15 | ||
@@ -44,7 +43,7 @@ void wait_until_ready(int expected) | |||
44 | int main(int argc, char** argv) | 43 | int main(int argc, char** argv) |
45 | { | 44 | { |
46 | int released; | 45 | int released; |
47 | lt_t delay = ms2lt(1000); | 46 | lt_t delay = ms2ns(1000); |
48 | int wait = 0; | 47 | int wait = 0; |
49 | int expected = 0; | 48 | int expected = 0; |
50 | int opt; | 49 | int opt; |
@@ -52,7 +51,7 @@ int main(int argc, char** argv) | |||
52 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { | 51 | while ((opt = getopt(argc, argv, OPTSTR)) != -1) { |
53 | switch (opt) { | 52 | switch (opt) { |
54 | case 'd': | 53 | case 'd': |
55 | delay = ms2lt(atoi(optarg)); | 54 | delay = ms2ns(atoi(optarg)); |
56 | break; | 55 | break; |
57 | case 'w': | 56 | case 'w': |
58 | wait = 1; | 57 | wait = 1; |
diff --git a/bin/rt_launch.c b/bin/rt_launch.c index ae68601..93f10d5 100644 --- a/bin/rt_launch.c +++ b/bin/rt_launch.c | |||
@@ -99,8 +99,8 @@ int main(int argc, char** argv) | |||
99 | 99 | ||
100 | if (argc - optind < 3) | 100 | if (argc - optind < 3) |
101 | usage("Arguments missing."); | 101 | usage("Arguments missing."); |
102 | wcet = ms2lt(atoi(argv[optind + 0])); | 102 | wcet = ms2ns(atoi(argv[optind + 0])); |
103 | period = ms2lt(atoi(argv[optind + 1])); | 103 | period = ms2ns(atoi(argv[optind + 1])); |
104 | if (wcet <= 0) | 104 | if (wcet <= 0) |
105 | usage("The worst-case execution time must be a " | 105 | usage("The worst-case execution time must be a " |
106 | "positive number."); | 106 | "positive number."); |
diff --git a/bin/rtspin.c b/bin/rtspin.c index b05c17c..167741d 100644 --- a/bin/rtspin.c +++ b/bin/rtspin.c | |||
@@ -185,7 +185,6 @@ static int job(double exec_time, double program_end, int lock_od, double cs_leng | |||
185 | } | 185 | } |
186 | 186 | ||
187 | #define OPTSTR "p:z:c:wlveo:f:s:q:X:L:Q:" | 187 | #define OPTSTR "p:z:c:wlveo:f:s:q:X:L:Q:" |
188 | |||
189 | int main(int argc, char** argv) | 188 | int main(int argc, char** argv) |
190 | { | 189 | { |
191 | int ret; | 190 | int ret; |
@@ -207,6 +206,7 @@ int main(int argc, char** argv) | |||
207 | double scale = 1.0; | 206 | double scale = 1.0; |
208 | task_class_t class = RT_CLASS_HARD; | 207 | task_class_t class = RT_CLASS_HARD; |
209 | int cur_job = 0, num_jobs = 0; | 208 | int cur_job = 0, num_jobs = 0; |
209 | struct rt_task param; | ||
210 | 210 | ||
211 | /* locking */ | 211 | /* locking */ |
212 | int lock_od = -1; | 212 | int lock_od = -1; |
@@ -308,8 +308,8 @@ int main(int argc, char** argv) | |||
308 | wcet_ms = atof(argv[optind + 0]); | 308 | wcet_ms = atof(argv[optind + 0]); |
309 | period_ms = atof(argv[optind + 1]); | 309 | period_ms = atof(argv[optind + 1]); |
310 | 310 | ||
311 | wcet = wcet_ms * __NS_PER_MS; | 311 | wcet = ms2ns(wcet_ms); |
312 | period = period_ms * __NS_PER_MS; | 312 | period = ms2ns(period_ms); |
313 | if (wcet <= 0) | 313 | if (wcet <= 0) |
314 | usage("The worst-case execution time must be a " | 314 | usage("The worst-case execution time must be a " |
315 | "positive number."); | 315 | "positive number."); |
@@ -325,11 +325,22 @@ int main(int argc, char** argv) | |||
325 | else if (file && num_jobs > 1) | 325 | else if (file && num_jobs > 1) |
326 | duration += period_ms * 0.001 * (num_jobs - 1); | 326 | duration += period_ms * 0.001 * (num_jobs - 1); |
327 | 327 | ||
328 | ret = sporadic_task_ns(wcet, period, 0, cluster, cluster_size, | 328 | if (migrate) { |
329 | priority, class, | 329 | ret = be_migrate_to_cluster(cluster, cluster_size); |
330 | want_enforcement ? PRECISE_ENFORCEMENT | 330 | if (ret < 0) |
331 | : NO_ENFORCEMENT, | 331 | bail_out("could not migrate to target partition or cluster."); |
332 | migrate); | 332 | } |
333 | |||
334 | init_rt_task_param(¶m); | ||
335 | param.exec_cost = wcet; | ||
336 | param.period = period; | ||
337 | param.priority = priority; | ||
338 | param.cls = class; | ||
339 | param.budget_policy = (want_enforcement) ? | ||
340 | PRECISE_ENFORCEMENT : NO_ENFORCEMENT; | ||
341 | if (migrate) | ||
342 | param.cpu = cluster_to_first_cpu(cluster, cluster_size); | ||
343 | ret = set_rt_task_param(gettid(), ¶m); | ||
333 | if (ret < 0) | 344 | if (ret < 0) |
334 | bail_out("could not setup rt task params"); | 345 | bail_out("could not setup rt task params"); |
335 | 346 | ||