[ac7d5ef0] | 1 | /* |
---|
| 2 | * |
---|
| 3 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
| 4 | * On-Line Applications Research Corporation (OAR). |
---|
| 5 | * All rights assigned to U.S. Government, 1994. |
---|
| 6 | * |
---|
| 7 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
| 8 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
| 9 | * notice must appear in all copies of this file and its derivatives. |
---|
| 10 | * |
---|
| 11 | * $Id$ |
---|
| 12 | */ |
---|
| 13 | |
---|
[3a4ae6c] | 14 | #define TEST_INIT |
---|
[ac7d5ef0] | 15 | #include "system.h" |
---|
| 16 | |
---|
| 17 | rtems_name Period_name; |
---|
| 18 | |
---|
| 19 | rtems_task Tasks( |
---|
| 20 | rtems_task_argument argument |
---|
| 21 | ); |
---|
| 22 | |
---|
| 23 | rtems_task Low_task( |
---|
| 24 | rtems_task_argument argument |
---|
| 25 | ); |
---|
| 26 | |
---|
| 27 | rtems_unsigned32 Task_count; |
---|
| 28 | |
---|
| 29 | rtems_task Init( |
---|
| 30 | rtems_task_argument argument |
---|
| 31 | ) |
---|
| 32 | { |
---|
| 33 | rtems_id id; |
---|
| 34 | rtems_unsigned32 index; |
---|
| 35 | rtems_status_code status; |
---|
| 36 | |
---|
[3a4ae6c] | 37 | Print_Warning(); |
---|
| 38 | |
---|
[ac7d5ef0] | 39 | puts( "\n\n*** TIME TEST 29 ***" ); |
---|
| 40 | |
---|
| 41 | Period_name = rtems_build_name( 'P', 'R', 'D', ' ' ); |
---|
| 42 | |
---|
| 43 | Timer_initialize(); |
---|
| 44 | (void) rtems_rate_monotonic_create( Period_name, &id ); |
---|
| 45 | end_time = Read_timer(); |
---|
| 46 | |
---|
| 47 | put_time( |
---|
| 48 | "rtems_rate_monotonic_create", |
---|
| 49 | end_time, |
---|
| 50 | 1, |
---|
| 51 | 0, |
---|
| 52 | CALLING_OVERHEAD_RATE_MONOTONIC_CREATE |
---|
| 53 | ); |
---|
| 54 | |
---|
| 55 | Timer_initialize(); |
---|
| 56 | (void) rtems_rate_monotonic_period( id, 10 ); |
---|
| 57 | end_time = Read_timer(); |
---|
| 58 | |
---|
| 59 | put_time( |
---|
[5c491aef] | 60 | "rtems_rate_monotonic_period: initiate period -- returns to caller", |
---|
[ac7d5ef0] | 61 | end_time, |
---|
| 62 | 1, |
---|
| 63 | 0, |
---|
| 64 | CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD |
---|
| 65 | ); |
---|
| 66 | |
---|
| 67 | Timer_initialize(); |
---|
| 68 | (void) rtems_rate_monotonic_period( id, RTEMS_PERIOD_STATUS ); |
---|
| 69 | end_time = Read_timer(); |
---|
| 70 | |
---|
| 71 | put_time( |
---|
[5c491aef] | 72 | "rtems_rate_monotonic_period: obtain status", |
---|
[ac7d5ef0] | 73 | end_time, |
---|
| 74 | 1, |
---|
| 75 | 0, |
---|
| 76 | CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD |
---|
| 77 | ); |
---|
| 78 | |
---|
| 79 | Timer_initialize(); |
---|
| 80 | (void) rtems_rate_monotonic_cancel( id ); |
---|
| 81 | end_time = Read_timer(); |
---|
| 82 | |
---|
| 83 | put_time( |
---|
| 84 | "rtems_rate_monotonic_cancel", |
---|
| 85 | end_time, |
---|
| 86 | 1, |
---|
| 87 | 0, |
---|
| 88 | CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL |
---|
| 89 | ); |
---|
| 90 | |
---|
| 91 | Timer_initialize(); |
---|
| 92 | (void) rtems_rate_monotonic_delete( id ); |
---|
| 93 | end_time = Read_timer(); |
---|
| 94 | |
---|
| 95 | put_time( |
---|
[5c491aef] | 96 | "rtems_rate_monotonic_delete: inactive", |
---|
[ac7d5ef0] | 97 | end_time, |
---|
| 98 | 1, |
---|
| 99 | 0, |
---|
| 100 | CALLING_OVERHEAD_RATE_MONOTONIC_DELETE |
---|
| 101 | ); |
---|
| 102 | |
---|
| 103 | status = rtems_rate_monotonic_create( Period_name, &id ); |
---|
| 104 | directive_failed( status, "rtems_rate_monotonic_create" ); |
---|
| 105 | |
---|
| 106 | status = rtems_rate_monotonic_period( id, 10 ); |
---|
| 107 | directive_failed( status, "rtems_rate_monotonic_period" ); |
---|
| 108 | |
---|
| 109 | Timer_initialize(); |
---|
| 110 | rtems_rate_monotonic_delete( id ); |
---|
| 111 | end_time = Read_timer(); |
---|
| 112 | |
---|
| 113 | put_time( |
---|
[5c491aef] | 114 | "rtems_rate_monotonic_delete: active", |
---|
[ac7d5ef0] | 115 | end_time, |
---|
| 116 | 1, |
---|
| 117 | 0, |
---|
| 118 | CALLING_OVERHEAD_RATE_MONOTONIC_DELETE |
---|
| 119 | ); |
---|
| 120 | |
---|
| 121 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { |
---|
| 122 | status = rtems_task_create( |
---|
| 123 | rtems_build_name( 'T', 'E', 'S', 'T' ), |
---|
| 124 | 128, |
---|
[3652ad35] | 125 | RTEMS_MINIMUM_STACK_SIZE, |
---|
[ac7d5ef0] | 126 | RTEMS_DEFAULT_MODES, |
---|
| 127 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 128 | &id |
---|
| 129 | ); |
---|
| 130 | directive_failed( status, "rtems_task_create LOOP" ); |
---|
| 131 | |
---|
| 132 | status = rtems_task_start( id, Tasks, 0 ); |
---|
| 133 | directive_failed( status, "rtems_task_start LOOP" ); |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | status = rtems_task_create( |
---|
| 137 | rtems_build_name( 'L', 'O', 'W', ' ' ), |
---|
| 138 | 200, |
---|
[3652ad35] | 139 | RTEMS_MINIMUM_STACK_SIZE, |
---|
[ac7d5ef0] | 140 | RTEMS_DEFAULT_MODES, |
---|
| 141 | RTEMS_DEFAULT_ATTRIBUTES, |
---|
| 142 | &id |
---|
| 143 | ); |
---|
| 144 | directive_failed( status, "rtems_task_create LOW" ); |
---|
| 145 | |
---|
| 146 | status = rtems_task_start( id, Low_task, 0 ); |
---|
| 147 | directive_failed( status, "rtems_task_start LOW" ); |
---|
| 148 | |
---|
| 149 | Task_count = 0; |
---|
| 150 | |
---|
| 151 | status = rtems_task_delete( RTEMS_SELF ); |
---|
| 152 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | rtems_task Tasks( |
---|
| 156 | rtems_task_argument argument |
---|
| 157 | ) |
---|
| 158 | { |
---|
| 159 | rtems_id id; |
---|
| 160 | rtems_status_code status; |
---|
| 161 | |
---|
| 162 | status = rtems_rate_monotonic_create( 1, &id ); |
---|
| 163 | directive_failed( status, "rtems_rate_monotonic_create" ); |
---|
| 164 | |
---|
| 165 | status = rtems_rate_monotonic_period( id, 100 ); |
---|
| 166 | directive_failed( status, "rtems_rate_monotonic_period" ); |
---|
| 167 | |
---|
| 168 | /* |
---|
| 169 | * Give up the processor to allow all tasks to actually |
---|
| 170 | * create and start their period timer before the benchmark |
---|
| 171 | * timer is initialized. |
---|
| 172 | */ |
---|
| 173 | |
---|
| 174 | (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); |
---|
| 175 | |
---|
| 176 | Task_count++; |
---|
| 177 | |
---|
| 178 | if ( Task_count == 1 ) |
---|
| 179 | Timer_initialize(); |
---|
| 180 | |
---|
| 181 | (void) rtems_rate_monotonic_period( id, 100 ); |
---|
| 182 | } |
---|
| 183 | |
---|
| 184 | rtems_task Low_task( |
---|
| 185 | rtems_task_argument argument |
---|
| 186 | ) |
---|
| 187 | { |
---|
| 188 | rtems_unsigned32 index; |
---|
| 189 | |
---|
| 190 | end_time = Read_timer(); |
---|
| 191 | |
---|
| 192 | Timer_initialize(); |
---|
| 193 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
---|
| 194 | (void) Empty_function(); |
---|
| 195 | overhead = Read_timer(); |
---|
| 196 | |
---|
| 197 | put_time( |
---|
[5c491aef] | 198 | "rtems_rate_monotonic_period: conclude periods -- caller blocks", |
---|
[ac7d5ef0] | 199 | end_time, |
---|
| 200 | OPERATION_COUNT, |
---|
| 201 | overhead, |
---|
| 202 | CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD |
---|
| 203 | ); |
---|
| 204 | |
---|
[3a4ae6c] | 205 | puts( "*** END OF TEST 29 ***" ); |
---|
[ac7d5ef0] | 206 | exit( 0 ); |
---|
| 207 | } |
---|