コード例 #1
0
rtems_task Middle_task(
  rtems_task_argument argument
)
{
  thread_dispatch_no_fp_time = benchmark_timer_read();

  _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED );

  Middle_tcb   = _Thread_Executing;

  _Thread_Executing =
        (Thread_Control *) _Thread_Ready_chain[LOW_PRIORITY].first;

  /* do not force context switch */

  _Context_Switch_necessary = false;

  _Thread_Disable_dispatch();

  benchmark_timer_initialize();
    _Context_Switch( &Middle_tcb->Registers, &_Thread_Executing->Registers );

  benchmark_timer_initialize();
    _Context_Switch(&Middle_tcb->Registers, &Low_tcb->Registers);
}
コード例 #2
0
ファイル: task1.c プロジェクト: gedare/rtems
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 );
}
コード例 #3
0
ファイル: tmtests_support.c プロジェクト: AlexShiLucky/rtems
void rtems_time_test_measure_operation(
  const char               *description,
  rtems_time_test_method_t  operation,
  void                     *argument,
  int                       iterations,
  int                       overhead
)
{
  int  i;
  uint32_t loop_overhead;
  uint32_t end_time;

  benchmark_timer_initialize();
    for (i=0 ; i<iterations ; i++ ) {
      benchmark_timer_empty_operation( i, argument );
    }
  loop_overhead = benchmark_timer_read();

  benchmark_timer_initialize();
    for (i=0 ; i<iterations ; i++ ) {
      (*operation)( i, argument );
    }
  end_time = benchmark_timer_read();

  put_time(
    description,
    end_time,
    iterations,
    loop_overhead,
    overhead
  );
}
コード例 #4
0
ファイル: task1.c プロジェクト: Avanznow/rtems
void Isr_handler_inner( void )
{

  /*enable_tracing();*/
  Clear_tm27_intr();
  switch ( Interrupt_nest ) {
    case 0:
      Interrupt_enter_time = end_time;
      break;
    case 1:
      Interrupt_enter_time = end_time;
      Interrupt_nest = 2;
      Interrupt_occurred = 0;
      Lower_tm27_intr();
      benchmark_timer_initialize();
      Cause_tm27_intr();
      /* goes to a nested copy of Isr_handler */
#if (MUST_WAIT_FOR_INTERRUPT == 1)
       while ( Interrupt_occurred == 0 );
#endif
      Interrupt_return_nested_time = benchmark_timer_read();
      break;
    case 2:
      Interrupt_enter_nested_time = end_time;
      break;
  }

  benchmark_timer_initialize();
}
コード例 #5
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_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 );
}
コード例 #6
0
rtems_task Middle_task(
  rtems_task_argument argument
)
{
  Chain_Control   *ready_queues;

  thread_dispatch_no_fp_time = benchmark_timer_read();

  _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED );

  Middle_tcb   = _Thread_Executing;

  ready_queues      = (Chain_Control *) _Scheduler.information;
  _Thread_Executing =
        (Thread_Control *) _Chain_First(&ready_queues[LOW_PRIORITY]);

  /* do not force context switch */

  _Thread_Dispatch_necessary = false;

  _Thread_Disable_dispatch();

  benchmark_timer_initialize();
    _Context_Switch( &Middle_tcb->Registers, &_Thread_Executing->Registers );

  benchmark_timer_initialize();
    _Context_Switch(&Middle_tcb->Registers, &Low_tcb->Registers);
}
コード例 #7
0
ファイル: task1.c プロジェクト: greenmeent/rtems
rtems_task Middle_task(
  rtems_task_argument argument
)
{
  Scheduler_priority_Context *scheduler_context =
    _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );

  thread_dispatch_no_fp_time = benchmark_timer_read();

  _Thread_Set_state( _Thread_Get_executing(), STATES_SUSPENDED );

  Middle_tcb   = _Thread_Get_executing();

  set_thread_executing(
    (Thread_Control *) _Chain_First(&scheduler_context->Ready[LOW_PRIORITY])
  );

  /* do not force context switch */

  set_thread_dispatch_necessary( false );

  _Thread_Dispatch_disable();

  benchmark_timer_initialize();
    _Context_Switch(
      &Middle_tcb->Registers,
      &_Thread_Get_executing()->Registers
    );

  benchmark_timer_initialize();
    _Context_Switch(&Middle_tcb->Registers, &Low_tcb->Registers);
}
コード例 #8
0
ファイル: task1.c プロジェクト: Avanznow/rtems
rtems_task Init(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  Print_Warning();

  TEST_BEGIN();

  if (
    _Scheduler_Table[ 0 ].Operations.initialize
      != _Scheduler_priority_Initialize
  ) {
    puts("  Error ==> " );
    puts("Test only supported for deterministic priority scheduler\n" );
    TEST_END();
    rtems_test_exit( 0 );
  }

#define LOW_PRIORITY (RTEMS_MAXIMUM_PRIORITY - 1u)
  status = rtems_task_create(
    rtems_build_name( 'T', 'A', '1', ' ' ),
    LOW_PRIORITY,
    RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES,
    &Task_id[ 1 ]
  );
  directive_failed( status, "rtems_task_create Task_1" );

  status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
  directive_failed( status, "rtems_task_start Task_1" );

  status = rtems_task_create(
    rtems_build_name( 'T', 'A', '2', ' ' ),
    LOW_PRIORITY,
    RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES,
    &Task_id[ 2 ]
  );
  directive_failed( status, "rtems_task_create of Task_2" );

  status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
  directive_failed( status, "rtems_task_start of Task_2" );

  benchmark_timer_initialize();
  benchmark_timer_read();
  benchmark_timer_initialize();
  timer_overhead = benchmark_timer_read();

  status = rtems_task_delete( RTEMS_SELF );
  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}
