diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2009-04-29 11:47:36 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2009-04-29 11:47:36 -0400 |
commit | 5ca18ac12e0f7ec5f50701685f31b85013a4d1b0 (patch) | |
tree | 75a8ec7717c43d481a2793ed0863fc497d21ca8b | |
parent | f60873de7c15d578974566bd052280666c759864 (diff) |
rtspin: allow fractional costs and periods
-rw-r--r-- | bin/rtspin.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/rtspin.c b/bin/rtspin.c index 7829942..592f301 100644 --- a/bin/rtspin.c +++ b/bin/rtspin.c | |||
@@ -132,6 +132,7 @@ int main(int argc, char** argv) | |||
132 | int ret; | 132 | int ret; |
133 | lt_t wcet; | 133 | lt_t wcet; |
134 | lt_t period; | 134 | lt_t period; |
135 | double wcet_ms, period_ms; | ||
135 | int migrate = 0; | 136 | int migrate = 0; |
136 | int cpu = 0; | 137 | int cpu = 0; |
137 | int opt; | 138 | int opt; |
@@ -183,9 +184,11 @@ int main(int argc, char** argv) | |||
183 | 184 | ||
184 | if (argc - optind < 3) | 185 | if (argc - optind < 3) |
185 | usage("Arguments missing."); | 186 | usage("Arguments missing."); |
186 | wcet = atoi(argv[optind + 0]); | 187 | wcet_ms = atof(argv[optind + 0]); |
187 | period = atoi(argv[optind + 1]); | 188 | period_ms = atof(argv[optind + 1]); |
188 | duration = atof(argv[optind + 2]); | 189 | duration = atof(argv[optind + 2]); |
190 | wcet = wcet_ms * __NS_PER_MS; | ||
191 | period = period_ms * __NS_PER_MS; | ||
189 | if (wcet <= 0) | 192 | if (wcet <= 0) |
190 | usage("The worst-case execution time must be a " | 193 | usage("The worst-case execution time must be a " |
191 | "positive number."); | 194 | "positive number."); |
@@ -202,7 +205,7 @@ int main(int argc, char** argv) | |||
202 | bail_out("could not migrate to target partition"); | 205 | bail_out("could not migrate to target partition"); |
203 | } | 206 | } |
204 | 207 | ||
205 | ret = sporadic_task(wcet, period, 0, cpu, class, migrate); | 208 | ret = sporadic_task_ns(wcet, period, 0, cpu, class, migrate); |
206 | 209 | ||
207 | if (ret < 0) | 210 | if (ret < 0) |
208 | bail_out("could not become rt tasks."); | 211 | bail_out("could not become rt tasks."); |
@@ -225,7 +228,7 @@ int main(int argc, char** argv) | |||
225 | start = wctime(); | 228 | start = wctime(); |
226 | 229 | ||
227 | while (start + duration > wctime()) { | 230 | while (start + duration > wctime()) { |
228 | job(wcet * 0.0009); /* 90% wcet, in seconds */ | 231 | job(wcet_ms * 0.0009); /* 90% wcet, in seconds */ |
229 | } | 232 | } |
230 | 233 | ||
231 | return 0; | 234 | return 0; |