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