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 28";
0043
0044 rtems_id Port_id;
0045
0046 uint8_t Internal_area[ 256 ] CPU_STRUCTURE_ALIGNMENT;
0047 uint8_t External_area[ 256 ] CPU_STRUCTURE_ALIGNMENT;
0048
0049 rtems_task Test_task(
0050 rtems_task_argument argument
0051 );
0052
0053 rtems_task Init(
0054 rtems_task_argument argument
0055 )
0056 {
0057 rtems_status_code status;
0058
0059 Print_Warning();
0060
0061 TEST_BEGIN();
0062
0063 status = rtems_task_create(
0064 rtems_build_name( 'T', 'I', 'M', 'E' ),
0065 (RTEMS_MAXIMUM_PRIORITY / 2u) + 1u,
0066 RTEMS_MINIMUM_STACK_SIZE,
0067 RTEMS_DEFAULT_MODES,
0068 RTEMS_DEFAULT_ATTRIBUTES,
0069 &Task_id[ 1 ]
0070 );
0071 directive_failed( status, "rtems_task_create" );
0072
0073 status = rtems_task_start( Task_id[ 1 ], Test_task, 0 );
0074 directive_failed( status, "rtems_task_start" );
0075
0076 rtems_task_exit();
0077 }
0078
0079 rtems_task Test_task (
0080 rtems_task_argument argument
0081 )
0082 {
0083 rtems_name name;
0084 uint32_t index;
0085 void *converted;
0086
0087 benchmark_timer_initialize();
0088 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0089 (void) benchmark_timer_empty_function();
0090 overhead = benchmark_timer_read();
0091
0092 name = rtems_build_name( 'P', 'O', 'R', 'T' ),
0093
0094 benchmark_timer_initialize();
0095 rtems_port_create(
0096 name,
0097 Internal_area,
0098 External_area,
0099 0xff,
0100 &Port_id
0101 );
0102 end_time = benchmark_timer_read();
0103
0104 put_time(
0105 "rtems_port_create: only case",
0106 end_time,
0107 1,
0108 0,
0109 0
0110 );
0111
0112 benchmark_timer_initialize();
0113 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0114 (void) rtems_port_external_to_internal(
0115 Port_id,
0116 &External_area[ 0xf ],
0117 &converted
0118 );
0119 end_time = benchmark_timer_read();
0120
0121 put_time(
0122 "rtems_port_external_to_internal: only case",
0123 end_time,
0124 OPERATION_COUNT,
0125 overhead,
0126 0
0127 );
0128
0129 benchmark_timer_initialize();
0130 for ( index=1 ; index <= OPERATION_COUNT ; index++ )
0131 (void) rtems_port_internal_to_external(
0132 Port_id,
0133 &Internal_area[ 0xf ],
0134 &converted
0135 );
0136 end_time = benchmark_timer_read();
0137
0138 put_time(
0139 "rtems_port_internal_to_external: only case",
0140 end_time,
0141 OPERATION_COUNT,
0142 overhead,
0143 0
0144 );
0145
0146 benchmark_timer_initialize();
0147 rtems_port_delete( Port_id );
0148 end_time = benchmark_timer_read();
0149
0150 put_time(
0151 "rtems_port_delete: only case",
0152 end_time,
0153 1,
0154 0,
0155 0
0156 );
0157
0158 TEST_END();
0159 rtems_test_exit( 0 );
0160 }