source: rtems/testsuites/tmtests/tm15/task1.c @ fdeaa64

5
Last change on this file since fdeaa64 was fdeaa64, checked in by Sebastian Huber <sebastian.huber@…>, on 03/03/20 at 12:01:56

config: Remove <rtems/btimer.h> include

The use of CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER does not define
anything, so remove the <rtems/btimer.h> include.

Update #3875.

  • Property mode set to 100644
File size: 4.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#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#include <rtems/btimer.h>
19
20#define CONFIGURE_INIT
21#include "system.h"
22
23const char rtems_test_name[] = "TIME TEST 15";
24
25bool     time_set;
26uint32_t eventout;
27
28rtems_task High_tasks(
29  rtems_task_argument argument
30);
31
32rtems_task Low_task(
33  rtems_task_argument argument
34);
35
36void test_init(void);
37
38rtems_task Init(
39  rtems_task_argument argument
40)
41{
42  Print_Warning();
43
44  TEST_BEGIN();
45
46  test_init();
47
48  rtems_task_exit();
49}
50
51void test_init(void)
52{
53  rtems_id          id;
54  uint32_t    index;
55  rtems_event_set   event_out;
56  rtems_status_code status;
57
58  time_set = false;
59
60  status = rtems_task_create(
61    rtems_build_name( 'L', 'O', 'W', ' ' ),
62    10,
63    RTEMS_MINIMUM_STACK_SIZE,
64    RTEMS_NO_PREEMPT,
65    RTEMS_DEFAULT_ATTRIBUTES,
66    &id
67  );
68  directive_failed( status, "rtems_task_create LOW" );
69
70  status = rtems_task_start( id, Low_task, 0 );
71  directive_failed( status, "rtems_task_start LOW" );
72
73  for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
74    status = rtems_task_create(
75      rtems_build_name( 'H', 'I', 'G', 'H' ),
76      5,
77      RTEMS_MINIMUM_STACK_SIZE,
78      RTEMS_DEFAULT_MODES,
79      RTEMS_DEFAULT_ATTRIBUTES,
80      &Task_id[ index ]
81    );
82    directive_failed( status, "rtems_task_create LOOP" );
83
84    status = rtems_task_start( Task_id[ index ], High_tasks, 0 );
85    directive_failed( status, "rtems_task_start LOOP" );
86  }
87
88  benchmark_timer_initialize();
89    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
90      (void) benchmark_timer_empty_function();
91  overhead = benchmark_timer_read();
92
93  benchmark_timer_initialize();
94    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
95    {
96        (void) rtems_event_receive(
97                 RTEMS_PENDING_EVENTS,
98                 RTEMS_DEFAULT_OPTIONS,
99                 RTEMS_NO_TIMEOUT,
100                 &event_out
101               );
102    }
103
104  end_time = benchmark_timer_read();
105
106  put_time(
107    "rtems_event_receive: obtain current events",
108    end_time,
109    OPERATION_COUNT,
110    overhead,
111    0
112  );
113
114
115  benchmark_timer_initialize();
116    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
117    {
118      (void) rtems_event_receive(
119               RTEMS_ALL_EVENTS,
120               RTEMS_NO_WAIT,
121               RTEMS_NO_TIMEOUT,
122               &event_out
123             );
124    }
125  end_time = benchmark_timer_read();
126
127  put_time(
128    "rtems_event_receive: not available NO_WAIT",
129    end_time,
130    OPERATION_COUNT,
131    overhead,
132    0
133  );
134}
135
136rtems_task Low_task(
137  rtems_task_argument argument
138)
139{
140  uint32_t    index;
141  rtems_event_set   event_out;
142
143  end_time = benchmark_timer_read();
144
145  put_time(
146    "rtems_event_receive: not available caller blocks",
147    end_time,
148    OPERATION_COUNT,
149    0,
150    0
151  );
152
153  benchmark_timer_initialize();
154    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
155      (void) benchmark_timer_empty_function();
156  overhead = benchmark_timer_read();
157
158  benchmark_timer_initialize();
159    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
160      (void) rtems_event_send( RTEMS_SELF, RTEMS_EVENT_16 );
161  end_time = benchmark_timer_read();
162
163  put_time(
164    "rtems_event_send: no task readied",
165    end_time,
166    OPERATION_COUNT,
167    overhead,
168    0
169  );
170
171  benchmark_timer_initialize();
172    (void) rtems_event_receive(
173             RTEMS_EVENT_16,
174             RTEMS_DEFAULT_OPTIONS,
175             RTEMS_NO_TIMEOUT,
176             &event_out
177           );
178  end_time = benchmark_timer_read();
179
180  put_time(
181    "rtems_event_receive: available",
182    end_time,
183    1,
184    0,
185    0
186  );
187
188  benchmark_timer_initialize();
189    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
190      (void) rtems_event_send( Task_id[ index ], RTEMS_EVENT_16 );
191  end_time = benchmark_timer_read();
192
193  put_time(
194    "rtems_event_send: task readied returns to caller",
195    end_time,
196    OPERATION_COUNT,
197    overhead,
198    0
199  );
200
201  TEST_END();
202  rtems_test_exit( 0 );
203}
204
205rtems_task High_tasks(
206  rtems_task_argument argument
207)
208{
209  if ( time_set )
210    (void) rtems_event_receive(
211      RTEMS_EVENT_16,
212      RTEMS_DEFAULT_OPTIONS,
213      RTEMS_NO_TIMEOUT,
214      &eventout
215    );
216  else {
217    time_set = true;
218    /* start blocking rtems_event_receive time */
219    benchmark_timer_initialize();
220    (void) rtems_event_receive(
221      RTEMS_EVENT_16,
222      RTEMS_DEFAULT_OPTIONS,
223      RTEMS_NO_TIMEOUT,
224      &eventout
225    );
226  }
227}
Note: See TracBrowser for help on using the repository browser.