source: rtems/testsuites/tmtests/tm28/task1.c @ a4bc4d6e

4.115
Last change on this file since a4bc4d6e was a4bc4d6e, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/22/11 at 10:00:39

Add HAVE_CONFIG_H.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
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.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#define CONFIGURE_INIT
17#include "system.h"
18
19rtems_id Port_id;
20
21uint8_t   Internal_area[ 256 ] CPU_STRUCTURE_ALIGNMENT;
22uint8_t   External_area[ 256 ] CPU_STRUCTURE_ALIGNMENT;
23
24rtems_task Test_task(
25  rtems_task_argument argument
26);
27
28rtems_task Init(
29  rtems_task_argument argument
30)
31{
32  rtems_status_code status;
33
34  Print_Warning();
35
36  puts( "\n\n*** TIME TEST 28 ***" );
37
38  status = rtems_task_create(
39    rtems_build_name( 'T', 'I', 'M', 'E' ),
40    (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u,
41    RTEMS_MINIMUM_STACK_SIZE,
42    RTEMS_DEFAULT_MODES,
43    RTEMS_DEFAULT_ATTRIBUTES,
44    &Task_id[ 1 ]
45  );
46  directive_failed( status, "rtems_task_create" );
47
48  status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
49  directive_failed( status, "rtems_task_start" );
50
51  status = rtems_task_delete( RTEMS_SELF );
52  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
53}
54
55rtems_task Test_task (
56  rtems_task_argument argument
57)
58{
59  rtems_name         name;
60  uint32_t     index;
61  void              *converted;
62
63  benchmark_timer_initialize();
64    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
65      (void) benchmark_timer_empty_function();
66  overhead = benchmark_timer_read();
67
68  name = rtems_build_name( 'P', 'O', 'R', 'T' ),
69
70  benchmark_timer_initialize();
71    rtems_port_create(
72      name,
73      Internal_area,
74      External_area,
75      0xff,
76      &Port_id
77    );
78  end_time = benchmark_timer_read();
79
80  put_time(
81    "rtems_port_create",
82    end_time,
83    1,
84    0,
85    CALLING_OVERHEAD_PORT_CREATE
86  );
87
88  benchmark_timer_initialize();
89    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
90      (void) rtems_port_external_to_internal(
91               Port_id,
92               &External_area[ 0xf ],
93               &converted
94             );
95  end_time = benchmark_timer_read();
96
97  put_time(
98    "rtems_port_external_to_internal",
99    end_time,
100    OPERATION_COUNT,
101    overhead,
102    CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL
103  );
104
105  benchmark_timer_initialize();
106    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
107      (void) rtems_port_internal_to_external(
108               Port_id,
109               &Internal_area[ 0xf ],
110               &converted
111             );
112  end_time = benchmark_timer_read();
113
114  put_time(
115    "rtems_port_internal_to_external",
116    end_time,
117    OPERATION_COUNT,
118    overhead,
119    CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL
120  );
121
122  benchmark_timer_initialize();
123    rtems_port_delete( Port_id );
124  end_time = benchmark_timer_read();
125
126  put_time(
127    "rtems_port_delete",
128    end_time,
129    1,
130    0,
131    CALLING_OVERHEAD_PORT_DELETE
132  );
133
134  puts( "*** END OF TEST 28 ***" );
135  rtems_test_exit( 0 );
136}
Note: See TracBrowser for help on using the repository browser.