source: rtems/testsuites/tmtests/tm21/task1.c @ 1055ce20

4.104.115
Last change on this file since 1055ce20 was 1055ce20, checked in by Joel Sherrill <joel.sherrill@…>, on 05/09/09 at 21:24:06

Fix most warnings.

  • Property mode set to 100644
File size: 5.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#define CONFIGURE_INIT
13#include "system.h"
14
15uint8_t   Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
16uint8_t   Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
17
18rtems_task Task_1(
19  rtems_task_argument argument
20);
21
22rtems_task Init(
23  rtems_task_argument argument
24)
25{
26  rtems_id          id;
27  rtems_status_code status;
28
29  Print_Warning();
30
31  puts( "\n\n*** TIME TEST 21 ***" );
32
33  status = rtems_task_create(
34    rtems_build_name( 'T', 'I', 'M', 'E' ),
35    RTEMS_MAXIMUM_PRIORITY - 5u,
36    RTEMS_MINIMUM_STACK_SIZE,
37    RTEMS_DEFAULT_MODES,
38    RTEMS_DEFAULT_ATTRIBUTES,
39    &id
40  );
41  directive_failed( status, "rtems_task_create of TASK1" );
42
43  status = rtems_task_start( id, Task_1, 0 );
44  directive_failed( status, "rtems_task_start of TASK1" );
45
46  status = rtems_task_delete( RTEMS_SELF );
47  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
48}
49
50#define MESSAGE_SIZE (sizeof(long) * 4)
51
52rtems_task Task_1(
53  rtems_task_argument argument
54)
55{
56  uint32_t    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      RTEMS_MAXIMUM_PRIORITY - 1u,
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      MESSAGE_SIZE,
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  benchmark_timer_initialize();
126    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
127      (void) benchmark_timer_empty_function();
128  overhead = benchmark_timer_read();
129
130  benchmark_timer_initialize();
131    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
132      (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
133  end_time = benchmark_timer_read();
134
135  put_time(
136    "rtems_task_ident",
137    end_time,
138    OPERATION_COUNT,
139    overhead,
140    CALLING_OVERHEAD_TASK_IDENT
141  );
142
143  benchmark_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 = benchmark_timer_read();
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  benchmark_timer_initialize();
157    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
158      (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
159  end_time = benchmark_timer_read();
160
161  put_time(
162    "rtems_semaphore_ident",
163    end_time,
164    OPERATION_COUNT,
165    overhead,
166    CALLING_OVERHEAD_SEMAPHORE_IDENT
167  );
168
169  benchmark_timer_initialize();
170    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
171      (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
172  end_time = benchmark_timer_read();
173
174  put_time(
175    "rtems_partition_ident",
176    end_time,
177    OPERATION_COUNT,
178    overhead,
179    CALLING_OVERHEAD_PARTITION_IDENT
180  );
181
182  benchmark_timer_initialize();
183    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
184      (void) rtems_region_ident( index, &id );
185  end_time = benchmark_timer_read();
186
187  put_time(
188    "rtems_region_ident",
189    end_time,
190    OPERATION_COUNT,
191    overhead,
192    CALLING_OVERHEAD_REGION_IDENT
193  );
194
195  benchmark_timer_initialize();
196    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
197      (void) rtems_port_ident( index, &id );
198  end_time = benchmark_timer_read();
199
200  put_time(
201    "rtems_port_ident",
202    end_time,
203    OPERATION_COUNT,
204    overhead,
205    CALLING_OVERHEAD_PORT_IDENT
206  );
207
208  benchmark_timer_initialize();
209    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
210      (void) rtems_timer_ident( index, &id );
211  end_time = benchmark_timer_read();
212
213  put_time(
214    "rtems_timer_ident",
215    end_time,
216    OPERATION_COUNT,
217    overhead,
218    CALLING_OVERHEAD_TIMER_IDENT
219  );
220
221  benchmark_timer_initialize();
222    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
223      (void) rtems_rate_monotonic_ident( index, &id );
224  end_time = benchmark_timer_read();
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  rtems_test_exit( 0 );
236}
Note: See TracBrowser for help on using the repository browser.