]> rtime.felk.cvut.cz Git - rtems-pluggable-edf.git/commitdiff
Test_edf: test edited in order to see the quality of EDF, running well!
authorPetr Benes <benesp16@fel.cvut.cz>
Sun, 17 Apr 2011 13:22:19 +0000 (15:22 +0200)
committerPetr Benes <benesp16@fel.cvut.cz>
Sun, 17 Apr 2011 13:22:19 +0000 (15:22 +0200)
The pure hybrid EDF works now, but requires a bit refactor.

src/test_edf/task.c

index 27a10ebcfc416d6e6112c809f388452032df2229..96b988153a9b5aedf37f882041fe1664eb488ba6 100644 (file)
@@ -8,14 +8,20 @@
 #include <rtems/mw_uid.h>
 #include <errno.h>
 #include <stdint.h>
+#include <rtems/score/wkspace.h>
+
 
 
 #define TEST_DURATION 130
 
-#define T1_DUR 400000000
-#define T2_DUR 600000000
+//utilization setup: T1 3/7, T2 5/10
+
+#define T1_DUR 300
+#define T2_DUR 500
 #define T1_PER 7
 #define T2_PER 10
+#define T1_SERVER 0
+#define T2_SERVER 0
 
 rtems_task Task_1(
   rtems_task_argument argument
@@ -28,6 +34,7 @@ rtems_task Task_1(
   char output2[50];
   unsigned int start, stop, period_length, max_i, max_j;
   unsigned int i,j,k;
+  void *mem;
   
   name = rtems_build_name( 'P', 'E', 'R', 'A' );
   status = rtems_rate_monotonic_create( name, &period );
@@ -38,14 +45,15 @@ rtems_task Task_1(
   }
   
   period_length = T1_PER; // duration 3 ticks
-  max_i = 10000; max_j = T1_DUR;
-  edf_deadline_init(period_length);
+  max_i = 1000; max_j = T1_DUR;
+  edf_deadline_init(period_length, T1_SERVER, NULL);
   while ( 1 ) {
+         edf_next_period();
          if (rtems_rate_monotonic_period(period,period_length)==RTEMS_TIMEOUT)
                     puts("P1 - Deadline miss");
-         edf_next_period();
+         
          rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
-         sprintf(output1,"P1-S  ticks:%u",start);
+         sprintf(output1,"P1-S  ticks:%u  prio:%u",start, (unsigned int) _Per_CPU_Information.executing->current_priority);
          puts(output1);
          
          if ( start >= TEST_DURATION ) break;
@@ -58,6 +66,8 @@ rtems_task Task_1(
                  {
                          k = j/ 3; 
                          k++;                    
+                         mem = _Workspace_Allocate (4);
+                         _Workspace_Free(mem);
                 }
          }
         
@@ -92,6 +102,7 @@ rtems_task Task_2(
   char output2[50];
   unsigned int start, stop, period_length, max_i, max_j;
   unsigned int i,j,k;
+  void *mem;
          
   name = rtems_build_name( 'P', 'E', 'R', 'B' );
   status = rtems_rate_monotonic_create( name, &period );
@@ -101,14 +112,15 @@ rtems_task Task_2(
   }
   
   period_length = T2_PER; // duration 5 ticks
-  max_i = 10000; max_j = T2_DUR;
-  edf_deadline_init(period_length);
+  max_i = 1000; max_j = T2_DUR;
+  edf_deadline_init(period_length, T2_SERVER, NULL);
   while ( 1 ) {
+         edf_next_period();
          if (rtems_rate_monotonic_period(period,period_length)==RTEMS_TIMEOUT)
                  puts("P2 - Deadline miss");
-         edf_next_period();
+
          rtems_clock_get(RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start);
-         sprintf(output1,"P2-S  ticks:%u",start);
+         sprintf(output1,"P2-S  ticks:%u  prio:%u",start, (unsigned int)_Per_CPU_Information.executing->current_priority);
          puts(output1);
          
          if ( _Watchdog_Ticks_since_boot >= TEST_DURATION ) {
@@ -123,7 +135,9 @@ rtems_task Task_2(
                  for ( j = 1; j < max_j; j++) 
                  {
                          k = j/ 3; 
-                         k++;                    
+                         k++;                  
+                         mem = _Workspace_Allocate (4);
+                         _Workspace_Free(mem);
                 }
          }