source:
rtems/c/src/tests/tmtests/tm21/task1.c
@
95a81ab
Last change on this file since 95a81ab was 95a81ab, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:53:55 | |
---|---|
|
|
File size: 5.3 KB |
Line | |
---|---|
1 | /* |
2 | * |
3 | * COPYRIGHT (c) 1989-1999. |
4 | * On-Line Applications Research Corporation (OAR). |
5 | * |
6 | * The license and distribution terms for this file may be |
7 | * found in the file LICENSE in this distribution or at |
8 | * http://www.rtems.com/license/LICENSE. |
9 | * |
10 | * $Id$ |
11 | */ |
12 | |
13 | #define TEST_INIT |
14 | #include "system.h" |
15 | |
16 | rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; |
17 | rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT; |
18 | |
19 | rtems_task Task_1( |
20 | rtems_task_argument argument |
21 | ); |
22 | |
23 | rtems_task Init( |
24 | rtems_task_argument argument |
25 | ) |
26 | { |
27 | rtems_id id; |
28 | rtems_status_code status; |
29 | |
30 | Print_Warning(); |
31 | |
32 | puts( "\n\n*** TIME TEST 21 ***" ); |
33 | |
34 | status = rtems_task_create( |
35 | rtems_build_name( 'T', 'I', 'M', 'E' ), |
36 | 250, |
37 | RTEMS_MINIMUM_STACK_SIZE, |
38 | RTEMS_DEFAULT_MODES, |
39 | RTEMS_DEFAULT_ATTRIBUTES, |
40 | &id |
41 | ); |
42 | directive_failed( status, "rtems_task_create of TASK1" ); |
43 | |
44 | status = rtems_task_start( id, Task_1, 0 ); |
45 | directive_failed( status, "rtems_task_start of TASK1" ); |
46 | |
47 | status = rtems_task_delete( RTEMS_SELF ); |
48 | directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
49 | } |
50 | |
51 | #define MESSAGE_SIZE (sizeof(long) * 4) |
52 | |
53 | rtems_task Task_1( |
54 | rtems_task_argument argument |
55 | ) |
56 | { |
57 | rtems_unsigned32 index; |
58 | rtems_id id; |
59 | rtems_status_code status; |
60 | |
61 | for( index = 1 ; index <= OPERATION_COUNT ; index++ ) { |
62 | status = rtems_task_create ( |
63 | index, |
64 | 254, |
65 | RTEMS_MINIMUM_STACK_SIZE, |
66 | RTEMS_DEFAULT_MODES, |
67 | RTEMS_DEFAULT_ATTRIBUTES, |
68 | &id |
69 | ); |
70 | directive_failed( status, "rtems_task_create" ); |
71 | |
72 | status = rtems_message_queue_create( |
73 | index, |
74 | 1, /* only going to ident this queue */ |
75 | MESSAGE_SIZE, |
76 | RTEMS_DEFAULT_ATTRIBUTES, |
77 | &id |
78 | ); |
79 | directive_failed( status, "rtems_message_queue_create" ); |
80 | |
81 | status = rtems_semaphore_create( |
82 | index, |
83 | OPERATION_COUNT, |
84 | RTEMS_DEFAULT_ATTRIBUTES, |
85 | RTEMS_NO_PRIORITY, |
86 | &id |
87 | ); |
88 | directive_failed( status, "rtems_semaphore_create" ); |
89 | |
90 | status = rtems_region_create( |
91 | index, |
92 | Region_area, |
93 | 2048, |
94 | 16, |
95 | RTEMS_DEFAULT_ATTRIBUTES, |
96 | &id |
97 | ); |
98 | directive_failed( status, "rtems_region_create" ); |
99 | |
100 | status = rtems_partition_create( |
101 | index, |
102 | Partition_area, |
103 | 2048, |
104 | 128, |
105 | RTEMS_DEFAULT_ATTRIBUTES, |
106 | &id |
107 | ); |
108 | directive_failed( status, "rtems_partition_create" ); |
109 | |
110 | status = rtems_port_create( |
111 | index, |
112 | Partition_area, |
113 | Region_area, |
114 | 0xff, |
115 | &id |
116 | ); |
117 | directive_failed( status, "rtems_port_create" ); |
118 | |
119 | status = rtems_timer_create( index, &id ); |
120 | directive_failed( status, "rtems_timer_create" ); |
121 | |
122 | status = rtems_rate_monotonic_create( index, &id ); |
123 | directive_failed( status, "rtems_rate_monotonic_create" ); |
124 | } |
125 | |
126 | Timer_initialize(); |
127 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
128 | (void) Empty_function(); |
129 | overhead = Read_timer(); |
130 | |
131 | Timer_initialize(); |
132 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
133 | (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id ); |
134 | end_time = Read_timer(); |
135 | |
136 | put_time( |
137 | "rtems_task_ident", |
138 | end_time, |
139 | OPERATION_COUNT, |
140 | overhead, |
141 | CALLING_OVERHEAD_TASK_IDENT |
142 | ); |
143 | |
144 | Timer_initialize(); |
145 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
146 | (void) rtems_message_queue_ident( index, RTEMS_SEARCH_ALL_NODES, &id ); |
147 | end_time = Read_timer(); |
148 | |
149 | put_time( |
150 | "rtems_message_queue_ident", |
151 | end_time, |
152 | OPERATION_COUNT, |
153 | overhead, |
154 | CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT |
155 | ); |
156 | |
157 | Timer_initialize(); |
158 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
159 | (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id ); |
160 | end_time = Read_timer(); |
161 | |
162 | put_time( |
163 | "rtems_semaphore_ident", |
164 | end_time, |
165 | OPERATION_COUNT, |
166 | overhead, |
167 | CALLING_OVERHEAD_SEMAPHORE_IDENT |
168 | ); |
169 | |
170 | Timer_initialize(); |
171 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
172 | (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id ); |
173 | end_time = Read_timer(); |
174 | |
175 | put_time( |
176 | "rtems_partition_ident", |
177 | end_time, |
178 | OPERATION_COUNT, |
179 | overhead, |
180 | CALLING_OVERHEAD_PARTITION_IDENT |
181 | ); |
182 | |
183 | Timer_initialize(); |
184 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
185 | (void) rtems_region_ident( index, &id ); |
186 | end_time = Read_timer(); |
187 | |
188 | put_time( |
189 | "rtems_region_ident", |
190 | end_time, |
191 | OPERATION_COUNT, |
192 | overhead, |
193 | CALLING_OVERHEAD_REGION_IDENT |
194 | ); |
195 | |
196 | Timer_initialize(); |
197 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
198 | (void) rtems_port_ident( index, &id ); |
199 | end_time = Read_timer(); |
200 | |
201 | put_time( |
202 | "rtems_port_ident", |
203 | end_time, |
204 | OPERATION_COUNT, |
205 | overhead, |
206 | CALLING_OVERHEAD_PORT_IDENT |
207 | ); |
208 | |
209 | Timer_initialize(); |
210 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
211 | (void) rtems_timer_ident( index, &id ); |
212 | end_time = Read_timer(); |
213 | |
214 | put_time( |
215 | "rtems_timer_ident", |
216 | end_time, |
217 | OPERATION_COUNT, |
218 | overhead, |
219 | CALLING_OVERHEAD_TIMER_IDENT |
220 | ); |
221 | |
222 | Timer_initialize(); |
223 | for ( index=1 ; index <= OPERATION_COUNT ; index++ ) |
224 | (void) rtems_rate_monotonic_ident( index, &id ); |
225 | end_time = Read_timer(); |
226 | |
227 | put_time( |
228 | "rtems_rate_monotonic_ident", |
229 | end_time, |
230 | OPERATION_COUNT, |
231 | overhead, |
232 | CALLING_OVERHEAD_RATE_MONOTONIC_IDENT |
233 | ); |
234 | |
235 | puts( "*** END OF TEST 21 ***" ); |
236 | rtems_test_exit( 0 ); |
237 | } |
Note: See TracBrowser
for help on using the repository browser.