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

4.11
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on Mar 20, 2014 at 9:10:47 PM

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 5.6 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
17uint8_t   Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
18uint8_t   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    RTEMS_MAXIMUM_PRIORITY - 5u,
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
52#define MESSAGE_SIZE (sizeof(long) * 4)
53
54rtems_task Task_1(
55  rtems_task_argument argument
56)
57{
58  uint32_t    index;
59  rtems_id          id;
60  rtems_status_code status;
61
62  for( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
63    status = rtems_task_create (
64      index,
65      RTEMS_MAXIMUM_PRIORITY - 1u,
66      RTEMS_MINIMUM_STACK_SIZE,
67      RTEMS_DEFAULT_MODES,
68      RTEMS_DEFAULT_ATTRIBUTES,
69      &id
70    );
71    directive_failed( status, "rtems_task_create" );
72
73    status = rtems_message_queue_create(
74      index,
75      1,                       /* only going to ident this queue */
76      MESSAGE_SIZE,
77      RTEMS_DEFAULT_ATTRIBUTES,
78      &id
79    );
80    directive_failed( status, "rtems_message_queue_create" );
81
82    status = rtems_semaphore_create(
83      index,
84      OPERATION_COUNT,
85      RTEMS_DEFAULT_ATTRIBUTES,
86      RTEMS_NO_PRIORITY,
87      &id
88    );
89    directive_failed( status, "rtems_semaphore_create" );
90
91    status = rtems_region_create(
92      index,
93      Region_area,
94      2048,
95      16,
96      RTEMS_DEFAULT_ATTRIBUTES,
97      &id
98    );
99    directive_failed( status, "rtems_region_create" );
100
101    status = rtems_partition_create(
102      index,
103      Partition_area,
104      2048,
105      128,
106      RTEMS_DEFAULT_ATTRIBUTES,
107      &id
108    );
109    directive_failed( status, "rtems_partition_create" );
110
111    status = rtems_port_create(
112      index,
113      Partition_area,
114      Region_area,
115      0xff,
116      &id
117    );
118    directive_failed( status, "rtems_port_create" );
119
120    status = rtems_timer_create( index, &id );
121    directive_failed( status, "rtems_timer_create" );
122
123    status = rtems_rate_monotonic_create( index, &id );
124    directive_failed( status, "rtems_rate_monotonic_create" );
125  }
126
127  benchmark_timer_initialize();
128    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
129      (void) benchmark_timer_empty_function();
130  overhead = benchmark_timer_read();
131
132  benchmark_timer_initialize();
133    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
134      (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
135  end_time = benchmark_timer_read();
136
137  put_time(
138    "rtems_task_ident: only case",
139    end_time,
140    OPERATION_COUNT,
141    overhead,
142    CALLING_OVERHEAD_TASK_IDENT
143  );
144
145  benchmark_timer_initialize();
146    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
147      (void) rtems_message_queue_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
148  end_time = benchmark_timer_read();
149
150  put_time(
151    "rtems_message_queue_ident: only case",
152    end_time,
153    OPERATION_COUNT,
154    overhead,
155    CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT
156  );
157
158  benchmark_timer_initialize();
159    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
160      (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
161  end_time = benchmark_timer_read();
162
163  put_time(
164    "rtems_semaphore_ident: only case",
165    end_time,
166    OPERATION_COUNT,
167    overhead,
168    CALLING_OVERHEAD_SEMAPHORE_IDENT
169  );
170
171  benchmark_timer_initialize();
172    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
173      (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
174  end_time = benchmark_timer_read();
175
176  put_time(
177    "rtems_partition_ident: only case",
178    end_time,
179    OPERATION_COUNT,
180    overhead,
181    CALLING_OVERHEAD_PARTITION_IDENT
182  );
183
184  benchmark_timer_initialize();
185    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
186      (void) rtems_region_ident( index, &id );
187  end_time = benchmark_timer_read();
188
189  put_time(
190    "rtems_region_ident: only case",
191    end_time,
192    OPERATION_COUNT,
193    overhead,
194    CALLING_OVERHEAD_REGION_IDENT
195  );
196
197  benchmark_timer_initialize();
198    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
199      (void) rtems_port_ident( index, &id );
200  end_time = benchmark_timer_read();
201
202  put_time(
203    "rtems_port_ident: only case",
204    end_time,
205    OPERATION_COUNT,
206    overhead,
207    CALLING_OVERHEAD_PORT_IDENT
208  );
209
210  benchmark_timer_initialize();
211    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
212      (void) rtems_timer_ident( index, &id );
213  end_time = benchmark_timer_read();
214
215  put_time(
216    "rtems_timer_ident: only case",
217    end_time,
218    OPERATION_COUNT,
219    overhead,
220    CALLING_OVERHEAD_TIMER_IDENT
221  );
222
223  benchmark_timer_initialize();
224    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
225      (void) rtems_rate_monotonic_ident( index, &id );
226  end_time = benchmark_timer_read();
227
228  put_time(
229    "rtems_rate_monotonic_ident: only case",
230    end_time,
231    OPERATION_COUNT,
232    overhead,
233    CALLING_OVERHEAD_RATE_MONOTONIC_IDENT
234  );
235
236  puts( "*** END OF TEST 21 ***" );
237  rtems_test_exit( 0 );
238}
Note: See TracBrowser for help on using the repository browser.