git-svn-id: http://www.frescor.org/private/svn/frescor/fosa/trunk@1500
35b4ef3e-fd22-0410-ab77-
dab3279adceb
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
-// Copyright (C) 2006 - 2008 FRESCOR consortium partners:
+// Copyright (C) 2006 - 2009 FRESCOR consortium partners:
//
// Universidad de Cantabria, SPAIN
// University of York, UK
//
// Universidad de Cantabria, SPAIN
// University of York, UK
/* create the signal handler thread */
terror = fosa_thread_create(&tid1, &attr, signal_handler_thread, NULL);
if (terror) {
/* create the signal handler thread */
terror = fosa_thread_create(&tid1, &attr, signal_handler_thread, NULL);
if (terror) {
- printf("pthread_create signal handler\n");
+ printf("Error in pthread_create signal handler\n");
/* create the periodic thread */
terror = fosa_thread_create(&tid2, &attr, thread_body, NULL);
if (terror) {
/* create the periodic thread */
terror = fosa_thread_create(&tid2, &attr, thread_body, NULL);
if (terror) {
- printf("pthread_create periodic thread\n");
+ printf("Error in pthread_create periodic thread\n");
fosa_rel_time_t exec_time = fosa_msec_to_rel_time(1000); // 1 second
i++;
fosa_rel_time_t exec_time = fosa_msec_to_rel_time(1000); // 1 second
i++;
- printf("start regular code %d\n",i);
+ printf("start work (eat 1s) %d\n",i);
// regular code
// eat one second of budget
fosa_eat(&exec_time);
// every five cycles eat an additional one second of budget */
if (i%5==0) {
// regular code
// eat one second of budget
fosa_eat(&exec_time);
// every five cycles eat an additional one second of budget */
if (i%5==0) {
+ printf("start eating 1s more\n");
- printf("aqui tambien\n");
+ printf("finish work\n");
pthread_exit ( (void*)&error_status);
}
pthread_exit ( (void*)&error_status);
}
- printf("Start periodic thread body\n");
+ printf("Start periodic thread body with 1400ms budget\n");
pthread_exit ( (void*)&error_status);
}
pthread_exit ( (void*)&error_status);
}
- printf("Begin thread %ld msec\n", fosa_abs_time_to_msec(activation_time) );
+ printf("Begin thread at: %ld msec\n",
+ fosa_abs_time_to_msec(activation_time) );
i++;
timerinfo.dummy=i;
// save context
marte_nonlocaljmp_savecontext(&context);
i++;
timerinfo.dummy=i;
// save context
marte_nonlocaljmp_savecontext(&context);
+ printf ("context saved\n");
if (marte_nonlocaljmp_afterjmp(&context)==0) {
if (marte_nonlocaljmp_afterjmp(&context)==0) {
- printf("start regular code\n");
work();
} else {
// code executed if asynchronous jump instruction invoked */
work();
} else {
// code executed if asynchronous jump instruction invoked */
- printf("Aborted thread\n");
+ printf("Work was aborted\n");
}
//printf("after block %d\n",marte_nonlocaljmp_afterjmp(&context));
}
//printf("after block %d\n",marte_nonlocaljmp_afterjmp(&context));
- printf("after block\n");
+ printf("Work block was finished\n");
fosa_clock_get_time(FOSA_CLOCK_REALTIME, &after_activation_time);
fosa_clock_get_time(FOSA_CLOCK_REALTIME, &after_activation_time);
- elapsed_time = fosa_abs_time_extract_interval(activation_time, after_activation_time);
- printf("End thread %ld msec\n", fosa_abs_time_to_msec(after_activation_time) );
+ elapsed_time = fosa_abs_time_extract_interval
+ (activation_time, after_activation_time);
+ printf("End thread. Elapsed: %ld msec\n",
+ fosa_rel_time_to_msec(elapsed_time) );
// sleep for a while
activation_time = fosa_abs_time_incr(activation_time, period);
// sleep for a while
activation_time = fosa_abs_time_incr(activation_time, period);
pthread_exit ( (void*)&error_status);
}
// Restore periodic thread's context
pthread_exit ( (void*)&error_status);
}
// Restore periodic thread's context
- printf("About to restore\n");
+ printf("About to restore context\n");
info=((budget_timer_info_t*) (siginfo.sival_ptr));
marte_nonlocaljmp_restorecontext(info->tid,info->context_ptr);
printf("Restored thread %d\n",info->dummy);
info=((budget_timer_info_t*) (siginfo.sival_ptr));
marte_nonlocaljmp_restorecontext(info->tid,info->context_ptr);
printf("Restored thread %d\n",info->dummy);