X-Git-Url: http://rtime.felk.cvut.cz/gitweb/rtems-pluggable-edf.git/blobdiff_plain/e6498659f32a8f17cb66d2aa3cb068d790c6adbc..45c70eeb959ed8bf363eb41b554a7cc9b5824e0d:/src/test_edf/task.c diff --git a/src/test_edf/task.c b/src/test_edf/task.c index 27a10eb..96b9881 100644 --- a/src/test_edf/task.c +++ b/src/test_edf/task.c @@ -8,14 +8,20 @@ #include #include #include +#include + #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); } }