source: rtems/c/src/tests/tmtests/tm21/task1.c @ 95a81ab

4.104.114.84.95
Last change on this file since 95a81ab was 95a81ab, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:53:55

2003-09-04 Joel Sherrill <joel@…>

  • include/timesys.h, tm01/system.h, tm01/task1.c, tm01/tm01.doc, tm02/system.h, tm02/task1.c, tm02/tm02.doc, tm03/system.h, tm03/task1.c, tm03/tm03.doc, tm04/system.h, tm04/task1.c, tm04/tm04.doc, tm05/system.h, tm05/task1.c, tm05/tm05.doc, tm06/system.h, tm06/task1.c, tm06/tm06.doc, tm07/system.h, tm07/task1.c, tm07/tm07.doc, tm08/system.h, tm08/task1.c, tm08/tm08.doc, tm09/system.h, tm09/task1.c, tm09/tm09.doc, tm10/system.h, tm10/task1.c, tm10/tm10.doc, tm11/system.h, tm11/task1.c, tm11/tm11.doc, tm12/system.h, tm12/task1.c, tm12/tm12.doc, tm13/system.h, tm13/task1.c, tm13/tm13.doc, tm14/system.h, tm14/task1.c, tm14/tm14.doc, tm15/system.h, tm15/task1.c, tm15/tm15.doc, tm16/system.h, tm16/task1.c, tm16/tm16.doc, tm17/system.h, tm17/task1.c, tm17/tm17.doc, tm18/system.h, tm18/task1.c, tm18/tm18.doc, tm19/system.h, tm19/task1.c, tm19/tm19.doc, tm20/system.h, tm20/task1.c, tm20/tm20.doc, tm21/system.h, tm21/task1.c, tm21/tm21.doc, tm22/system.h, tm22/task1.c, tm22/tm22.doc, tm23/system.h, tm23/task1.c, tm23/tm23.doc, tm24/system.h, tm24/task1.c, tm24/tm24.doc, tm25/system.h, tm25/task1.c, tm25/tm25.doc, tm26/fptest.h, tm26/system.h, tm26/task1.c, tm26/tm26.doc, tm27/system.h, tm27/task1.c, tm27/tm27.doc, tm28/system.h, tm28/task1.c, tm28/tm28.doc, tm29/system.h, tm29/task1.c, tm29/tm29.doc, tmck/system.h, tmck/task1.c, tmck/tmck.doc, tmoverhd/dumrtems.h, tmoverhd/empty.c, tmoverhd/system.h, tmoverhd/testtask.c, tmoverhd/tmoverhd.doc: URL for license changed.
  • Property mode set to 100644
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
16rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
17rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
18
19rtems_task Task_1(
20  rtems_task_argument argument
21);
22
23rtems_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
53rtems_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.