File indexing completed on 2025-05-11 08:24:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #if !defined(OPERATION_COUNT)
0030 #define OPERATION_COUNT 100
0031 #endif
0032
0033 #ifdef HAVE_CONFIG_H
0034 #include "config.h"
0035 #endif
0036
0037 #include <rtems/btimer.h>
0038
0039 #define CONFIGURE_INIT
0040 #include "system.h"
0041
0042 const char rtems_test_name[] = "TIME TEST 21";
0043
0044 uint8_t Region_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
0045 uint8_t Partition_area[ 2048 ] CPU_STRUCTURE_ALIGNMENT;
0046
0047 rtems_task Task_1(
0048 rtems_task_argument argument
0049 );
0050
0051 rtems_task Init(
0052 rtems_task_argument argument
0053 )
0054 {
0055 rtems_id id;
0056 rtems_status_code status;
0057
0058 Print_Warning();
0059
0060 TEST_BEGIN();
0061
0062 status = rtems_task_create(
0063 rtems_build_name( 'T', 'I', 'M', 'E' ),
0064 RTEMS_MAXIMUM_PRIORITY - 5u,
0065 RTEMS_MINIMUM_STACK_SIZE,
0066 RTEMS_DEFAULT_MODES,
0067 RTEMS_DEFAULT_ATTRIBUTES,
0068 &id
0069 );
0070 directive_failed( status, "rtems_task_create of TASK1" );
0071
0072 status = rtems_task_start( id, Task_1, 0 );
0073 directive_failed( status, "rtems_task_start of TASK1" );
0074
0075 rtems_task_exit();
0076 }
0077
0078 rtems_task Task_1(
0079 rtems_task_argument argument
0080 )
0081 {
0082 uint32_t index;
0083 rtems_id id;
0084 rtems_status_code status;
0085
0086 for( index = 1 ; index <= OPERATION_COUNT ; index++ ) {
0087 status = rtems_task_create (
0088 index,
0089 RTEMS_MAXIMUM_PRIORITY - 1u,
0090 RTEMS_MINIMUM_STACK_SIZE,
0091 RTEMS_DEFAULT_MODES,
0092 RTEMS_DEFAULT_ATTRIBUTES,
0093 &id
0094 );
0095 directive_failed( status, "rtems_task_create" );
0096
0097 status = rtems_message_queue_create(
0098 index,
0099 1,
0100 MESSAGE_SIZE,
0101 RTEMS_DEFAULT_ATTRIBUTES,
0102 &id
0103 );
0104 directive_failed( status, "rtems_message_queue_create" );
0105
0106 status = rtems_semaphore_create(
0107 index,
0108 OPERATION_COUNT,
0109 RTEMS_DEFAULT_ATTRIBUTES,
0110 RTEMS_NO_PRIORITY,
0111 &id
0112 );
0113 directive_failed( status, "rtems_semaphore_create" );
0114
0115 status = rtems_region_create(
0116 index,
0117 Region_area,
0118 2048,
0119 16,
0120 RTEMS_DEFAULT_ATTRIBUTES,
0121 &id
0122 );
0123 directive_failed( status, "rtems_region_create" );
0124
0125 status = rtems_partition_create(
0126 index,
0127 Partition_area,
0128 2048,
0129 128,
0130 RTEMS_DEFAULT_ATTRIBUTES,
0131 &id
0132 );
0133 directive_failed( status, "rtems_partition_create" );
0134
0135 status = rtems_port_create(
0136 index,
0137 Partition_area,
0138 Region_area,
0139 0xff,
0140 &id
0141 );
0142 directive_failed( status, "rtems_port_create" );
0143
0144 status = rtems_timer_create( index, &id );
0145 directive_failed( status, "rtems_timer_create" );
0146
0147 status = rtems_rate_monotonic_create( index, &id );
0148 directive_failed( status, "rtems_rate_monotonic_create" );
0149 }
0150
0151 benchmark_timer_initialize();
0152 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0153 (void) benchmark_timer_empty_function();
0154 overhead = benchmark_timer_read();
0155
0156 benchmark_timer_initialize();
0157 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0158 (void) rtems_task_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
0159 end_time = benchmark_timer_read();
0160
0161 put_time(
0162 "rtems_task_ident: only case",
0163 end_time,
0164 OPERATION_COUNT,
0165 overhead,
0166 0
0167 );
0168
0169 benchmark_timer_initialize();
0170 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0171 (void) rtems_message_queue_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
0172 end_time = benchmark_timer_read();
0173
0174 put_time(
0175 "rtems_message_queue_ident: only case",
0176 end_time,
0177 OPERATION_COUNT,
0178 overhead,
0179 0
0180 );
0181
0182 benchmark_timer_initialize();
0183 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0184 (void) rtems_semaphore_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
0185 end_time = benchmark_timer_read();
0186
0187 put_time(
0188 "rtems_semaphore_ident: only case",
0189 end_time,
0190 OPERATION_COUNT,
0191 overhead,
0192 0
0193 );
0194
0195 benchmark_timer_initialize();
0196 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0197 (void) rtems_partition_ident( index, RTEMS_SEARCH_ALL_NODES, &id );
0198 end_time = benchmark_timer_read();
0199
0200 put_time(
0201 "rtems_partition_ident: only case",
0202 end_time,
0203 OPERATION_COUNT,
0204 overhead,
0205 0
0206 );
0207
0208 benchmark_timer_initialize();
0209 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0210 (void) rtems_region_ident( index, &id );
0211 end_time = benchmark_timer_read();
0212
0213 put_time(
0214 "rtems_region_ident: only case",
0215 end_time,
0216 OPERATION_COUNT,
0217 overhead,
0218 0
0219 );
0220
0221 benchmark_timer_initialize();
0222 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0223 (void) rtems_port_ident( index, &id );
0224 end_time = benchmark_timer_read();
0225
0226 put_time(
0227 "rtems_port_ident: only case",
0228 end_time,
0229 OPERATION_COUNT,
0230 overhead,
0231 0
0232 );
0233
0234 benchmark_timer_initialize();
0235 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0236 (void) rtems_timer_ident( index, &id );
0237 end_time = benchmark_timer_read();
0238
0239 put_time(
0240 "rtems_timer_ident: only case",
0241 end_time,
0242 OPERATION_COUNT,
0243 overhead,
0244 0
0245 );
0246
0247 benchmark_timer_initialize();
0248 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0249 (void) rtems_rate_monotonic_ident( index, &id );
0250 end_time = benchmark_timer_read();
0251
0252 put_time(
0253 "rtems_rate_monotonic_ident: only case",
0254 end_time,
0255 OPERATION_COUNT,
0256 overhead,
0257 0
0258 );
0259
0260 TEST_END();
0261 rtems_test_exit( 0 );
0262 }