From 313a3245e374b208b363f04a87d83be801435904 Mon Sep 17 00:00:00 2001 From: mgh Date: Wed, 28 Jan 2009 10:25:05 +0000 Subject: [PATCH] Modified simple_test_non_local_jump.c to improve displayed messages git-svn-id: http://www.frescor.org/private/svn/frescor/fosa/trunk@1500 35b4ef3e-fd22-0410-ab77-dab3279adceb --- .../simple_test_non_local_jump.c | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src_marte_os/tests/test_non_local_jump/simple_test_non_local_jump.c b/src_marte_os/tests/test_non_local_jump/simple_test_non_local_jump.c index be2a59c..d84b2b9 100644 --- a/src_marte_os/tests/test_non_local_jump/simple_test_non_local_jump.c +++ b/src_marte_os/tests/test_non_local_jump/simple_test_non_local_jump.c @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// Copyright (C) 2006 - 2008 FRESCOR consortium partners: +// Copyright (C) 2006 - 2009 FRESCOR consortium partners: // // Universidad de Cantabria, SPAIN // University of York, UK @@ -137,7 +137,7 @@ int main() /* 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"); exit(1); } @@ -150,7 +150,7 @@ int main() /* 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"); exit(1); } @@ -166,16 +166,16 @@ void work() { 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) { - printf("aqui\n"); + printf("start eating 1s more\n"); fosa_eat(&exec_time); - printf("aqui tambien\n"); } + printf("finish work\n"); } @@ -216,7 +216,7 @@ static void * thread_body(void *thread_arg) pthread_exit ( (void*)&error_status); } - printf("Start periodic thread body\n"); + printf("Start periodic thread body with 1400ms budget\n"); // main loop while(1) { @@ -227,28 +227,30 @@ static void * thread_body(void *thread_arg) 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); - printf ("salvado\n"); + printf ("context saved\n"); if (marte_nonlocaljmp_afterjmp(&context)==0) { - printf("start regular code\n"); 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\n"); + printf("Work block was finished\n"); 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); @@ -282,7 +284,7 @@ void * signal_handler_thread (void * arg) { 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); -- 2.39.2