source: rtems/testsuites/tmtests/tm21/task1.c @ 96e4b22

5
Last change on this file since 96e4b22 was 96e4b22, checked in by Chris Johns <chrisj@…>, on 03/06/19 at 09:39:29

testsuite: Make the OPERATION_COUNT a test configuration parameter.

  • Add a small memory test config file.
  • Update the small memory PowerPC BSPs to use the new test config.
  • 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#if !defined(OPERATION_COUNT)
11#define OPERATION_COUNT 100
12#endif
13
14#ifdef HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#define CONFIGURE_INIT
19#include "system.h"
20
21const char rtems_test_name[] = "TIME TEST 21";
22
23uint8_t   Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
24uint8_t   Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
25
26rtems_task Task_1(
27  rtems_task_argument argument
28);
29
30rtems_task Init(
31  rtems_task_argument argument
32)
33{
34  rtems_id          id;
35  rtems_status_code status;
36
37  Print_Warning();
38
39  TEST_BEGIN();
40
41  status = rtems_task_create(
42    rtems_build_name( 'T', 'I', 'M', 'E' ),
43    RTEMS_MAXIMUM_PRIORITY - 5u,
44    RTEMS_MINIMUM_STACK_SIZE,
45    RTEMS_DEFAULT_MODES,
46    RTEMS_DEFAULT_ATTRIBUTES,
47    &id
48  );
49  directive_failed( status, "rtems_task_create of TASK1" );
50
51  status = rtems_task_start( id, Task_1, 0 );
52  directive_failed( status, "rtems_task_start of TASK1" );
53
54  rtems_task_exit();
55}
56
57rtems_task Task_1(
58  rtems_task_argument argument
59)
60{
61  uint32_t    index;
62  rtems_id          id;
63  rtems_status_code status;
64
65  for( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
66    status = rtems_task_create (
67      index,
68      RTEMS_MAXIMUM_PRIORITY - 1u,
69      RTEMS_MINIMUM_STACK_SIZE,
70      RTEMS_DEFAULT_MODES,
71      RTEMS_DEFAULT_ATTRIBUTES,
72      &id
73    );
74    directive_failed( status, "rtems_task_create" );
75
76    status = rtems_message_queue_create(
77      index,
78      1,                       /* only going to ident this queue */
79      MESSAGE_SIZE,
80      RTEMS_DEFAULT_ATTRIBUTES,
81      &id
82    );
83    directive_failed( status, "rtems_message_queue_create" );
84
85    status = rtems_semaphore_create(
86      index,
87      OPERATION_COUNT,
88      RTEMS_DEFAULT_ATTRIBUTES,
89      RTEMS_NO_PRIORITY,
90      &id
91    );
92    directive_failed( status, "rtems_semaphore_create" );
93
94    status = rtems_region_create(
95      index,
96      Region_area,
97      2048,
98      16,
99      RTEMS_DEFAULT_ATTRIBUTES,
100      &id
101    );
102    directive_failed( status, "rtems_region_create" );
103
104    status = rtems_partition_create(
105      index,
106      Partition_area,
107      2048,
108      128,
109      RTEMS_DEFAULT_ATTRIBUTES,
110      &id
111    );
112    directive_failed( status, "rtems_partition_create" );
113
114    status = rtems_port_create(
115      index,
116      Partition_area,
117      Region_area,
118      0xff,
119      &id
120    );
121    directive_failed( status, "rtems_port_create" );
122
123    status = rtems_timer_create( index, &id );
124    directive_failed( status, "rtems_timer_create" );
125
126    status = rtems_rate_monotonic_create( index, &id );
127    directive_failed( status, "rtems_rate_monotonic_create" );
128  }
129
130  benchmark_timer_initialize();
131    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
132      (void) benchmark_timer_empty_function();
133  overhead = benchmark_timer_read();
134
135  benchmark_timer_initialize();
136    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
137      (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
138  end_time = benchmark_timer_read();
139
140  put_time(
141    "rtems_task_ident: only case",
142    end_time,
143    OPERATION_COUNT,
144    overhead,
145    0
146  );
147
148  benchmark_timer_initialize();
149    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
150      (void) rtems_message_queue_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
151  end_time = benchmark_timer_read();
152
153  put_time(
154    "rtems_message_queue_ident: only case",
155    end_time,
156    OPERATION_COUNT,
157    overhead,
158    0
159  );
160
161  benchmark_timer_initialize();
162    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
163      (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
164  end_time = benchmark_timer_read();
165
166  put_time(
167    "rtems_semaphore_ident: only case",
168    end_time,
169    OPERATION_COUNT,
170    overhead,
171    0
172  );
173
174  benchmark_timer_initialize();
175    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
176      (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
177  end_time = benchmark_timer_read();
178
179  put_time(
180    "rtems_partition_ident: only case",
181    end_time,
182    OPERATION_COUNT,
183    overhead,
184    0
185  );
186
187  benchmark_timer_initialize();
188    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
189      (void) rtems_region_ident( index, &id );
190  end_time = benchmark_timer_read();
191
192  put_time(
193    "rtems_region_ident: only case",
194    end_time,
195    OPERATION_COUNT,
196    overhead,
197    0
198  );
199
200  benchmark_timer_initialize();
201    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
202      (void) rtems_port_ident( index, &id );
203  end_time = benchmark_timer_read();
204
205  put_time(
206    "rtems_port_ident: only case",
207    end_time,
208    OPERATION_COUNT,
209    overhead,
210    0
211  );
212
213  benchmark_timer_initialize();
214    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
215      (void) rtems_timer_ident( index, &id );
216  end_time = benchmark_timer_read();
217
218  put_time(
219    "rtems_timer_ident: only case",
220    end_time,
221    OPERATION_COUNT,
222    overhead,
223    0
224  );
225
226  benchmark_timer_initialize();
227    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
228      (void) rtems_rate_monotonic_ident( index, &id );
229  end_time = benchmark_timer_read();
230
231  put_time(
232    "rtems_rate_monotonic_ident: only case",
233    end_time,
234    OPERATION_COUNT,
235    overhead,
236    0
237  );
238
239  TEST_END();
240  rtems_test_exit( 0 );
241}
Note: See TracBrowser for help on using the repository browser.