コード例 #9
0
ファイル: task1.c プロジェクト: greenmeent/rtems
rtems_task Floating_point_task_1(
  rtems_task_argument argument
)
{
  Scheduler_priority_Context *scheduler_context =
    _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
  Thread_Control             *executing;
  FP_DECLARE;

  context_switch_restore_1st_fp_time = benchmark_timer_read();

  executing = _Thread_Get_executing();

  set_thread_executing(
    (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP2_PRIORITY])
  );

  /* do not force context switch */

  set_thread_dispatch_necessary( false );

  _Thread_Dispatch_disable();

  benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
    _Context_Save_fp( &executing->fp_context );
    _Context_Restore_fp( &_Thread_Get_executing()->fp_context );
#endif
    _Context_Switch(
      &executing->Registers,
      &_Thread_Get_executing()->Registers
    );
  /* switch to Floating_point_task_2 */

  context_switch_save_idle_restore_initted_time = benchmark_timer_read();

  FP_LOAD( 1.0 );

  executing = _Thread_Get_executing();

  set_thread_executing(
    (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP2_PRIORITY])
  );

  benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
    _Context_Save_fp( &executing->fp_context );
    _Context_Restore_fp( &_Thread_Get_executing()->fp_context );
#endif
    _Context_Switch(
      &executing->Registers,
      &_Thread_Get_executing()->Registers
    );
  /* switch to Floating_point_task_2 */
}
コード例 #10
0
rtems_task Floating_point_task_1(
  rtems_task_argument argument
)
{
  Chain_Control   *ready_queues;
  Thread_Control  *executing;
  FP_DECLARE;

  context_switch_restore_1st_fp_time = benchmark_timer_read();

  executing = _Thread_Executing;

  ready_queues      = (Chain_Control *) _Scheduler.information;
  _Thread_Executing =
        (Thread_Control *) _Chain_First(&ready_queues[FP2_PRIORITY]);

  /* do not force context switch */

  _Thread_Dispatch_necessary = false;

  _Thread_Disable_dispatch();

  benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
    _Context_Save_fp( &executing->fp_context );
    _Context_Restore_fp( &_Thread_Executing->fp_context );
#endif
    _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
  /* switch to Floating_point_task_2 */

  context_switch_save_idle_restore_initted_time = benchmark_timer_read();

  FP_LOAD( 1.0 );

  executing = _Thread_Executing;

  ready_queues      = (Chain_Control *) _Scheduler.information;
  _Thread_Executing =
        (Thread_Control *) _Chain_First(&ready_queues[FP2_PRIORITY]);

  /* do not force context switch */

  _Thread_Dispatch_necessary = false;

  _Thread_Disable_dispatch();

  benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
    _Context_Save_fp( &executing->fp_context );
    _Context_Restore_fp( &_Thread_Executing->fp_context );
#endif
    _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
  /* switch to Floating_point_task_2 */
}
コード例 #11
0
rtems_task Task_1(
  rtems_task_argument argument
)
{
  rtems_status_code status;

  benchmark_timer_initialize();
    (void) rtems_signal_catch( Process_asr_for_pass_1, RTEMS_DEFAULT_MODES );
  end_time = benchmark_timer_read();

  put_time(
    "rtems_signal_catch",
    end_time,
    1,
    0,
    CALLING_OVERHEAD_SIGNAL_CATCH
  );

  benchmark_timer_initialize();
    rtems_signal_send( Task_id[ 2 ], 1 );
  end_time = benchmark_timer_read();

  put_time(
    "rtems_signal_send: returns to caller",
    end_time,
    1,
    0,
    CALLING_OVERHEAD_SIGNAL_SEND
  );

  benchmark_timer_initialize();
    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );

  /* end time is done is RTEMS_ASR */

  end_time = benchmark_timer_read();

  put_time(
    "exit ASR overhead: returns to calling task",
    end_time,
    1,
    0,
    0
  );

  status = rtems_signal_catch( Process_asr_for_pass_2, RTEMS_NO_PREEMPT );
  directive_failed( status, "rtems_signal_catch" );

  benchmark_timer_initialize();
    (void) rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 );
}
コード例 #12
0
rtems_task Floating_point_task_2(
  rtems_task_argument argument
)
{
  Thread_Control *executing;
  FP_DECLARE;

  context_switch_save_restore_idle_time = benchmark_timer_read();

  executing = _Thread_Executing;

  _Thread_Executing =
       (Thread_Control *) _Thread_Ready_chain[FP1_PRIORITY].first;

  FP_LOAD( 1.0 );

  /* do not force context switch */

  _Context_Switch_necessary = false;

  _Thread_Disable_dispatch();

  benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
    _Context_Save_fp( &executing->fp_context );
    _Context_Restore_fp( &_Thread_Executing->fp_context );
#endif
    _Context_Switch( &executing->Registers, &_Thread_Executing->Registers );
  /* switch to Floating_point_task_1 */

  context_switch_save_restore_initted_time = benchmark_timer_read();

  complete_test();
}
コード例 #13
0
ファイル: init.c プロジェクト: cloud-hot/rtems
static void benchmark_mq_timedreceive(void)
{
  benchmark_timer_t end_time;
  int              status;
  unsigned int     priority;
  struct timespec  timeout;
  int              message[MQ_MAXMSG];

  priority = 1;       /*priority low*/
  timeout.tv_sec  = 0;
  timeout.tv_nsec = 0;
  benchmark_timer_initialize();
    status = mq_timedreceive(
		  queue2, ( char *)message, MQ_MSGSIZE, &priority, &timeout);
  end_time = benchmark_timer_read();
  rtems_test_assert( status != (-1) );

  put_time(
    "mq_timedreceive: available",
    end_time,
    1,        /* Only executed once */
    0,
    0
  );
}
コード例 #14
0
ファイル: init.c プロジェクト: gedare/rtems
void *POSIX_Init(
  void *argument
)
{
  int        i;
  int        status;
  pthread_t  threadId;

  TEST_BEGIN();

  for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) {
    status = pthread_create( &threadId, NULL, Middle, NULL );
    rtems_test_assert( !status );
  }
  
  status = pthread_create( &threadId, NULL, Low, NULL );
  rtems_test_assert( !status );

  /*
   * Let the other threads start so the thread startup overhead,
   * is accounted for.  When we return, we can start the benchmark.
   */
  sched_yield();
    /* let other threads run */

  /* start the timer and switch through all the other tasks */
  benchmark_timer_initialize();
  pthread_exit( NULL );
  return NULL;
}
コード例 #15
0
rtems_task High_task(
    rtems_task_argument argument
)
{
    uint32_t    count;
    rtems_status_code status;

    benchmark_timer_initialize();
    (void) rtems_message_queue_broadcast(
        Queue_id,
        Buffer,
        MESSAGE_SIZE,
        &count
    );
    end_time = benchmark_timer_read();

    put_time(
        "rtems_message_queue_broadcast: task readied -- returns to caller",
        end_time,
        1,
        0,
        CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST
    );

    status = rtems_task_suspend(RTEMS_SELF);
    directive_failed( status, "rtems_task_suspend" );
}
コード例 #16
0
ファイル: init.c プロジェクト: 0871087123/rtems
static void benchmark_pthread_barrier_init(void)
{
  benchmark_timer_t end_time;
  int                   status;
  pthread_barrierattr_t attr;

  /* initialize attr with default attributes
   * for all of the attributes defined by the implementation
   */
  status = pthread_barrierattr_init( &attr );
  rtems_test_assert( status == 0 );

  benchmark_timer_initialize();
    status = pthread_barrier_init( &barrier,&attr, 1 );
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );

  put_time(
    "pthread_barrier_init",
    end_time,
    1,        /* Only executed once */
    0,
    0
  );
}
コード例 #17
0
ファイル: semshuffle.c プロジェクト: AlexShiLucky/rtems
rtems_task Task02( rtems_task_argument ignored )
{

  /* Benchmark code */
  benchmark_timer_initialize();
  for ( count = 0; count < BENCHMARKS; count++ ) {
    if ( sem_exe == 1 ) {
      rtems_semaphore_obtain( sem_id, RTEMS_WAIT, 0 );
    }
    rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );

    if ( sem_exe == 1 ) {
      rtems_semaphore_release( sem_id );
    }
    rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
  }
  telapsed = benchmark_timer_read();

  /* Check which run this was */
  if (sem_exe == 0) {
    tswitch_overhead = telapsed;
    rtems_task_suspend( Task_id[0] );
    rtems_task_suspend( RTEMS_SELF );
  } else {
    put_time(
       "Rhealstone: Semaphore Shuffle",
       telapsed,
       (BENCHMARKS * 2),        /* Total number of semaphore-shuffles*/
       tswitch_overhead,        /* Overhead of loop and task switches */
       0
    );
    TEST_END();
    rtems_test_exit( 0 );
  }
}
コード例 #18
0
ファイル: init.c プロジェクト: Fyleo/rtems
void *POSIX_Init(
  void *argument
)
{
  int        status;
  pthread_t  threadId;
  int policy;
  struct sched_param param;

  TEST_BEGIN();

  status = pthread_create( &threadId, NULL, Blocker, NULL );
  rtems_test_assert( status == 0 );
  status = pthread_barrier_init( &barrier, NULL, N );
  rtems_test_assert( status == 0 );

  /* yield to second thread so it can start up and block */
  sched_yield();

  pthread_getschedparam(threadId, &policy, &param);
  param.sched_priority = sched_get_priority_max(policy) - 1;
  /* preempt doesn't occur here due to second thread being blocked */
  pthread_setschedparam(threadId, policy, &param);

  /* as soon as this thread waits on barrier, release occurs, 2nd thread
   * preempts this one due to having a higher priority
   */
  benchmark_timer_initialize();
  status = pthread_barrier_wait( &barrier );

  /* avoid warning but should not be executed */
  return NULL;
}
コード例 #19
0
void *POSIX_Init(
    void *argument
)
{
    int        i;
    int        status;
    pthread_t  threadId;
    struct timespec sleepTime;
    struct timespec remainder;

    sleepTime.tv_sec = 0;
    sleepTime.tv_nsec = 1;
    remainder.tv_sec = 0;
    remainder.tv_nsec = 0;

    puts( "\n\n*** POSIX TIME TEST PSXTMNANOSLEEP02 ***" );

    for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) {
        status = pthread_create( &threadId, NULL, Middle, NULL );
        rtems_test_assert( !status );
    }

    status = pthread_create( &threadId, NULL, Low, NULL );
    rtems_test_assert( !status );

    /* start the timer and switch through all the other tasks */
    benchmark_timer_initialize();
    /* calling nanosleep*/
    nanosleep(&sleepTime, &remainder);

    return NULL;
}
コード例 #20
0
ファイル: init.c プロジェクト: mcspic/rtems
void *POSIX_Init(
  void *argument
)
{
  int        status;
  pthread_t  threadId;

  TEST_BEGIN();

  status = pthread_create( &threadId, NULL, Blocker, NULL );
  rtems_test_assert( status == 0 );
  
  status = pthread_mutex_init(&MutexID, NULL);
  rtems_test_assert( status == 0 );

  status = pthread_cond_init(&CondID, NULL); /* Create condition variable */
  rtems_test_assert( status == 0 );

  /*
   * Let the other thread start so the thread startup overhead,
   * is accounted for.  When we return, we can start the benchmark.
   */
  sched_yield();
  /* let other thread run */

  /* Other thread is blocked and waiting on condition to be signaled */
  benchmark_timer_initialize();
  status = pthread_cond_signal(&CondID);
  rtems_test_assert ( status == 0 );
  return NULL;
}
コード例 #21
0
rtems_task Tasks(
  rtems_task_argument argument
)
{
  rtems_id          id;
  rtems_status_code status;

  status = rtems_rate_monotonic_create( 1, &id );
  directive_failed( status, "rtems_rate_monotonic_create" );

  status = rtems_rate_monotonic_period( id, 100 );
  directive_failed( status, "rtems_rate_monotonic_period" );

  /*
   *  Give up the processor to allow all tasks to actually
   *  create and start their period timer before the benchmark
   *  timer is initialized.
   */

  (void) rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );

  Task_count++;

  if ( Task_count == 1 )
    benchmark_timer_initialize();

  (void) rtems_rate_monotonic_period( id, 100 );
}
コード例 #22
0
ファイル: init.c プロジェクト: gedare/rtems
void *POSIX_Init(
  void *argument
)
{
  int        i;
  int        status;
  pthread_t  threadId;
  struct timespec sleepTime;
  struct timespec remainder;

  sleepTime.tv_sec = 0;
  sleepTime.tv_nsec = 1;
  remainder.tv_sec = 0;
  remainder.tv_nsec = 0;

  TEST_BEGIN();

  for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) {
    status = pthread_create( &threadId, NULL, Middle, NULL );
    rtems_test_assert( !status );
  }

  status = pthread_create( &threadId, NULL, Low, NULL );
  rtems_test_assert( !status );

  /* start the timer and switch through all the other tasks */
  benchmark_timer_initialize();
  /* calling clock_nanosleep*/
  clock_nanosleep(CLOCK_REALTIME, 0, &sleepTime, &remainder);

  return NULL;
}
コード例 #23
0
ファイル: init.c プロジェクト: AlexShiLucky/rtems
void benchmark_pthread_setschedparam(void)
{
  uint32_t            end_time;
  int                 status;
  int                 policy;
  struct sched_param  param;

  status = pthread_getschedparam( pthread_self(), &policy, &param );
  rtems_test_assert( status == 0 );
  
  /* Arbitrary priority, no other threads to preempt us so it doesn't matter. */
  param.sched_priority = 5;
  benchmark_timer_initialize();
  status = pthread_setschedparam( pthread_self(), policy, &param );
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );

  put_time(
     "pthread_setschedparam: no thread switch",
     end_time,
     1,       /* Only executed once */
     0,
     0
  ); 
}
コード例 #24
0
void check_read_timer()
{
  uint32_t   index;
  uint32_t   time;

  for ( index = 1 ; index <= MAXIMUM_DISTRIBUTION ; index++ )
    Distribution[ index ] = 0;

  for ( index = 1 ; index <= OPERATION_COUNT ; ) {
    benchmark_timer_initialize();
    end_time = benchmark_timer_read();
    if ( end_time > MAXIMUM_DISTRIBUTION ) {
      /*
       *  Under UNIX a simple process swap takes longer than we
       *  consider valid for our testing purposes.
       */
      printf( "TOO LONG (%" PRIu32 ") at index %" PRIu32 "!!!\n", end_time, index );
      continue;
    }
    Distribution[ end_time ]++;
    index++;
  }

  printf( "Units may not be in microseconds for this test!!!\n" );
  time = 0;
  for ( index = 0 ; index <= MAXIMUM_DISTRIBUTION ; index++ ) {
    time += (Distribution[ index ] * index);
    if ( Distribution[ index ] != 0 )
      printf( "%" PRId32 " %" PRId32 "\n", index, Distribution[ index ] );
  }
  printf( "Total time = %" PRId32 "\n", time );
  printf( "Average time = %" PRId32 "\n", time / OPERATION_COUNT );
}
コード例 #25
0
rtems_task First_task(
  rtems_task_argument argument
)
{
  benchmark_timer_initialize();

  (void) rtems_task_delete( RTEMS_SELF );
}
コード例 #26
0
rtems_task High_task(
  rtems_task_argument argument
)
{
  rtems_interrupt_level level;

  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();

  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_Executing, STATES_SUSPENDED );
  thread_set_state_time = benchmark_timer_read();

  _Context_Switch_necessary = true;

  benchmark_timer_initialize();
    _Thread_Dispatch();           /* dispatches Middle_task */
}
コード例 #27
0
rtems_task Low_task(
  rtems_task_argument argument
)
{
  task_index = 1;

  benchmark_timer_initialize();
  (void) rtems_task_restart( Task_id[ task_index ], 0xffffffff );
}
コード例 #28
0
ファイル: init.c プロジェクト: Fyleo/rtems
void *POSIX_Init(
  void *argument
)
{
  int                   status;
  pthread_t             threadId;
  benchmark_timer_t end_time;
  pthread_rwlockattr_t  attr;

  TEST_BEGIN();

  status = pthread_create( &threadId, NULL, Blocker, NULL );
  rtems_test_assert( status == 0 );
  /*
   * Deliberately create the rwlock after the threads.  This way if the
   * threads do run before we intend, they will get an error.
   */

  /* creating rwlock */
    status = pthread_rwlockattr_init( &attr );
  rtems_test_assert( status == 0 );
  status = pthread_rwlock_init( &rwlock, &attr );
  rtems_test_assert( status == 0 );

  /*
   * Ensure the rwlock is unavailable so the other threads block.
   */
  /* lock rwlock to ensure thread blocks */
  status = pthread_rwlock_wrlock(&rwlock);
  rtems_test_assert( status == 0 );

  /*
   * Let the other thread start so the thread startup overhead,
   * is accounted for.  When we return, we can start the benchmark.
   */
  sched_yield();
    /* let other thread run */

  benchmark_timer_initialize();
    status = pthread_rwlock_unlock(&rwlock); /*  unlock the rwlock */
  end_time = benchmark_timer_read();
  rtems_test_assert( status == 0 );

  put_time(
    "pthread_rwlock_unlock: thread waiting no preempt",
    end_time,
    1,
    0,
    0
  );

  TEST_END();
  rtems_test_exit( 0 );

  return NULL;
}
コード例 #29
0
ファイル: task1.c プロジェクト: AlexShiLucky/rtems
rtems_task test_init(
  rtems_task_argument argument
)
{
  rtems_status_code   status;
  int                 index;
  rtems_id            task_id;
  rtems_task_priority priority;

  priority = RTEMS_MAXIMUM_PRIORITY - 2u;

  status = rtems_semaphore_create(
    rtems_build_name( 'S', 'M', '1', '\0'),
    0,
    SEMAPHORE_ATTRIBUTES,
    RTEMS_NO_PRIORITY,
    &Semaphore_id
  );
  directive_failed( status, "rtems_semaphore_create of SM1" );

  if ( OPERATION_COUNT > RTEMS_MAXIMUM_PRIORITY - 2u )
    operation_count =  (int) (RTEMS_MAXIMUM_PRIORITY - 2u);
  for ( index = 2 ; index < operation_count ; index ++ ) {
    rtems_task_create(
      rtems_build_name( 'M', 'I', 'D', ' ' ),
      priority,
      RTEMS_MINIMUM_STACK_SIZE,
      RTEMS_DEFAULT_MODES,
      RTEMS_DEFAULT_ATTRIBUTES,
      &task_id
    );
    directive_failed( status, "rtems_task_create middle" );

    priority--;

    rtems_task_start( task_id, Middle_tasks, 0 );
    directive_failed( status, "rtems_task_start middle" );
  }

  status = rtems_task_create(
    rtems_build_name( 'H', 'I', 'G', 'H' ),
    priority,
    RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES,
    RTEMS_DEFAULT_ATTRIBUTES,
    &task_id
  );
  directive_failed( status, "rtems_task_create of high task" );

  status = rtems_task_start( task_id, High_task, 0 );
  directive_failed( status, "rtems_task_start of high task" );

  benchmark_timer_initialize();                          /* start the timer */
  status = rtems_semaphore_release( Semaphore_id );
}
コード例 #30
0
ファイル: task1.c プロジェクト: krohini1593/rtems
rtems_task Low_task(
  rtems_task_argument argument
)
{
  Scheduler_priority_Context *scheduler_context =
    _Scheduler_priority_Get_context( _Scheduler_Get( _Thread_Get_executing() ) );
  Thread_Control             *executing;

  context_switch_no_fp_time = benchmark_timer_read();

  executing    = _Thread_Get_executing();

  Low_tcb = executing;

  benchmark_timer_initialize();
    _Context_Switch( &executing->Registers, &executing->Registers );

  context_switch_self_time = benchmark_timer_read();

  _Context_Switch(&executing->Registers, &Middle_tcb->Registers);

  context_switch_another_task_time = benchmark_timer_read();

  set_thread_executing(
    (Thread_Control *) _Chain_First(&scheduler_context->Ready[FP1_PRIORITY])
  );

  /* do not force context switch */

  set_thread_dispatch_necessary( false );

  thread_disable_dispatch();

  benchmark_timer_initialize();
#if (CPU_HARDWARE_FP == 1) || (CPU_SOFTWARE_FP == 1)
    _Context_Restore_fp( &_Thread_Get_executing()->fp_context );
#endif
    _Context_Switch(
      &executing->Registers,
      &_Thread_Get_executing()->Registers
    );
}