source: rtems/testsuites/tmtests/tm24/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: 2.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 24";
24
25uint32_t   Task_count;
26
27rtems_task Tasks(
28  rtems_task_argument argument
29);
30
31rtems_task High_task(
32  rtems_task_argument argument
33);
34
35rtems_task Init(
36  rtems_task_argument argument
37)
38{
39  rtems_id          id;
40  uint32_t    index;
41  rtems_status_code status;
42
43  Print_Warning();
44
45  TEST_BEGIN();
46
47  status = rtems_task_create(
48    rtems_build_name( 'H', 'I', 'G', 'H' ),
49    1,
50    RTEMS_MINIMUM_STACK_SIZE,
51    RTEMS_DEFAULT_MODES,
52    RTEMS_DEFAULT_ATTRIBUTES,
53    &id
54  );
55  directive_failed( status, "rtems_task_create HIGH" );
56
57  status = rtems_task_start( id, High_task, 0 );
58  directive_failed( status, "rtems_task_create HIGH" );
59
60  for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
61    status = rtems_task_create(
62      rtems_build_name( 'R', 'E', 'S', 'T' ),
63      (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u,
64      RTEMS_MINIMUM_STACK_SIZE,
65      RTEMS_DEFAULT_MODES,
66      RTEMS_DEFAULT_ATTRIBUTES,
67      &id
68    );
69    directive_failed( status, "rtems_task_create LOOP" );
70
71    status = rtems_task_start( id, Tasks, 0 );
72    directive_failed( status, "rtems_task_start LOOP" );
73  }
74  rtems_task_exit();
75}
76
77rtems_task High_task(
78  rtems_task_argument argument
79)
80{
81  uint32_t    index;
82
83  benchmark_timer_initialize();
84    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
85      (void) benchmark_timer_empty_function();
86  overhead = benchmark_timer_read();
87
88  benchmark_timer_initialize();
89    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
90      (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
91  end_time = benchmark_timer_read();
92
93  put_time(
94    "rtems_task_wake_after: yield returns to caller",
95    end_time,
96    OPERATION_COUNT,
97    overhead,
98    0
99  );
100
101  Task_count = 0;
102
103  rtems_task_exit();
104}
105
106rtems_task Tasks(
107  rtems_task_argument argument
108)
109{
110  Task_count++;
111
112  if ( Task_count == 1 )
113    benchmark_timer_initialize();
114  else if ( Task_count == OPERATION_COUNT ) {
115    end_time = benchmark_timer_read();
116
117    put_time(
118      "rtems_task_wake_after: yields preempts caller",
119      end_time,
120      OPERATION_COUNT,
121      overhead,
122      0
123    );
124
125  TEST_END();
126    rtems_test_exit( 0 );
127  }
128  (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
129}
Note: See TracBrowser for help on using the repository browser.