Changeset 2617b345 in rtems for testsuites/tmtests/tm26/task1.c


Ignore:
Timestamp:
Feb 19, 1998, 5:08:54 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
6eba9b79
Parents:
51c195d5
Message:

Restructured so all times are placed in variables and printed in batch
mode at the end of the test. This eliminates the possibility of IO
blocking a task unexpectedly and messing up the test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/tmtests/tm26/task1.c

    r51c195d5 r2617b345  
    3131Thread_Control *Low_tcb;      /* uses internal RTEMS type */
    3232
     33/*
     34 *  Variables to hold execution times until they are printed
     35 *  at the end of the test.
     36 */
     37
     38rtems_unsigned32 isr_disable_time;
     39rtems_unsigned32 isr_flash_time;
     40rtems_unsigned32 isr_enable_time;
     41rtems_unsigned32 thread_disable_dispatch_time;
     42rtems_unsigned32 thread_enable_dispatch_time;
     43rtems_unsigned32 thread_set_state_time;
     44rtems_unsigned32 thread_dispatch_no_fp_time;
     45rtems_unsigned32 context_switch_no_fp_time;
     46rtems_unsigned32 context_switch_self_time;
     47rtems_unsigned32 context_switch_another_task_time;
     48rtems_unsigned32 context_switch_restore_1st_fp_time;
     49rtems_unsigned32 context_switch_save_idle_restore_initted_time;
     50rtems_unsigned32 context_switch_save_restore_idle_time;
     51rtems_unsigned32 context_switch_save_restore_initted_time;
     52rtems_unsigned32 thread_resume_time;
     53rtems_unsigned32 thread_unblock_time;
     54rtems_unsigned32 thread_ready_time;
     55rtems_unsigned32 thread_get_time;
     56rtems_unsigned32 semaphore_get_time;
     57rtems_unsigned32 thread_get_invalid_time;
     58
    3359rtems_task High_task(
    3460  rtems_task_argument argument
     
    172198  Timer_initialize();
    173199    rtems_interrupt_disable( level );
    174   end_time = Read_timer();
     200  isr_disable_time = Read_timer();
    175201 
    176   put_time(
    177     "_ISR_Disable",
    178     end_time,
    179     1,
    180     0,
    181     0
    182   );
    183 
    184202  Timer_initialize();
    185203    rtems_interrupt_flash( level );
    186   end_time = Read_timer();
     204  isr_flash_time = Read_timer();
    187205 
    188   put_time(
    189     "_ISR_Flash",
    190     end_time,
    191     1,
    192     0,
    193     0
    194   );
     206  Timer_initialize();
     207    rtems_interrupt_enable( level );
     208  isr_enable_time = Read_timer();
    195209 
    196210  Timer_initialize();
    197     rtems_interrupt_enable( level );
    198   end_time = Read_timer();
    199  
    200   put_time(
    201     "_ISR_Enable",
    202     end_time,
    203     1,
    204     0,
    205     0
    206   );
    207  
    208   Timer_initialize();
    209211    _Thread_Disable_dispatch();
    210   end_time = Read_timer();
    211 
    212   put_time(
    213     "_Thread_Disable_dispatch",
    214     end_time,
    215     1,
    216     0,
    217     0
    218   );
     212  thread_disable_dispatch_time = Read_timer();
    219213
    220214  Timer_initialize();
    221215    _Thread_Enable_dispatch();
    222   end_time = Read_timer();
    223 
    224   put_time(
    225     "_Thread_Enable_dispatch",
    226     end_time,
    227     1,
    228     0,
    229     0
    230   );
     216  thread_enable_dispatch_time = Read_timer();
    231217
    232218  Timer_initialize();
    233219    _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED );
    234   end_time = Read_timer();
    235 
    236   put_time(
    237     "_Thread_Set_state",
    238     end_time,
    239     1,
    240     0,
    241     0
    242   );
     220  thread_set_state_time = Read_timer();
    243221
    244222  _Context_Switch_necessary = TRUE;
     
    252230)
    253231{
    254   end_time = Read_timer();
    255 
    256   put_time(
    257     "_Thread_Disptach (NO FP)",
    258     end_time,
    259     1,
    260     0,
    261     0
    262   );
     232  thread_dispatch_no_fp_time = Read_timer();
    263233
    264234  _Thread_Set_state( _Thread_Executing, STATES_SUSPENDED );
     
    288258  Thread_Control *executing;
    289259
    290   end_time = Read_timer();
    291 
    292   put_time(
    293     "context switch: no floating point contexts",
    294     end_time,
    295     1,
    296     0,
    297     0
    298   );
     260  context_switch_no_fp_time = Read_timer();
    299261
    300262  executing    = _Thread_Executing;
     
    305267    _Context_Switch( &executing->Registers, &executing->Registers );
    306268
    307   end_time = Read_timer();
    308 
    309   put_time(
    310     "context switch: self",
    311     end_time,
    312     1,
    313     0,
    314     0
    315   );
     269  context_switch_self_time = Read_timer();
    316270
    317271  _Context_Switch(&executing->Registers, &Middle_tcb->Registers);
    318272
    319   end_time = Read_timer();
    320 
    321   put_time(
    322     "context switch: to another task",
    323     end_time,
    324     1,
    325     0,
    326     0
    327   );
     273  context_switch_another_task_time = Read_timer();
    328274
    329275  _Thread_Executing =
     
    348294  FP_DECLARE;
    349295
    350   end_time = Read_timer();
    351 
    352   put_time(
    353     "fp context switch: restore 1st FP task",
    354     end_time,
    355     1,
    356     0,
    357     0
    358   );
     296  context_switch_restore_1st_fp_time = Read_timer();
    359297
    360298  executing = _Thread_Executing;
     
    375313  /* switch to Floating_point_task_2 */
    376314
    377   end_time = Read_timer();
    378 
    379   put_time(
    380     "fp context switch: save idle, restore initialized",
    381     end_time,
    382     1,
    383     0,
    384     0
    385   );
     315  context_switch_save_idle_restore_initted_time = Read_timer();
    386316
    387317  FP_LOAD( 1.0 );
     
    412342  FP_DECLARE;
    413343
    414   end_time = Read_timer();
    415 
    416   put_time(
    417     "fp context switch: save idle, restore idle",
    418     end_time,
    419     1,
    420     0,
    421     0
    422   );
     344  context_switch_save_restore_idle_time = Read_timer();
    423345
    424346  executing = _Thread_Executing;
     
    441363  /* switch to Floating_point_task_1 */
    442364
    443   end_time = Read_timer();
    444 
    445   put_time(
    446     "fp context switch: save initialized, restore initialized",
    447     end_time,
    448     1,
    449     0,
    450     0
    451   );
     365  context_switch_save_restore_initted_time = Read_timer();
    452366
    453367  complete_test();
     
    461375  Timer_initialize();
    462376    _Thread_Resume( Middle_tcb );
    463   end_time = Read_timer();
    464 
    465   put_time(
    466     "_Thread_Resume",
    467     end_time,
    468     1,
    469     0,
    470     0
    471   );
     377  thread_resume_time = Read_timer();
    472378
    473379  _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE );
     
    475381  Timer_initialize();
    476382    _Thread_Unblock( Middle_tcb );
    477   end_time = Read_timer();
    478 
    479   put_time(
    480     "_Thread_Unblock",
    481     end_time,
    482     1,
    483     0,
    484     0
    485   );
     383  thread_unblock_time = Read_timer();
    486384
    487385  _Thread_Set_state( Middle_tcb, STATES_WAITING_FOR_MESSAGE );
     
    489387  Timer_initialize();
    490388    _Thread_Ready( Middle_tcb );
    491   end_time = Read_timer();
    492 
    493   put_time(
    494     "_Thread_Ready",
    495     end_time,
    496     1,
    497     0,
    498     0
    499   );
     389  thread_ready_time = Read_timer();
    500390
    501391  Timer_initialize();
     
    509399    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
    510400      (void) _Thread_Get( task_id, &location );
    511   end_time = Read_timer();
    512 
    513   put_time(
    514     "_Thread_Get",
    515     end_time,
    516     OPERATION_COUNT,
    517     0,
    518     0
    519   );
     401  thread_get_time = Read_timer();
    520402
    521403  Timer_initialize();
    522404    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
    523405      (void) _Semaphore_Get( Semaphore_id, &location );
    524   end_time = Read_timer();
    525 
    526   put_time(
    527     "_Semaphore_Get",
    528     end_time,
    529     OPERATION_COUNT,
    530     0,
    531     0
    532   );
     406  semaphore_get_time = Read_timer();
    533407
    534408  Timer_initialize();
    535409    for ( index=1 ; index <= OPERATION_COUNT ; index++ )
    536410      (void) _Thread_Get( 0x3, &location );
    537   end_time = Read_timer();
     411  thread_get_invalid_time = Read_timer();
     412
     413  /*
     414   *  Now dump all the times
     415   */
     416
     417  put_time(
     418    "_ISR_Disable",
     419    isr_disable_time,
     420    1,
     421    0,
     422    0
     423  );
     424
     425  put_time(
     426    "_ISR_Flash",
     427    isr_flash_time,
     428    1,
     429    0,
     430    0
     431  );
     432 
     433  put_time(
     434    "_ISR_Enable",
     435    isr_enable_time,
     436    1,
     437    0,
     438    0
     439  );
     440 
     441  put_time(
     442    "_Thread_Disable_dispatch",
     443    thread_disable_dispatch_time,
     444    1,
     445    0,
     446    0
     447  );
     448
     449  put_time(
     450    "_Thread_Enable_dispatch",
     451    thread_enable_dispatch_time,
     452    1,
     453    0,
     454    0
     455  );
     456
     457  put_time(
     458    "_Thread_Set_state",
     459    thread_set_state_time,
     460    1,
     461    0,
     462    0
     463  );
     464
     465  put_time(
     466    "_Thread_Disptach (NO FP)",
     467    thread_dispatch_no_fp_time,
     468    1,
     469    0,
     470    0
     471  );
     472
     473  put_time(
     474    "context switch: no floating point contexts",
     475    context_switch_no_fp_time,
     476    1,
     477    0,
     478    0
     479  );
     480
     481  put_time(
     482    "context switch: self",
     483    context_switch_self_time,
     484    1,
     485    0,
     486    0
     487  );
     488
     489  put_time(
     490    "context switch: to another task",
     491    context_switch_another_task_time,
     492    1,
     493    0,
     494    0
     495  );
     496
     497  put_time(
     498    "fp context switch: restore 1st FP task",
     499    context_switch_restore_1st_fp_time,
     500    1,
     501    0,
     502    0
     503  );
     504
     505  put_time(
     506    "fp context switch: save idle, restore initialized",
     507    context_switch_save_idle_restore_initted_time,
     508    1,
     509    0,
     510    0
     511  );
     512
     513  put_time(
     514    "fp context switch: save idle, restore idle",
     515    context_switch_save_restore_idle_time,
     516    1,
     517    0,
     518    0
     519  );
     520
     521  put_time(
     522    "fp context switch: save initialized, restore initialized",
     523    context_switch_save_restore_initted_time,
     524    1,
     525    0,
     526    0
     527  );
     528
     529  put_time(
     530    "_Thread_Resume",
     531    thread_resume_time,
     532    1,
     533    0,
     534    0
     535  );
     536
     537  put_time(
     538    "_Thread_Unblock",
     539    thread_unblock_time,
     540    1,
     541    0,
     542    0
     543  );
     544
     545  put_time(
     546    "_Thread_Ready",
     547    thread_ready_time,
     548    1,
     549    0,
     550    0
     551  );
     552
     553  put_time(
     554    "_Thread_Get",
     555    thread_get_time,
     556    OPERATION_COUNT,
     557    0,
     558    0
     559  );
     560
     561  put_time(
     562    "_Semaphore_Get",
     563    semaphore_get_time,
     564    OPERATION_COUNT,
     565    0,
     566    0
     567  );
    538568
    539569  put_time(
    540570    "_Thread_Get: invalid id",
    541     end_time,
     571    thread_get_invalid_time,
    542572    OPERATION_COUNT,
    543573    0,
Note: See TracChangeset for help on using the changeset viewer.