void *Low( void *argument ) { long end_time; end_time = benchmark_timer_read(); put_time( TEST_CASE, end_time, OPERATION_COUNT, 0, 0 ); TEST_END(); rtems_test_exit( 0 ); return NULL; }
void *Low( void *argument ) { long end_time; end_time = benchmark_timer_read(); put_time( "sleep - blocking", end_time, OPERATION_COUNT, 0, 0 ); puts( "*** END OF POSIX TIME TEST PSXTMSLEEP02 ***" ); rtems_test_exit( 0 ); return NULL; }
void benchmark_signal(void) { long end_time; int status; benchmark_timer_initialize(); status = pthread_cond_signal(&CondID); end_time = benchmark_timer_read(); rtems_test_assert( status == 0 ); put_time( "pthread_cond_signal - no threads waiting", end_time, 1, /* Only executed once */ 0, 0 ); }
void *Low( void *argument ) { long end_time; end_time = benchmark_timer_read(); put_time( "@DESC@", end_time, OPERATION_COUNT, 0, 0 ); puts( "*** END OF POSIX TIME TEST @UPPER@ ***" ); rtems_test_exit( 0 ); return NULL; }
void *test_thread( void *argument ) { long end_time; sched_yield(); end_time = benchmark_timer_read(); put_time( "pthread_setschedparam: lower own priority preempt", end_time, 1, /* Only executed once */ 0, 0 ); TEST_END(); rtems_test_exit(0); //Empty thread used in pthread_create(). return NULL; }
rtems_task High_task( rtems_task_argument argument ) { benchmark_timer_initialize(); (void) rtems_task_suspend( RTEMS_SELF ); end_time = benchmark_timer_read(); put_time( "rtems_task_resume: task readied -- preempts caller", end_time, operation_count, 0, CALLING_OVERHEAD_TASK_RESUME ); puts( "*** END OF TEST 5 ***" ); rtems_test_exit( 0 ); }
static void benchmark_mq_receive(void) { benchmark_timer_t end_time; int status; unsigned int priority; int message[MQ_MAXMSG]; priority = 1; /*priority low*/ benchmark_timer_initialize(); status = mq_receive( queue2, ( char *)message, MQ_MSGSIZE, &priority ); end_time = benchmark_timer_read(); rtems_test_assert( status != (-1) ); put_time( "mq_receive: available", end_time, 1, /* Only executed once */ 0, 0 ); }
rtems_task High_task( rtems_task_argument argument ) { benchmark_timer_initialize(); (void) rtems_task_suspend( RTEMS_SELF ); end_time = benchmark_timer_read(); put_time( "rtems_task_resume: task readied preempts caller", end_time, operation_count, 0, 0 ); TEST_END(); rtems_test_exit( 0 ); }
void *Low( void *argument ) { benchmark_timer_t end_time; end_time = benchmark_timer_read(); put_time( "clock_nanosleep: blocking", end_time, OPERATION_COUNT, 0, 0 ); TEST_END(); rtems_test_exit( 0 ); return NULL; }
void benchmark_pthread_getschedparam(void) { uint32_t end_time; int status; int policy; struct sched_param param; benchmark_timer_initialize(); status = pthread_getschedparam( pthread_self(), &policy, ¶m ); end_time = benchmark_timer_read(); rtems_test_assert( status == 0 ); put_time( "pthread_getschedparam: only case", end_time, 1, /* Only executed once */ 0, 0 ); }
void *POSIX_Init( void *argument ) { benchmark_timer_t end_time; struct timespec sleepTime; sleepTime.tv_sec = 0; sleepTime.tv_nsec = 0; TEST_BEGIN(); benchmark_timer_initialize(); nanosleep( &sleepTime, (struct timespec *) NULL ); end_time = benchmark_timer_read(); put_time( "nanosleep: yield", end_time, 1, 0, 0 ); TEST_END(); rtems_test_exit(0); }
static void benchmark_mq_notify(void) { benchmark_timer_t end_time; int status; struct sigevent event; event.sigev_notify = SIGEV_SIGNAL; event.sigev_signo = SIGUSR1; benchmark_timer_initialize(); status = mq_notify( queue2, &event ); end_time = benchmark_timer_read(); rtems_test_assert( status == 0 ); put_time( "mq_notify: only case", end_time, 1, /* Only executed once */ 0, 0 ); }
void *POSIX_Init( void *argument ) { benchmark_timer_t end_time; struct timespec sleepTime; sleepTime.tv_sec = 0; sleepTime.tv_nsec = 0; puts( "\n\n*** POSIX TIME TEST PSXTMNANOSLEEP01 ***" ); benchmark_timer_initialize(); nanosleep( &sleepTime, (struct timespec *) NULL ); end_time = benchmark_timer_read(); put_time( "nanosleep - yield", end_time, 1, 0, 0 ); puts( "*** END OF POSIX TIME TEST PSXTMNANOSLEEP01 ***" ); rtems_test_exit(0); }
rtems_task High_task( rtems_task_argument argument ) { (void) rtems_semaphore_obtain( Semaphore_id, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT ); end_time = benchmark_timer_read(); put_time( "rtems_semaphore_release: " ATTR_DESC " task readied preempts caller", end_time, operation_count - 1, 0, CALLING_OVERHEAD_SEMAPHORE_RELEASE ); TEST_END(); rtems_test_exit( 0 ); }
static void benchmark_mq_timedsend(void) { benchmark_timer_t end_time; int status; struct timespec timeout; status = 5; timeout.tv_sec = 0; timeout.tv_nsec = 1; benchmark_timer_initialize(); status = mq_timedsend( queue, (const char *)&status, MQ_MSGSIZE, 1, &timeout); end_time = benchmark_timer_read(); rtems_test_assert( status != (-1) ); put_time( "mq_timedsend: no threads waiting", end_time, 1, /* Only executed once */ 0, 0 ); }
static void benchmark_mq_open_second(int printable) { benchmark_timer_t end_time; struct mq_attr attr; attr.mq_maxmsg = MQ_MAXMSG; attr.mq_msgsize = MQ_MSGSIZE; benchmark_timer_initialize(); queue2 =mq_open( q_name, O_RDONLY | O_CREAT , 0x777, &attr); end_time = benchmark_timer_read(); rtems_test_assert( queue2 != (-1) ); if (printable == 1) put_time( "mq_open: second open", end_time, 1, /* Only executed once */ 0, 0 ); }
rtems_task Task02( rtems_task_argument ignored ) { /* Find overhead of task switch back to TA01 (not a preemption) */ benchmark_timer_initialize(); rtems_task_suspend( RTEMS_SELF ); /* Benchmark code */ for ( ; count1 < BENCHMARKS - 1; ) { rtems_task_suspend( RTEMS_SELF ); } telapsed = benchmark_timer_read(); put_time( "Rhealstone: Task Preempt", telapsed, /* Total time of all benchmarks */ BENCHMARKS - 1, /* BENCHMARKS - 1 total preemptions */ tloop_overhead, /* Overhead of loops */ tswitch_overhead /* Overhead of task switch back to TA01 */ ); TEST_END(); rtems_test_exit( 0 ); }
void *Blocker( void *argument ) { benchmark_timer_t end_time; /* block on barrier wait, switch back to first thread */ (void) pthread_barrier_wait( &barrier ); /* preempt first thread and stop time */ end_time = benchmark_timer_read(); put_time( "pthread_barrier_wait: releasing preempt", end_time, 1, 0, 0 ); TEST_END(); rtems_test_exit( 0 ); }
rtems_task High_task( rtems_task_argument argument ) { rtems_interrupt_level level; _Thread_Dispatch_disable(); benchmark_timer_initialize(); rtems_interrupt_local_disable( level ); isr_disable_time = benchmark_timer_read(); benchmark_timer_initialize(); #if defined(RTEMS_SMP) rtems_interrupt_local_enable( level ); rtems_interrupt_local_disable( level ); #else rtems_interrupt_flash( level ); #endif isr_flash_time = benchmark_timer_read(); benchmark_timer_initialize(); rtems_interrupt_local_enable( level ); isr_enable_time = benchmark_timer_read(); _Thread_Dispatch_enable( _Per_CPU_Get() ); benchmark_timer_initialize(); _Thread_Dispatch_disable(); thread_disable_dispatch_time = benchmark_timer_read(); benchmark_timer_initialize(); _Thread_Dispatch_enable( _Per_CPU_Get() ); thread_enable_dispatch_time = benchmark_timer_read(); benchmark_timer_initialize(); _Thread_Set_state( _Thread_Get_executing(), STATES_SUSPENDED ); thread_set_state_time = benchmark_timer_read(); set_thread_dispatch_necessary( true ); benchmark_timer_initialize(); _Thread_Dispatch(); /* dispatches Middle_task */ }
void *test_thread( void *argument ) { uint32_t end_time; /* switch to POSIX_Init */ sched_yield(); end_time = benchmark_timer_read(); put_time( "pthread_setschedparam: raise other priority preempt", end_time, 1, /* Only executed once */ 0, 0 ); TEST_END(); rtems_test_exit(0); //Empty thread used in pthread_create(). return NULL; }
void *test_thread( void *argument ) { long end_time; /* switch to POSIX_Init */ sched_yield(); end_time = benchmark_timer_read(); put_time( "pthread_setschedparam: raise other priority preempt", end_time, 1, /* Only executed once */ 0, 0 ); puts( "*** END OF POSIX TIME TEST PSXTMTHREAD06 ***" ); rtems_test_exit(0); //Empty thread used in pthread_create(). return NULL; }
void *Low( void *argument ) { int status; uint32_t end_time; status = sem_wait(&sem1); /* semaphore blocks */ end_time = benchmark_timer_read(); rtems_test_assert( status == 0 ); put_time( "sem_post - thread waiting, preempt", end_time, OPERATION_COUNT, 0, 0 ); puts( "*** END OF POSIX TIME TEST PSXTMSEM05 ***" ); rtems_test_exit( 0 ); return NULL; }
void *POSIX_Init( void *argument ) { benchmark_timer_t end_time; TEST_BEGIN(); benchmark_timer_initialize(); sleep(0); end_time = benchmark_timer_read(); put_time( "sleep: yield", end_time, 1, 0, 0 ); TEST_END(); rtems_test_exit(0); }
void *Low( void *argument ) { int status; benchmark_timer_t end_time; status = pthread_mutex_lock( &MutexId ); end_time = benchmark_timer_read(); rtems_test_assert( status == 0 ); put_time( "pthread_mutex_unlock: unblocking preempt", end_time, OPERATION_COUNT, 0, 0 ); TEST_END(); rtems_test_exit( 0 ); return NULL; }
void *Low( void *argument ) { int status; uint32_t end_time; status = 0; /* XXX blocking operation goes here */ end_time = benchmark_timer_read(); rtems_test_assert( status == 0 ); put_time( "@DESC@", end_time, OPERATION_COUNT, 0, 0 ); puts( "*** END OF POSIX TIME TEST @UPPER@ ***" ); rtems_test_exit( 0 ); return NULL; }
rtems_task High_task( rtems_task_argument argument ) { rtems_interrupt_level level; _Thread_Disable_dispatch(); benchmark_timer_initialize(); rtems_interrupt_disable( level ); isr_disable_time = benchmark_timer_read(); benchmark_timer_initialize(); rtems_interrupt_flash( level ); isr_flash_time = benchmark_timer_read(); benchmark_timer_initialize(); rtems_interrupt_enable( level ); isr_enable_time = benchmark_timer_read(); _Thread_Enable_dispatch(); benchmark_timer_initialize(); _Thread_Disable_dispatch(); thread_disable_dispatch_time = benchmark_timer_read(); benchmark_timer_initialize(); _Thread_Enable_dispatch(); thread_enable_dispatch_time = benchmark_timer_read(); benchmark_timer_initialize(); thread_set_state( _Thread_Get_executing(), STATES_SUSPENDED ); thread_set_state_time = benchmark_timer_read(); set_thread_dispatch_necessary( true ); benchmark_timer_initialize(); _Thread_Dispatch(); /* dispatches Middle_task */ }
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 ); }
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 Task_1( rtems_task_argument argument ) { rtems_name name RTEMS_GCC_NOWARN_UNUSED; uint32_t index RTEMS_GCC_NOWARN_UNUSED; rtems_id id RTEMS_GCC_NOWARN_UNUSED; rtems_task_priority in_priority RTEMS_GCC_NOWARN_UNUSED; rtems_task_priority out_priority RTEMS_GCC_NOWARN_UNUSED; rtems_mode in_mode RTEMS_GCC_NOWARN_UNUSED; rtems_mode mask RTEMS_GCC_NOWARN_UNUSED; rtems_mode out_mode RTEMS_GCC_NOWARN_UNUSED; rtems_time_of_day time RTEMS_GCC_NOWARN_UNUSED; rtems_interval timeout RTEMS_GCC_NOWARN_UNUSED; rtems_signal_set signals RTEMS_GCC_NOWARN_UNUSED; void *address_1 RTEMS_GCC_NOWARN_UNUSED; rtems_event_set events RTEMS_GCC_NOWARN_UNUSED; long buffer[ 4 ] RTEMS_GCC_NOWARN_UNUSED; uint32_t count RTEMS_GCC_NOWARN_UNUSED; rtems_device_major_number major RTEMS_GCC_NOWARN_UNUSED; rtems_device_minor_number minor RTEMS_GCC_NOWARN_UNUSED; uint32_t io_result RTEMS_GCC_NOWARN_UNUSED; uint32_t error RTEMS_GCC_NOWARN_UNUSED; rtems_clock_get_options options RTEMS_GCC_NOWARN_UNUSED; name = rtems_build_name( 'N', 'A', 'M', 'E' ); in_priority = 250; in_mode = RTEMS_NO_PREEMPT; mask = RTEMS_PREEMPT_MASK; timeout = 100; signals = RTEMS_SIGNAL_1 | RTEMS_SIGNAL_3; major = 10; minor = 0; error = 100; options = 0; /* rtems_shutdown_executive */ benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_shutdown_executive( error ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_shutdown_executive", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_create( name, in_priority, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_ident( name, RTEMS_SEARCH_ALL_NODES, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_start */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_start( id, Task_1, 0 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_start", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_restart */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_restart( id, 0 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_restart", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_suspend */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_suspend( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_suspend", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_resume */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_resume( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_resume", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_set_priority */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_set_priority( id, in_priority, &out_priority ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_set_priority", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_mode */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_mode( in_mode, mask, &out_mode ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_mode", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_wake_when */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_wake_when( time ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_wake_when", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_wake_after */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_wake_after( timeout ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_wake_after", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_interrupt_catch */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_interrupt_catch( Isr_handler, 5, address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_interrupt_catch", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_clock_get */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_clock_get( options, time ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_clock_get", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_clock_set */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_clock_set( time ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_clock_set", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_clock_tick */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_clock_tick(); end_time = benchmark_timer_read(); put_time( "overhead: rtems_clock_tick", end_time, OPERATION_COUNT, overhead, 0 ); rtems_test_pause(); /* rtems_timer_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_create( name, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_ident( name, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_fire_after */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_fire_after( id, timeout, Timer_handler, NULL ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_fire_after", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_fire_when */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_fire_when( id, time, Timer_handler, NULL ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_fire_when", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_reset */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_reset( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_reset", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_cancel */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_cancel( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_cancel", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_semaphore_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_semaphore_create( name, 128, RTEMS_DEFAULT_ATTRIBUTES, RTEMS_NO_PRIORITY, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_semaphore_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_semaphore_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_semaphore_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_semaphore_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_semaphore_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_semaphore_ident( name, RTEMS_SEARCH_ALL_NODES, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_semaphore_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_semaphore_obtain */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_semaphore_obtain( id, RTEMS_DEFAULT_OPTIONS, timeout ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_semaphore_obtain", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_semaphore_release */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_semaphore_release( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_semaphore_release", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_create( name, 128, RTEMS_DEFAULT_ATTRIBUTES, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_ident( name, RTEMS_SEARCH_ALL_NODES, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_send */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_send( id, (long (*)[4])buffer ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_send", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_urgent */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_urgent( id, (long (*)[4])buffer ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_urgent", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_broadcast */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_broadcast( id, (long (*)[4])buffer, &count ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_broadcast", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_receive */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_receive( id, (long (*)[4])buffer, RTEMS_DEFAULT_OPTIONS, timeout ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_receive", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_flush */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_flush( id, &count ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_flush", end_time, OPERATION_COUNT, overhead, 0 ); rtems_test_pause(); /* rtems_event_send */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_event_send( id, events ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_event_send", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_event_receive */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_event_receive( RTEMS_EVENT_16, RTEMS_DEFAULT_OPTIONS, timeout, &events ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_event_receive", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_signal_catch */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_signal_catch( Asr_handler, RTEMS_DEFAULT_MODES ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_signal_catch", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_signal_send */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_signal_send( id, signals ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_signal_send", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_partition_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_partition_create( name, Memory_area, 2048, 128, RTEMS_DEFAULT_ATTRIBUTES, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_partition_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_partition_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_partition_ident( name, RTEMS_SEARCH_ALL_NODES, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_partition_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_partition_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_partition_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_partition_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_partition_get_buffer */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_partition_get_buffer( id, address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_partition_get_buffer", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_partition_return_buffer */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_partition_return_buffer( id, address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_partition_return_buffer", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_region_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_region_create( name, Memory_area, 2048, 128, RTEMS_DEFAULT_ATTRIBUTES, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_region_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_region_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_region_ident( name, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_region_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_region_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_region_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_region_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_region_get_segment */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_region_get_segment( id, 243, RTEMS_DEFAULT_OPTIONS, timeout, &address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_region_get_segment", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_region_return_segment */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_region_return_segment( id, address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_region_return_segment", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_port_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_port_create( name, Internal_port_area, External_port_area, 0xff, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_port_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_port_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_port_ident( name, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_port_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_port_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_port_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_port_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_port_external_to_internal */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_port_external_to_internal( id, &External_port_area[ 7 ], address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_port_external_to_internal", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_port_internal_to_external */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_port_internal_to_external( id, &Internal_port_area[ 7 ], address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_port_internal_to_external", end_time, OPERATION_COUNT, overhead, 0 ); rtems_test_pause(); /* rtems_io_initialize */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_initialize( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_initialize", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_io_open */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_open( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_open", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_io_close */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_close( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_close", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_io_read */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_read( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_read", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_io_write */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_write( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_write", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_io_control */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_control( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_control", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_fatal_error_occurred */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_fatal_error_occurred( error ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_fatal_error_occurred", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_rate_monotonic_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_rate_monotonic_create( name, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_rate_monotonic_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_rate_monotonic_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_rate_monotonic_ident( name, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_rate_monotonic_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_rate_monotonic_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_rate_monotonic_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_rate_monotonic_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_rate_monotonic_cancel */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_rate_monotonic_cancel( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_rate_monotonic_cancel", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_rate_monotonic_period */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_rate_monotonic_period( id, timeout ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_rate_monotonic_period", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_multiprocessing_announce */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_multiprocessing_announce(); end_time = benchmark_timer_read(); put_time( "overhead: rtems_multiprocessing_announce", end_time, OPERATION_COUNT, overhead, 0 ); TEST_END(); 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 ); }