]> rtime.felk.cvut.cz Git - frescor/fosa.git/commitdiff
Modified simple_test_non_local_jump.c to improve displayed messages
authormgh <mgh@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Wed, 28 Jan 2009 10:25:05 +0000 (10:25 +0000)
committermgh <mgh@35b4ef3e-fd22-0410-ab77-dab3279adceb>
Wed, 28 Jan 2009 10:25:05 +0000 (10:25 +0000)
git-svn-id: http://www.frescor.org/private/svn/frescor/fosa/trunk@1500 35b4ef3e-fd22-0410-ab77-dab3279adceb

src_marte_os/tests/test_non_local_jump/simple_test_non_local_jump.c

index be2a59c7926a9e6f7587600e739e00e8d49d2f9b..d84b2b9681bc359990266bad3c5feb0e67f08d89 100644 (file)
@@ -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);