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

4.104.114.84.95
Last change on this file since 1543932 was d2d6467, checked in by Joel Sherrill <joel.sherrill@…>, on 04/22/96 at 23:58:40

Lowered number of messages created to reduce burden on workspace.

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