aboutsummaryrefslogtreecommitdiffstats
path: root/bin/rtspin.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/rtspin.c')
-rw-r--r--bin/rtspin.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/bin/rtspin.c b/bin/rtspin.c
index 1daed82..8ee26d5 100644
--- a/bin/rtspin.c
+++ b/bin/rtspin.c
@@ -67,7 +67,7 @@ static void get_exec_times(const char *file, const int column,
67 bail_out("rewinding file failed"); 67 bail_out("rewinding file failed");
68 68
69 /* allocate space for exec times */ 69 /* allocate space for exec times */
70 *exec_times = calloc(*num_jobs, sizeof(*exec_times)); 70 *exec_times = (double*)calloc(*num_jobs, sizeof(*exec_times));
71 if (!*exec_times) 71 if (!*exec_times)
72 bail_out("couldn't allocate memory"); 72 bail_out("couldn't allocate memory");
73 73
@@ -161,7 +161,7 @@ static int job(double exec_time, double program_end)
161 loop_for(exec_time, program_end + 1); 161 loop_for(exec_time, program_end + 1);
162 } 162 }
163 LITMUS_CATCH(SIG_BUDGET) { 163 LITMUS_CATCH(SIG_BUDGET) {
164 printf("Exhausted budget! Finishing job NOW!\n"); 164 fprintf(stdout, "Exhausted budget! Finishing job NOW!\n");
165 } 165 }
166 END_LITMUS_TRY; 166 END_LITMUS_TRY;
167 } 167 }
@@ -193,7 +193,7 @@ int main(int argc, char** argv)
193 double duration = 0, start; 193 double duration = 0, start;
194 double *exec_times = NULL; 194 double *exec_times = NULL;
195 double scale = 1.0; 195 double scale = 1.0;
196 task_class_t class = RT_CLASS_HARD; 196 task_class_t rt_class = RT_CLASS_HARD;
197 int cur_job, num_jobs; 197 int cur_job, num_jobs;
198 198
199 progname = argv[0]; 199 progname = argv[0];
@@ -208,8 +208,8 @@ int main(int argc, char** argv)
208 migrate = 1; 208 migrate = 1;
209 break; 209 break;
210 case 'c': 210 case 'c':
211 class = str2class(optarg); 211 rt_class = str2class(optarg);
212 if (class == -1) 212 if (rt_class == -1)
213 usage("Unknown task class."); 213 usage("Unknown task class.");
214 break; 214 break;
215 case 'e': 215 case 'e':
@@ -290,7 +290,7 @@ int main(int argc, char** argv)
290 bail_out("could not migrate to target partition"); 290 bail_out("could not migrate to target partition");
291 } 291 }
292 292
293 ret = sporadic_task_ns(wcet, period, 0, cpu, class, 293 ret = sporadic_task_ns(wcet, period, 0, cpu, rt_class,
294 want_enforcement ? PRECISE_ENFORCEMENT 294 want_enforcement ? PRECISE_ENFORCEMENT
295 : NO_ENFORCEMENT, 295 : NO_ENFORCEMENT,
296 want_signals ? PRECISE_SIGNALS 296 want_signals ? PRECISE_SIGNALS
@@ -303,7 +303,7 @@ int main(int argc, char** argv)
303 303
304 if (want_signals) { 304 if (want_signals) {
305 /* bind default longjmp signal handler to SIG_BUDGET. */ 305 /* bind default longjmp signal handler to SIG_BUDGET. */
306 activate_litmus_signals(SIG_BUDGET_MASK, longjmp_on_litmus_signal); 306 activate_litmus_signals(SIG_BUDGET_MASK, longjmp_on_litmus_signal);
307 } 307 }
308 308
309 ret = task_mode(LITMUS_RT_TASK); 309 ret = task_mode(LITMUS_RT_TASK);
@@ -327,7 +327,10 @@ int main(int argc, char** argv)
327 } 327 }
328 } else { 328 } else {
329 /* conver to seconds and scale */ 329 /* conver to seconds and scale */
330 while (job(wcet_ms * 0.001 * scale, start + duration)); 330 int run = 1;
331 while (run) {
332 run = job(wcet_ms * 0.001 * scale, start + duration);
333 }
331 } 334 }
332 335
333 ret = task_mode(BACKGROUND_TASK); 336 ret = task_mode(BACKGROUND_TASK);