rtems_task High_task( rtems_task_argument argument ) { int index; benchmark_timer_initialize(); for ( index=1 ; index < operation_count ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index < operation_count ; index++ ) (void) rtems_message_queue_send( Queue_id, Buffer, MESSAGE_SIZE ); end_time = benchmark_timer_read(); put_time( "rtems_message_queue_send: task readied -- returns to caller", end_time, operation_count - 1, overhead, CALLING_OVERHEAD_MESSAGE_QUEUE_SEND ); puts( "*** END OF TEST 12 ***" ); rtems_test_exit( 0 ); }
rtems_task High_task( rtems_task_argument argument ) { int index; benchmark_timer_initialize(); for ( index=1 ; index < operation_count ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= operation_count ; index++ ) (void) rtems_message_queue_urgent( Queue_id, Buffer, MESSAGE_SIZE ); end_time = benchmark_timer_read(); put_time( "rtems_message_queue_urgent: task readied returns to caller", end_time, operation_count, overhead, 0 ); TEST_END(); rtems_test_exit( 0 ); }
rtems_task Init( rtems_task_argument argument ) { rtems_task_priority priority; int index; rtems_id id; rtems_task_entry task_entry; rtems_status_code status; Print_Warning(); TEST_BEGIN(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); priority = 2; if ( OPERATION_COUNT > RTEMS_MAXIMUM_PRIORITY - 2 ) operation_count = RTEMS_MAXIMUM_PRIORITY - 2; for( index=1 ; index <= operation_count ; index++ ) { status = rtems_task_create( rtems_build_name( 'T', 'I', 'M', 'E' ), priority, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); directive_failed( status, "rtems_task_create LOOP" ); if ( index == 1 ) task_entry = High_task; else if ( index == operation_count ) task_entry = Low_task; else task_entry = Middle_tasks; status = rtems_task_start( id, task_entry, 0 ); directive_failed( status, "rtems_task_start LOOP" ); priority++; } status = rtems_task_delete( RTEMS_SELF ); directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); }
rtems_task Last_task( rtems_task_argument argument ) { int index; end_time = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index < operation_count ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); put_time( "rtems_task_set_priority: preempts caller", end_time, operation_count - 1u, overhead, CALLING_OVERHEAD_TASK_SET_PRIORITY ); TEST_END(); rtems_test_exit( 0 ); }
rtems_task Low_task( rtems_task_argument argument ) { uint32_t index; end_time = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); put_time( "rtems_rate_monotonic_period: conclude periods -- caller blocks", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD ); puts( "*** END OF TEST 29 ***" ); rtems_test_exit( 0 ); }
rtems_task Task_1( rtems_task_argument argument ) { uint32_t index; check_read_timer(); rtems_test_pause(); benchmark_timer_initialize(); end_time = benchmark_timer_read(); put_time( "NULL timer stopped at", end_time, 1, 0, 0 ); benchmark_timer_initialize(); for ( index = 1 ; index <= 1000 ; index++ ) (void) benchmark_timer_empty_function(); end_time = benchmark_timer_read(); put_time( "LOOP (1000) timer stopped at", end_time, 1, 0, 0 ); benchmark_timer_initialize(); for ( index = 1 ; index <= 10000 ; index++ ) (void) benchmark_timer_empty_function(); end_time = benchmark_timer_read(); put_time( "LOOP (10000) timer stopped at", end_time, 1, 0, 0 ); benchmark_timer_initialize(); for ( index = 1 ; index <= 50000 ; index++ ) (void) benchmark_timer_empty_function(); end_time = benchmark_timer_read(); put_time( "LOOP (50000) timer stopped at", end_time, 1, 0, 0 ); benchmark_timer_initialize(); for ( index = 1 ; index <= 100000 ; index++ ) (void) benchmark_timer_empty_function(); end_time = benchmark_timer_read(); put_time( "LOOP (100000) timer stopped at", end_time, 1, 0, 0 ); puts( "*** END OF TIME CHECKER ***" ); rtems_test_exit( 0 ); }
rtems_task test_task( rtems_task_argument argument ) { rtems_status_code status; uint32_t index; rtems_task_priority old_priority; rtems_time_of_day time; uint32_t old_note; uint32_t old_mode; benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_task_set_priority( Test_task_id, RTEMS_CURRENT_PRIORITY, &old_priority ); end_time = benchmark_timer_read(); put_time( "rtems_task_set_priority: obtain current priority", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TASK_SET_PRIORITY ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_task_set_priority( Test_task_id, RTEMS_MAXIMUM_PRIORITY - 2u, &old_priority ); end_time = benchmark_timer_read(); put_time( "rtems_task_set_priority: returns to caller", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TASK_SET_PRIORITY ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_task_mode( RTEMS_CURRENT_MODE, RTEMS_CURRENT_MODE, &old_mode ); end_time = benchmark_timer_read(); put_time( "rtems_task_mode: obtain current mode", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TASK_MODE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { (void) rtems_task_mode( RTEMS_INTERRUPT_LEVEL(1), RTEMS_INTERRUPT_MASK, &old_mode ); (void) rtems_task_mode( RTEMS_INTERRUPT_LEVEL(0), RTEMS_INTERRUPT_MASK, &old_mode ); } end_time = benchmark_timer_read(); put_time( "rtems_task_mode: no reschedule", end_time, OPERATION_COUNT * 2, overhead, CALLING_OVERHEAD_TASK_MODE ); benchmark_timer_initialize(); /* must be one host */ (void) rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &old_mode ); end_time = benchmark_timer_read(); put_time( "rtems_task_mode: reschedule -- returns to caller", end_time, 1, 0, CALLING_OVERHEAD_TASK_MODE ); status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode ); directive_failed( status, "rtems_task_mode" ); status = rtems_task_set_priority( Test_task_id, 1, &old_priority ); directive_failed( status, "rtems_task_set_priority" ); /* preempted by test_task1 */ benchmark_timer_initialize(); (void) rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_task_set_note( Test_task_id, 8, 10 ); end_time = benchmark_timer_read(); put_time( "rtems_task_set_note", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TASK_SET_NOTE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_task_get_note( Test_task_id, 8, &old_note ); end_time = benchmark_timer_read(); put_time( "rtems_task_get_note", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TASK_GET_NOTE ); build_time( &time, 1, 1, 1988, 0, 0, 0, 0 ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_clock_set( &time ); end_time = benchmark_timer_read(); put_time( "rtems_clock_set", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_CLOCK_SET ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_clock_get_tod( &time ); end_time = benchmark_timer_read(); put_time( "rtems_clock_get_tod", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_CLOCK_GET ); puts( "*** END OF TEST 8 ***" ); rtems_test_exit( 0 ); }
rtems_task Task_1( rtems_task_argument argument ) { uint32_t index; rtems_mode previous_mode; rtems_task_priority previous_priority; rtems_status_code status; Partition_name = rtems_build_name( 'P', 'A', 'R', 'T' ); benchmark_timer_initialize(); rtems_partition_create( Partition_name, Partition_area, PARTITION_SIZE, 128, RTEMS_DEFAULT_ATTRIBUTES, &Partition_id ); end_time = benchmark_timer_read(); put_time( "rtems_partition_create", end_time, 1, 0, CALLING_OVERHEAD_PARTITION_CREATE ); Region_name = rtems_build_name( 'R', 'E', 'G', 'N' ); benchmark_timer_initialize(); rtems_region_create( Region_name, Region_area, 2048, 16, RTEMS_DEFAULT_ATTRIBUTES, &Region_id ); end_time = benchmark_timer_read(); put_time( "rtems_region_create", end_time, 1, 0, CALLING_OVERHEAD_REGION_CREATE ); benchmark_timer_initialize(); (void) rtems_partition_get_buffer( Partition_id, &Buffer_address_1 ); end_time = benchmark_timer_read(); put_time( "rtems_partition_get_buffer: available", end_time, 1, 0, CALLING_OVERHEAD_PARTITION_GET_BUFFER ); buffer_count = 0; while ( FOREVER ) { status = rtems_partition_get_buffer( Partition_id, &Buffer_addresses[ buffer_count ] ); if ( status == RTEMS_UNSATISFIED ) break; buffer_count++; rtems_test_assert( buffer_count < PARTITION_BUFFER_POINTERS ); } benchmark_timer_initialize(); (void) rtems_partition_get_buffer( Partition_id, &Buffer_address_2 ); end_time = benchmark_timer_read(); put_time( "rtems_partition_get_buffer: not available", end_time, 1, 0, CALLING_OVERHEAD_PARTITION_GET_BUFFER ); benchmark_timer_initialize(); (void) rtems_partition_return_buffer( Partition_id, Buffer_address_1 ); end_time = benchmark_timer_read(); put_time( "rtems_partition_return_buffer", end_time, 1, 0, CALLING_OVERHEAD_PARTITION_RETURN_BUFFER ); for ( index = 0 ; index < buffer_count ; index++ ) { status = rtems_partition_return_buffer( Partition_id, Buffer_addresses[ index ] ); directive_failed( status, "rtems_partition_return_buffer" ); } benchmark_timer_initialize(); (void) rtems_partition_delete( Partition_id ); end_time = benchmark_timer_read(); put_time( "rtems_partition_delete", end_time, 1, 0, CALLING_OVERHEAD_PARTITION_DELETE ); status = rtems_region_get_segment( Region_id, 400, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &Buffer_address_2 ); directive_failed( status, "region_get_segment" ); benchmark_timer_initialize(); (void) rtems_region_get_segment( Region_id, 400, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &Buffer_address_3 ); end_time = benchmark_timer_read(); put_time( "rtems_region_get_segment: available", end_time, 1, 0, CALLING_OVERHEAD_REGION_GET_SEGMENT ); benchmark_timer_initialize(); (void) rtems_region_get_segment( Region_id, 1998, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT, &Buffer_address_4 ); end_time = benchmark_timer_read(); put_time( "rtems_region_get_segment: not available -- NO_WAIT", end_time, 1, 0, CALLING_OVERHEAD_REGION_GET_SEGMENT ); status = rtems_region_return_segment( Region_id, Buffer_address_3 ); directive_failed( status, "rtems_region_return_segment" ); benchmark_timer_initialize(); (void) rtems_region_return_segment( Region_id, Buffer_address_2 ); end_time = benchmark_timer_read(); put_time( "rtems_region_return_segment: no waiting tasks", end_time, 1, 0, CALLING_OVERHEAD_REGION_RETURN_SEGMENT ); status = rtems_region_get_segment( Region_id, 400, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &Buffer_address_1 ); directive_failed( status, "rtems_region_get_segment" ); benchmark_timer_initialize(); (void) rtems_region_get_segment( Region_id, 1998, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &Buffer_address_2 ); /* execute Task_2 */ end_time = benchmark_timer_read(); put_time( "rtems_region_return_segment: task readied -- preempts caller", end_time, 1, 0, CALLING_OVERHEAD_REGION_RETURN_SEGMENT ); status = rtems_region_return_segment( Region_id, Buffer_address_2 ); directive_failed( status, "rtems_region_return_segment" ); status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode ); directive_failed( status, "rtems_task_mode" ); status = rtems_task_set_priority( RTEMS_SELF, RTEMS_MAXIMUM_PRIORITY - 1u, &previous_priority ); directive_failed( status, "rtems_task_set_priority" ); status = rtems_region_get_segment( Region_id, 400, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &Buffer_address_1 ); directive_failed( status, "rtems_region_return_segment" ); status = rtems_region_get_segment( Region_id, 1998, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &Buffer_address_2 ); directive_failed( status, "rtems_region_get_segment" ); /* execute Task_2 */ status = rtems_region_return_segment( Region_id, Buffer_address_2 ); directive_failed( status, "rtems_region_return_segment" ); benchmark_timer_initialize(); (void) rtems_region_delete( Region_id ); end_time = benchmark_timer_read(); put_time( "rtems_region_delete", end_time, 1, 0, CALLING_OVERHEAD_REGION_DELETE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_io_initialize( _STUB_major, 0, NULL ); end_time = benchmark_timer_read(); put_time( "rtems_io_initialize", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_IO_INITIALIZE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_io_open( _STUB_major, 0, NULL ); end_time = benchmark_timer_read(); put_time( "rtems_io_open", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_IO_OPEN ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_io_close( _STUB_major, 0, NULL ); end_time = benchmark_timer_read(); put_time( "rtems_io_close", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_IO_CLOSE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_io_read( _STUB_major, 0, NULL ); end_time = benchmark_timer_read(); put_time( "rtems_io_read", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_IO_READ ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_io_write( _STUB_major, 0, NULL ); end_time = benchmark_timer_read(); put_time( "rtems_io_write", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_IO_WRITE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_io_control( _STUB_major, 0, NULL ); end_time = benchmark_timer_read(); put_time( "rtems_io_control", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_IO_CONTROL ); puts( "*** END OF TEST 20 ***" ); rtems_test_exit( 0 ); }
void test_init() { int index; size_t size; rtems_task_entry task_entry; rtems_status_code status; rtems_task_priority priority; rtems_id task_id; priority = 2; if ( OPERATION_COUNT > RTEMS_MAXIMUM_PRIORITY - 2 ) operation_count = RTEMS_MAXIMUM_PRIORITY - 2; for( index = 0; index < operation_count ; index++ ) { status = rtems_task_create( rtems_build_name( 'T', 'I', 'M', 'E' ), priority, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id ); directive_failed( status, "rtems_task_create LOOP" ); priority++; if ( index==0 ) task_entry = High_task; else if ( index==operation_count-1 ) task_entry = Low_task; else task_entry = Middle_tasks; status = rtems_task_start( task_id, task_entry, 0 ); directive_failed( status, "rtems_task_start LOOP" ); } status = rtems_message_queue_create( 1, (uint32_t)operation_count, 16, RTEMS_DEFAULT_ATTRIBUTES, &Queue_id ); directive_failed( status, "rtems_message_queue_create" ); benchmark_timer_initialize(); for ( index=1 ; index < operation_count ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index < operation_count ; index++ ) (void) rtems_message_queue_receive( Queue_id, (long (*)[4]) Buffer, &size, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT ); end_time = benchmark_timer_read(); put_time( "rtems_message_queue_receive: not available NO_WAIT", end_time, operation_count, overhead, CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE ); }
rtems_task Test_task( rtems_task_argument argument ) { uint32_t semaphore_obtain_time; uint32_t semaphore_release_time; uint32_t semaphore_obtain_no_wait_time; uint32_t semaphore_obtain_loop_time; uint32_t semaphore_release_loop_time; uint32_t index; uint32_t iterations; rtems_name name; rtems_id smid; rtems_status_code status; name = rtems_build_name( 'S', 'M', '1', ' ' ); semaphore_obtain_time = 0; semaphore_release_time = 0; semaphore_obtain_no_wait_time = 0; semaphore_obtain_loop_time = 0; semaphore_release_loop_time = 0; /* Time one invocation of rtems_semaphore_create */ benchmark_timer_initialize(); (void) rtems_semaphore_create( name, OPERATION_COUNT, RTEMS_DEFAULT_MODES, RTEMS_NO_PRIORITY, &smid ); end_time = benchmark_timer_read(); put_time( "rtems_semaphore_create", end_time, 1, 0, CALLING_OVERHEAD_SEMAPHORE_CREATE ); /* Time one invocation of rtems_semaphore_delete */ benchmark_timer_initialize(); (void) rtems_semaphore_delete( smid ); end_time = benchmark_timer_read(); put_time( "rtems_semaphore_delete", end_time, 1, 0, CALLING_OVERHEAD_SEMAPHORE_CREATE ); status = rtems_semaphore_create( name, OPERATION_COUNT, RTEMS_DEFAULT_ATTRIBUTES, RTEMS_NO_PRIORITY, &smid ); for ( iterations=OPERATION_COUNT ; iterations ; iterations-- ) { benchmark_timer_initialize(); for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); end_time = benchmark_timer_read(); semaphore_obtain_loop_time += end_time; semaphore_release_loop_time += end_time; /* rtems_semaphore_obtain (available) */ benchmark_timer_initialize(); for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) (void) rtems_semaphore_obtain( smid, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT ); end_time = benchmark_timer_read(); semaphore_obtain_time += end_time; /* rtems_semaphore_release */ benchmark_timer_initialize(); for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) (void) rtems_semaphore_release( smid ); end_time = benchmark_timer_read(); semaphore_release_time += end_time; /* semaphore obtain (RTEMS_NO_WAIT) */ benchmark_timer_initialize(); for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) rtems_semaphore_obtain( smid, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT ); semaphore_obtain_no_wait_time += benchmark_timer_read(); benchmark_timer_initialize(); for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) rtems_semaphore_release( smid ); end_time = benchmark_timer_read(); semaphore_release_time += end_time; } put_time( "rtems_semaphore_obtain: available", semaphore_obtain_time, OPERATION_COUNT * OPERATION_COUNT, semaphore_obtain_loop_time, CALLING_OVERHEAD_SEMAPHORE_OBTAIN ); put_time( "rtems_semaphore_obtain: not available -- NO_WAIT", semaphore_obtain_no_wait_time, OPERATION_COUNT * OPERATION_COUNT, semaphore_obtain_loop_time, CALLING_OVERHEAD_SEMAPHORE_OBTAIN ); put_time( "rtems_semaphore_release: no waiting tasks", semaphore_release_time, OPERATION_COUNT * OPERATION_COUNT * 2, semaphore_release_loop_time * 2, CALLING_OVERHEAD_SEMAPHORE_RELEASE ); puts( "*** END OF TEST 1 ***" ); rtems_test_exit( 0 ); }
void queue_test(void) { uint32_t send_loop_time; uint32_t urgent_loop_time; uint32_t receive_loop_time; uint32_t send_time; uint32_t urgent_time; uint32_t receive_time; uint32_t empty_flush_time; uint32_t flush_time; uint32_t empty_flush_count; uint32_t flush_count; uint32_t index; uint32_t iterations; long buffer[4]; rtems_status_code status; size_t size; send_loop_time = 0; urgent_loop_time = 0; receive_loop_time = 0; send_time = 0; urgent_time = 0; receive_time = 0; empty_flush_time = 0; flush_time = 0; flush_count = 0; empty_flush_count = 0; for ( iterations = 1 ; iterations <= OPERATION_COUNT ; iterations++ ) { benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); send_loop_time += benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); urgent_loop_time += benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); receive_loop_time += benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_message_queue_send( Queue_id, buffer, MESSAGE_SIZE ); send_time += benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_message_queue_receive( Queue_id, (long (*)[4])buffer, &size, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT ); receive_time += benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_message_queue_urgent( Queue_id, buffer, MESSAGE_SIZE ); urgent_time += benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_message_queue_receive( Queue_id, (long (*)[4])buffer, &size, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT ); receive_time += benchmark_timer_read(); benchmark_timer_initialize(); rtems_message_queue_flush( Queue_id, &empty_flush_count ); empty_flush_time += benchmark_timer_read(); /* send one message to flush */ status = rtems_message_queue_send( Queue_id, (long (*)[4])buffer, MESSAGE_SIZE ); directive_failed( status, "rtems_message_queue_send" ); benchmark_timer_initialize(); rtems_message_queue_flush( Queue_id, &flush_count ); flush_time += benchmark_timer_read(); } put_time( "rtems_message_queue_send: no waiting tasks", send_time, OPERATION_COUNT * OPERATION_COUNT, send_loop_time, CALLING_OVERHEAD_MESSAGE_QUEUE_SEND ); put_time( "rtems_message_queue_urgent: no waiting tasks", urgent_time, OPERATION_COUNT * OPERATION_COUNT, urgent_loop_time, CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT ); put_time( "rtems_message_queue_receive: available", receive_time, OPERATION_COUNT * OPERATION_COUNT * 2, receive_loop_time * 2, CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE ); put_time( "rtems_message_queue_flush: no messages flushed", empty_flush_time, OPERATION_COUNT, 0, CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH ); put_time( "rtems_message_queue_flush: messages flushed", flush_time, OPERATION_COUNT, 0, CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH ); }
void test_init(void) { rtems_id id; uint32_t index; rtems_event_set event_out; rtems_status_code status; time_set = false; status = rtems_task_create( rtems_build_name( 'L', 'O', 'W', ' ' ), 10, RTEMS_MINIMUM_STACK_SIZE, RTEMS_NO_PREEMPT, RTEMS_DEFAULT_ATTRIBUTES, &id ); directive_failed( status, "rtems_task_create LOW" ); status = rtems_task_start( id, Low_task, 0 ); directive_failed( status, "rtems_task_start LOW" ); for ( index = 1 ; index <= OPERATION_COUNT ; index++ ) { status = rtems_task_create( rtems_build_name( 'H', 'I', 'G', 'H' ), 5, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ index ] ); directive_failed( status, "rtems_task_create LOOP" ); status = rtems_task_start( Task_id[ index ], High_tasks, 0 ); directive_failed( status, "rtems_task_start LOOP" ); } benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { (void) rtems_event_receive( RTEMS_PENDING_EVENTS, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &event_out ); } end_time = benchmark_timer_read(); put_time( "rtems_event_receive: obtain current events", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_EVENT_RECEIVE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { (void) rtems_event_receive( RTEMS_ALL_EVENTS, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT, &event_out ); } end_time = benchmark_timer_read(); put_time( "rtems_event_receive: not available NO_WAIT", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_EVENT_RECEIVE ); }
rtems_task Low_task( rtems_task_argument argument ) { uint32_t index; rtems_event_set event_out; end_time = benchmark_timer_read(); put_time( "rtems_event_receive: not available caller blocks", end_time, OPERATION_COUNT, 0, CALLING_OVERHEAD_EVENT_RECEIVE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_event_send( RTEMS_SELF, RTEMS_EVENT_16 ); end_time = benchmark_timer_read(); put_time( "rtems_event_send: no task readied", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_EVENT_SEND ); benchmark_timer_initialize(); (void) rtems_event_receive( RTEMS_EVENT_16, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT, &event_out ); end_time = benchmark_timer_read(); put_time( "rtems_event_receive: available", end_time, 1, 0, CALLING_OVERHEAD_EVENT_RECEIVE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_event_send( Task_id[ index ], RTEMS_EVENT_16 ); end_time = benchmark_timer_read(); put_time( "rtems_event_send: task readied returns to caller", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_EVENT_SEND ); TEST_END(); rtems_test_exit( 0 ); }
void complete_test( void ) { uint32_t index; rtems_id task_id; benchmark_timer_initialize(); _Thread_Resume( Middle_tcb, true ); thread_resume_time = benchmark_timer_read(); _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE ); benchmark_timer_initialize(); _Thread_Unblock( Middle_tcb ); thread_unblock_time = benchmark_timer_read(); _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE ); benchmark_timer_initialize(); _Thread_Ready( Middle_tcb ); thread_ready_time = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); task_id = Middle_tcb->Object.id; benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) _Thread_Get( task_id, &location ); thread_get_time = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) _Semaphore_Get( Semaphore_id, &location ); semaphore_get_time = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) _Thread_Get( 0x3, &location ); thread_get_invalid_time = benchmark_timer_read(); /* * This is the running task and we have tricked RTEMS out enough where * we need to set some internal tracking information to match this. */ _Thread_Heir = _Thread_Executing; _Context_Switch_necessary = false; _Thread_Dispatch_disable_level = 0; /* * Now dump all the times */ put_time( "_ISR_Disable", isr_disable_time, 1, 0, 0 ); put_time( "_ISR_Flash", isr_flash_time, 1, 0, 0 ); put_time( "_ISR_Enable", isr_enable_time, 1, 0, 0 ); put_time( "_Thread_Disable_dispatch", thread_disable_dispatch_time, 1, 0, 0 ); put_time( "_Thread_Enable_dispatch", thread_enable_dispatch_time, 1, 0, 0 ); put_time( "_Thread_Set_state", thread_set_state_time, 1, 0, 0 ); put_time( "_Thread_Dispatch (NO FP)", thread_dispatch_no_fp_time, 1, 0, 0 ); put_time( "context switch: no floating point contexts", context_switch_no_fp_time, 1, 0, 0 ); put_time( "context switch: self", context_switch_self_time, 1, 0, 0 ); put_time( "context switch: to another task", context_switch_another_task_time, 1, 0, 0 ); #if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1) put_time( "fp context switch: restore 1st FP task", context_switch_restore_1st_fp_time, 1, 0, 0 ); put_time( "fp context switch: save idle, restore initialized", context_switch_save_idle_restore_initted_time, 1, 0, 0 ); put_time( "fp context switch: save idle, restore idle", context_switch_save_restore_idle_time, 1, 0, 0 ); put_time( "fp context switch: save initialized, restore initialized", context_switch_save_restore_initted_time, 1, 0, 0 ); #else puts( "fp context switch: restore 1st FP task - NA" ); puts( "fp context switch: save idle, restore initialized - NA" ); puts( "fp context switch: save idle, restore idle - NA" ); puts( "fp context switch: save initialized, restore initialized - NA" ); #endif put_time( "_Thread_Resume", thread_resume_time, 1, 0, 0 ); put_time( "_Thread_Unblock", thread_unblock_time, 1, 0, 0 ); put_time( "_Thread_Ready", thread_ready_time, 1, 0, 0 ); put_time( "_Thread_Get", thread_get_time, OPERATION_COUNT, 0, 0 ); put_time( "_Semaphore_Get", semaphore_get_time, OPERATION_COUNT, 0, 0 ); put_time( "_Thread_Get: invalid id", thread_get_invalid_time, OPERATION_COUNT, 0, 0 ); puts( "*** END OF TEST 26 ***" ); rtems_test_exit( 0 ); }
rtems_task High_task( rtems_task_argument argument ) { uint32_t index; rtems_status_code status; int i; benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_create( index, &Timer_id[ index ] ); end_time = benchmark_timer_read(); put_time( "rtems_timer_create: only case", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_CREATE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL ); end_time = benchmark_timer_read(); put_time( "rtems_timer_fire_after: inactive", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_FIRE_AFTER ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL ); end_time = benchmark_timer_read(); put_time( "rtems_timer_fire_after: active", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_FIRE_AFTER ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_cancel( Timer_id[ index ] ); end_time = benchmark_timer_read(); put_time( "rtems_timer_cancel: active", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_CANCEL ); for ( benchmark_timer_initialize(), i=0 ; i<OPERATION_COUNT ; i++ ) benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_cancel( Timer_id[ index ] ); end_time = benchmark_timer_read(); put_time( "rtems_timer_cancel: inactive", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_CANCEL ); for ( benchmark_timer_initialize(), i=0 ; i<OPERATION_COUNT ; i++ ) benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_reset( Timer_id[ index ] ); end_time = benchmark_timer_read(); put_time( "rtems_timer_reset: inactive", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_RESET ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_reset( Timer_id[ index ] ); end_time = benchmark_timer_read(); put_time( "rtems_timer_reset: active", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_RESET ); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_reset( Timer_id[ index ] ); build_time( &time_of_day, 12, 31, 1988, 9, 0, 0, 0 ); status = rtems_clock_set( &time_of_day ); directive_failed( status, "rtems_clock_set" ); time_of_day.year = 1989; benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_fire_when( Timer_id[ index ], &time_of_day, null_delay, NULL ); end_time = benchmark_timer_read(); put_time( "rtems_timer_fire_when: inactive", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_FIRE_WHEN ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_fire_when( Timer_id[ index ], &time_of_day, null_delay, NULL ); end_time = benchmark_timer_read(); put_time( "rtems_timer_fire_when: active", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_FIRE_WHEN ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_delete( Timer_id[ index ] ); end_time = benchmark_timer_read(); put_time( "rtems_timer_delete: active", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_DELETE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { status = rtems_timer_create( index, &Timer_id[ index ] ); directive_failed( status, "rtems_timer_create" ); status = rtems_timer_fire_after( Timer_id[ index ], 500, null_delay, NULL ); directive_failed( status, "rtems_timer_fire_after" ); status = rtems_timer_cancel( Timer_id[ index ] ); directive_failed( status, "rtems_timer_cancel" ); } benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_timer_delete( Timer_id[ index ] ); end_time = benchmark_timer_read(); put_time( "rtems_timer_delete: inactive", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TIMER_DELETE ); benchmark_timer_initialize(); (void) rtems_task_wake_when( &time_of_day ); }
void complete_test( void ) { uint32_t index; rtems_id task_id; ISR_lock_Context lock_context; Thread_queue_Context queue_context; benchmark_timer_initialize(); thread_resume( Middle_tcb ); thread_resume_time = benchmark_timer_read(); _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE ); benchmark_timer_initialize(); _Thread_Unblock( Middle_tcb ); thread_unblock_time = benchmark_timer_read(); _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE ); benchmark_timer_initialize(); _Thread_Clear_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE ); thread_ready_time = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); task_id = Middle_tcb->Object.id; benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { (void) _Thread_Get( task_id, &lock_context ); _ISR_lock_ISR_enable( &lock_context ); } thread_get_time = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { (void) _Semaphore_Get( Semaphore_id, &queue_context ); _ISR_lock_ISR_enable( &queue_context.Lock_context ); } semaphore_get_time = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { (void) _Thread_Get( 0x3, &lock_context ); _ISR_lock_ISR_enable( &lock_context ); } thread_get_invalid_time = benchmark_timer_read(); /* * This is the running task and we have tricked RTEMS out enough where * we need to set some internal tracking information to match this. */ set_thread_heir( _Thread_Get_executing() ); set_thread_dispatch_necessary( false ); /* * Now dump all the times */ put_time( "rtems interrupt: _ISR_Local_disable", isr_disable_time, 1, 0, 0 ); put_time( "rtems interrupt: _ISR_Local_flash", isr_flash_time, 1, 0, 0 ); put_time( "rtems interrupt: _ISR_Local_enable", isr_enable_time, 1, 0, 0 ); put_time( "rtems internal: _Thread_Dispatch_disable", thread_disable_dispatch_time, 1, 0, 0 ); put_time( "rtems internal: _Thread_Dispatch_enable", thread_enable_dispatch_time, 1, 0, 0 ); put_time( "rtems internal: _Thread_Set_state", thread_set_state_time, 1, 0, 0 ); put_time( "rtems internal: _Thread_Dispatch NO FP", thread_dispatch_no_fp_time, 1, 0, 0 ); put_time( "rtems internal: context switch: no floating point contexts", context_switch_no_fp_time, 1, 0, 0 ); put_time( "rtems internal: context switch: self", context_switch_self_time, 1, 0, 0 ); put_time( "rtems internal: context switch to another task", context_switch_another_task_time, 1, 0, 0 ); #if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1) put_time( "rtems internal: fp context switch restore 1st FP task", context_switch_restore_1st_fp_time, 1, 0, 0 ); put_time( "rtems internal: fp context switch save idle and restore initialized", context_switch_save_idle_restore_initted_time, 1, 0, 0 ); put_time( "rtems internal: fp context switch save idle, restore idle", context_switch_save_restore_idle_time, 1, 0, 0 ); put_time( "rtems internal: fp context switch save initialized, restore initialized", context_switch_save_restore_initted_time, 1, 0, 0 ); #else puts( "rtems internal: fp context switch restore 1st FP task - NA\n" "rtems internal: fp context switch save idle restore initialized - NA\n" "rtems internal: fp context switch save idle restore idle - NA\n" "rtems internal: fp context switch save initialized\n" " restore initialized - NA" ); #endif put_time( "rtems internal: _Thread_Resume", thread_resume_time, 1, 0, 0 ); put_time( "rtems internal: _Thread_Unblock", thread_unblock_time, 1, 0, 0 ); put_time( "rtems internal: _Thread_Ready", thread_ready_time, 1, 0, 0 ); put_time( "rtems internal: _Thread_Get", thread_get_time, OPERATION_COUNT, 0, 0 ); put_time( "rtems internal: _Semaphore_Get", semaphore_get_time, OPERATION_COUNT, 0, 0 ); put_time( "rtems internal: _Thread_Get: invalid id", thread_get_invalid_time, OPERATION_COUNT, 0, 0 ); TEST_END(); rtems_test_exit( 0 ); }
rtems_task Test_task ( rtems_task_argument argument ) { rtems_name name; uint32_t index; void *converted; benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); name = rtems_build_name( 'P', 'O', 'R', 'T' ), benchmark_timer_initialize(); rtems_port_create( name, Internal_area, External_area, 0xff, &Port_id ); end_time = benchmark_timer_read(); put_time( "rtems_port_create", end_time, 1, 0, CALLING_OVERHEAD_PORT_CREATE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_port_external_to_internal( Port_id, &External_area[ 0xf ], &converted ); end_time = benchmark_timer_read(); put_time( "rtems_port_external_to_internal", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_port_internal_to_external( Port_id, &Internal_area[ 0xf ], &converted ); end_time = benchmark_timer_read(); put_time( "rtems_port_internal_to_external", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL ); benchmark_timer_initialize(); rtems_port_delete( Port_id ); end_time = benchmark_timer_read(); put_time( "rtems_port_delete", end_time, 1, 0, CALLING_OVERHEAD_PORT_DELETE ); puts( "*** END OF TEST 28 ***" ); rtems_test_exit( 0 ); }
rtems_task test_task( rtems_task_argument argument ) { rtems_status_code status; uint32_t index; rtems_task_priority old_priority; rtems_time_of_day time; uint32_t old_note; uint32_t old_mode; benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) benchmark_timer_empty_function(); overhead = benchmark_timer_read(); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_task_set_priority( Test_task_id, RTEMS_CURRENT_PRIORITY, &old_priority ); end_time = benchmark_timer_read(); put_time( "rtems_task_set_priority: obtain current priority", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TASK_SET_PRIORITY ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_task_set_priority( Test_task_id, RTEMS_MAXIMUM_PRIORITY - 2u, &old_priority ); end_time = benchmark_timer_read(); put_time( "rtems_task_set_priority: returns to caller", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TASK_SET_PRIORITY ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_task_mode( RTEMS_CURRENT_MODE, RTEMS_CURRENT_MODE, &old_mode ); end_time = benchmark_timer_read(); put_time( "rtems_task_mode: obtain current mode", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TASK_MODE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) { (void) rtems_task_mode( RTEMS_INTERRUPT_LEVEL(1), RTEMS_INTERRUPT_MASK, &old_mode ); (void) rtems_task_mode( RTEMS_INTERRUPT_LEVEL(0), RTEMS_INTERRUPT_MASK, &old_mode ); } end_time = benchmark_timer_read(); put_time( "rtems_task_mode: no reschedule", end_time, OPERATION_COUNT * 2, overhead, CALLING_OVERHEAD_TASK_MODE ); benchmark_timer_initialize(); /* must be one host */ (void) rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &old_mode ); end_time = benchmark_timer_read(); put_time( "rtems_task_mode: reschedule returns to caller", end_time, 1, 0, CALLING_OVERHEAD_TASK_MODE ); status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode ); directive_failed( status, "rtems_task_mode" ); status = rtems_task_set_priority( Test_task_id, 1, &old_priority ); directive_failed( status, "rtems_task_set_priority" ); /* preempted by test_task1 */ benchmark_timer_initialize(); (void) rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode ); /** START OF NOTEPAD TESTS **/ /* * We know this is deprecated and don't want a warning on every BSP built. */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_task_set_note( Test_task_id, 8, 10 ); end_time = benchmark_timer_read(); put_time( "rtems_task_set_note: only case", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TASK_SET_NOTE ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_task_get_note( Test_task_id, 8, &old_note ); end_time = benchmark_timer_read(); put_time( "rtems_task_get_note: only case", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_TASK_GET_NOTE ); #pragma GCC diagnostic pop /** END OF NOTEPAD TESTS **/ build_time( &time, 1, 1, 1988, 0, 0, 0, 0 ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_clock_set( &time ); end_time = benchmark_timer_read(); put_time( "rtems_clock_set: only case", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_CLOCK_SET ); benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_clock_get_tod( &time ); end_time = benchmark_timer_read(); put_time( "rtems_clock_get_tod: only case", end_time, OPERATION_COUNT, overhead, CALLING_OVERHEAD_CLOCK_GET ); TEST_END(); rtems_test_exit( 0 ); }