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