source: rtems/testsuites/tmtests/tm21/task1.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on May 11, 1995 at 5:39:37 PM

Initial revision

  • Property mode set to 100644
File size: 5.2 KB
Line 
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
14#include "system.h"
15#undef EXTERN
16#define EXTERN
17#include "conftbl.h"
18#include "gvar.h"
19
20rtems_unsigned8 Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
21rtems_unsigned8 Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
22
23rtems_task Task_1(
24  rtems_task_argument argument
25);
26
27rtems_task Init(
28  rtems_task_argument argument
29)
30{
31  rtems_id          id;
32  rtems_status_code status;
33
34  puts( "\n\n*** TIME TEST 21 ***" );
35
36  status = rtems_task_create(
37    rtems_build_name( 'T', 'I', 'M', 'E' ),
38    250,
39    1024,
40    RTEMS_DEFAULT_MODES,
41    RTEMS_DEFAULT_ATTRIBUTES,
42    &id
43  );
44  directive_failed( status, "rtems_task_create of TASK1" );
45
46  status = rtems_task_start( id, Task_1, 0 );
47  directive_failed( status, "rtems_task_start of TASK1" );
48
49  status = rtems_task_delete( RTEMS_SELF );
50  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
51}
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      1024,
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      OPERATION_COUNT,
75      RTEMS_DEFAULT_ATTRIBUTES,
76      &id
77    );
78    directive_failed( status, "rtems_message_queue_create" );
79
80    status = rtems_semaphore_create(
81      index,
82      OPERATION_COUNT,
83      RTEMS_DEFAULT_ATTRIBUTES,
84      &id
85    );
86    directive_failed( status, "rtems_semaphore_create" );
87
88    status = rtems_region_create(
89      index,
90      Region_area,
91      2048,
92      16,
93      RTEMS_DEFAULT_ATTRIBUTES,
94      &id
95    );
96    directive_failed( status, "rtems_region_create" );
97
98    status = rtems_partition_create(
99      index,
100      Partition_area,
101      2048,
102      128,
103      RTEMS_DEFAULT_ATTRIBUTES,
104      &id
105    );
106    directive_failed( status, "rtems_partition_create" );
107
108    status = rtems_port_create(
109      index,
110      Partition_area,
111      Region_area,
112      0xff,
113      &id
114    );
115    directive_failed( status, "rtems_port_create" );
116
117    status = rtems_timer_create( index, &id );
118    directive_failed( status, "rtems_timer_create" );
119
120    status = rtems_rate_monotonic_create( index, &id );
121    directive_failed( status, "rtems_rate_monotonic_create" );
122  }
123
124  Timer_initialize();
125    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
126      (void) Empty_function();
127  overhead = Read_timer();
128
129  Timer_initialize();
130    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
131      (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
132  end_time = Read_timer();
133
134  put_time(
135    "rtems_task_ident",
136    end_time,
137    OPERATION_COUNT,
138    overhead,
139    CALLING_OVERHEAD_TASK_IDENT
140  );
141
142  Timer_initialize();
143    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
144      (void) rtems_message_queue_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
145  end_time = Read_timer();
146
147  put_time(
148    "rtems_message_queue_ident",
149    end_time,
150    OPERATION_COUNT,
151    overhead,
152    CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT
153  );
154
155  Timer_initialize();
156    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
157      (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
158  end_time = Read_timer();
159
160  put_time(
161    "rtems_semaphore_ident",
162    end_time,
163    OPERATION_COUNT,
164    overhead,
165    CALLING_OVERHEAD_SEMAPHORE_IDENT
166  );
167
168  Timer_initialize();
169    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
170      (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
171  end_time = Read_timer();
172
173  put_time(
174    "rtems_partition_ident",
175    end_time,
176    OPERATION_COUNT,
177    overhead,
178    CALLING_OVERHEAD_PARTITION_IDENT
179  );
180
181  Timer_initialize();
182    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
183      (void) rtems_region_ident( index, &id );
184  end_time = Read_timer();
185
186  put_time(
187    "rtems_region_ident",
188    end_time,
189    OPERATION_COUNT,
190    overhead,
191    CALLING_OVERHEAD_REGION_IDENT
192  );
193
194  Timer_initialize();
195    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
196      (void) rtems_port_ident( index, &id );
197  end_time = Read_timer();
198
199  put_time(
200    "rtems_port_ident",
201    end_time,
202    OPERATION_COUNT,
203    overhead,
204    CALLING_OVERHEAD_PORT_IDENT
205  );
206
207  Timer_initialize();
208    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
209      (void) rtems_timer_ident( index, &id );
210  end_time = Read_timer();
211
212  put_time(
213    "rtems_timer_ident",
214    end_time,
215    OPERATION_COUNT,
216    overhead,
217    CALLING_OVERHEAD_TIMER_IDENT
218  );
219
220  Timer_initialize();
221    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
222      (void) rtems_rate_monotonic_ident( index, &id );
223  end_time = Read_timer();
224
225  put_time(
226    "rtems_rate_monotonic_ident",
227    end_time,
228    OPERATION_COUNT,
229    overhead,
230    CALLING_OVERHEAD_RATE_MONOTONIC_IDENT
231  );
232
233  exit( 0 );
234}
Note: See TracBrowser for help on using the repository browser.