source: rtems/testsuites/tmtests/tm21/task1.c @ 51b3cbca

5
Last change on this file since 51b3cbca was 51b3cbca, checked in by Sebastian Huber <sebastian.huber@…>, on 10/04/18 at 13:23:25

tests: Use rtems_task_exit()

Update #3533.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2013.
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.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#define CONFIGURE_INIT
15#include "system.h"
16
17const char rtems_test_name[] = "TIME TEST 21";
18
19uint8_t   Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
20uint8_t   Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
21
22rtems_task Task_1(
23  rtems_task_argument argument
24);
25
26rtems_task Init(
27  rtems_task_argument argument
28)
29{
30  rtems_id          id;
31  rtems_status_code status;
32
33  Print_Warning();
34
35  TEST_BEGIN();
36
37  status = rtems_task_create(
38    rtems_build_name( 'T', 'I', 'M', 'E' ),
39    RTEMS_MAXIMUM_PRIORITY - 5u,
40    RTEMS_MINIMUM_STACK_SIZE,
41    RTEMS_DEFAULT_MODES,
42    RTEMS_DEFAULT_ATTRIBUTES,
43    &id
44  );
45  directive_failed( status, "rtems_task_create of TASK1" );
46
47  status = rtems_task_start( id, Task_1, 0 );
48  directive_failed( status, "rtems_task_start of TASK1" );
49
50  rtems_task_exit();
51}
52
53rtems_task Task_1(
54  rtems_task_argument argument
55)
56{
57  uint32_t    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      RTEMS_MAXIMUM_PRIORITY - 1u,
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  benchmark_timer_initialize();
127    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
128      (void) benchmark_timer_empty_function();
129  overhead = benchmark_timer_read();
130
131  benchmark_timer_initialize();
132    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
133      (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
134  end_time = benchmark_timer_read();
135
136  put_time(
137    "rtems_task_ident: only case",
138    end_time,
139    OPERATION_COUNT,
140    overhead,
141    0
142  );
143
144  benchmark_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 = benchmark_timer_read();
148
149  put_time(
150    "rtems_message_queue_ident: only case",
151    end_time,
152    OPERATION_COUNT,
153    overhead,
154    0
155  );
156
157  benchmark_timer_initialize();
158    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
159      (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
160  end_time = benchmark_timer_read();
161
162  put_time(
163    "rtems_semaphore_ident: only case",
164    end_time,
165    OPERATION_COUNT,
166    overhead,
167    0
168  );
169
170  benchmark_timer_initialize();
171    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
172      (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
173  end_time = benchmark_timer_read();
174
175  put_time(
176    "rtems_partition_ident: only case",
177    end_time,
178    OPERATION_COUNT,
179    overhead,
180    0
181  );
182
183  benchmark_timer_initialize();
184    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
185      (void) rtems_region_ident( index, &id );
186  end_time = benchmark_timer_read();
187
188  put_time(
189    "rtems_region_ident: only case",
190    end_time,
191    OPERATION_COUNT,
192    overhead,
193    0
194  );
195
196  benchmark_timer_initialize();
197    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
198      (void) rtems_port_ident( index, &id );
199  end_time = benchmark_timer_read();
200
201  put_time(
202    "rtems_port_ident: only case",
203    end_time,
204    OPERATION_COUNT,
205    overhead,
206    0
207  );
208
209  benchmark_timer_initialize();
210    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
211      (void) rtems_timer_ident( index, &id );
212  end_time = benchmark_timer_read();
213
214  put_time(
215    "rtems_timer_ident: only case",
216    end_time,
217    OPERATION_COUNT,
218    overhead,
219    0
220  );
221
222  benchmark_timer_initialize();
223    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
224      (void) rtems_rate_monotonic_ident( index, &id );
225  end_time = benchmark_timer_read();
226
227  put_time(
228    "rtems_rate_monotonic_ident: only case",
229    end_time,
230    OPERATION_COUNT,
231    overhead,
232    0
233  );
234
235  TEST_END();
236  rtems_test_exit( 0 );
237}
Note: See TracBrowser for help on using the repository browser.