Changeset 661e0e63 in rtems for testsuites/psxtests/psx12


Ignore:
Timestamp:
Jun 15, 2016, 9:18:10 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
57c676c6
Parents:
917884c
git-author:
Sebastian Huber <sebastian.huber@…> (06/15/16 09:18:10)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/15/16 09:21:04)
Message:

psxtests/psx12: Use and print proper rounded ms

Update #2738.

Location:
testsuites/psxtests/psx12
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psx12/init.c

    r917884c r661e0e63  
    2323const char rtems_test_name[] = "PSX 12";
    2424
    25 #define SS_REPL_PERIOD_US 200000
    26 
    27 #define SS_INIT_BUDGET_US 100000
     25#define SS_REPL_PERIOD_NS 200000000
     26
     27#define SS_INIT_BUDGET_NS 100000000
     28
     29#define SS_REPL_PERIOD_MS ( SS_REPL_PERIOD_NS / 1000000 )
    2830
    2931#define SS_PRIO_LOW 1
     
    3638  uint64_t start;
    3739  struct {
    38     uint64_t high;
    39     uint64_t low;
     40    uint32_t high;
     41    uint32_t low;
    4042  } samples[ SS_SAMPLE_PERIODS ];
    4143} test_context;
     
    7577}
    7678
    77 static uint64_t delta( test_context *ctx )
    78 {
    79   return now() - ctx->start;
     79static uint32_t delta_in_ms( test_context *ctx )
     80{
     81  uint32_t d;
     82
     83  d = (uint32_t) ( now() - ctx->start );
     84  return ( d + 499 ) / 1000;
    8085}
    8186
     
    8994  for ( i = 0 ; i < SS_SAMPLE_PERIODS ; ++i ) {
    9095    wait_for_prio( SS_PRIO_LOW );
    91     ctx->samples[ i ].high = delta( ctx );
     96    ctx->samples[ i ].high = delta_in_ms( ctx );
    9297    wait_for_prio( SS_PRIO_HIGH );
    93     ctx->samples[ i ].low = delta( ctx );
     98    ctx->samples[ i ].low = delta_in_ms( ctx );
    9499  }
    95100
     
    165170
    166171  schedparam.sched_ss_repl_period.tv_sec = 0;
    167   schedparam.sched_ss_repl_period.tv_nsec = SS_REPL_PERIOD_US * 1000;
     172  schedparam.sched_ss_repl_period.tv_nsec = SS_REPL_PERIOD_NS;
    168173  schedparam.sched_ss_init_budget.tv_sec = 0;
    169   schedparam.sched_ss_init_budget.tv_nsec = SS_INIT_BUDGET_US * 1000;
     174  schedparam.sched_ss_init_budget.tv_nsec = SS_INIT_BUDGET_NS;
    170175
    171176  schedparam.sched_priority = SS_PRIO_HIGH;
     
    182187
    183188  schedparam.sched_ss_repl_period.tv_sec = 0;
    184   schedparam.sched_ss_repl_period.tv_nsec = SS_REPL_PERIOD_US * 1000;
     189  schedparam.sched_ss_repl_period.tv_nsec = SS_REPL_PERIOD_NS;
    185190  schedparam.sched_ss_init_budget.tv_sec = 0;
    186   schedparam.sched_ss_init_budget.tv_nsec = SS_INIT_BUDGET_US * 1000;
     191  schedparam.sched_ss_init_budget.tv_nsec = SS_INIT_BUDGET_NS;
    187192
    188193  schedparam.sched_priority = SS_PRIO_HIGH;
     
    206211
    207212  for ( i = 0 ; i < SS_SAMPLE_PERIODS ; ++i ) {
    208     printf( "[%zu] H %6" PRIu64 "us\n", i, ctx->samples[ i ].high );
    209     printf( "[%zu] L %6" PRIu64 "us\n", i, ctx->samples[ i ].low );
    210     rtems_test_assert( ctx->samples[ i ].low / SS_REPL_PERIOD_US == i + 1 );
     213    printf( "[%zu] H %3" PRIu32 "ms\n", i, ctx->samples[ i ].high );
     214    printf( "[%zu] L %3" PRIu32 "ms\n", i, ctx->samples[ i ].low );
     215    rtems_test_assert( ctx->samples[ i ].low / SS_REPL_PERIOD_MS == i + 1 );
    211216  }
    212217
  • testsuites/psxtests/psx12/psx12.scn

    r917884c r661e0e63  
    99Init: pthread_create - SUCCESSFUL
    1010Sporadic Server: exitting
    11 [0] H  99902us
    12 [0] L 200008us
    13 [1] H 289908us
    14 [1] L 400009us
    15 [2] H 489903us
    16 [2] L 600009us
     11[0] H 100ms
     12[0] L 200ms
     13[1] H 290ms
     14[1] L 400ms
     15[2] H 490ms
     16[2] L 600ms
    1717*** END OF TEST PSX 12 ***
Note: See TracChangeset for help on using the changeset viewer.