ping. On Wed, Dec 30, 2015 at 5:49 PM, Bill Fischofer <bill.fischo...@linaro.org> wrote:
> Expand the existing scheduler chaos test to provide timing information for > mixed queues as well as individual timings for parallel, atomic, and > ordered queues. This enables implementation scheduling efficiency to be > displayed by queue type. > > Signed-off-by: Bill Fischofer <bill.fischo...@linaro.org> > --- > test/validation/scheduler/scheduler.c | 51 > ++++++++++++++++++++++++++++++----- > test/validation/scheduler/scheduler.h | 3 +++ > 2 files changed, 48 insertions(+), 6 deletions(-) > > diff --git a/test/validation/scheduler/scheduler.c > b/test/validation/scheduler/scheduler.c > index 7ba6a06..d5842de 100644 > --- a/test/validation/scheduler/scheduler.c > +++ b/test/validation/scheduler/scheduler.c > @@ -451,12 +451,14 @@ static void *chaos_thread(void *arg) > thread_args_t *args = (thread_args_t *)arg; > test_globals_t *globals = args->globals; > int me = odp_thread_id(); > + odp_time_t start_time, end_time, diff; > > if (CHAOS_DEBUG) > printf("Chaos thread %d starting...\n", me); > > /* Wait for all threads to start */ > odp_barrier_wait(&globals->barrier); > + start_time = odp_time_local(); > > /* Run the test */ > wait = odp_schedule_wait_time(CHAOS_WAIT_FAIL); > @@ -508,10 +510,16 @@ static void *chaos_thread(void *arg) > odp_event_free(ev); > } > > + end_time = odp_time_local(); > + diff = odp_time_diff(end_time, start_time); > + > + printf("Thread %d ends, elapsed time = %" PRIu64 "us\n", > + odp_thread_id(), odp_time_to_ns(diff) / 1000); > + > return NULL; > } > > -void scheduler_test_chaos(void) > +static void chaos_run(unsigned int qtype) > { > odp_pool_t pool; > odp_pool_param_t params; > @@ -557,11 +565,19 @@ void scheduler_test_chaos(void) > qp.sched.prio = ODP_SCHED_PRIO_DEFAULT; > > for (i = 0; i < CHAOS_NUM_QUEUES; i++) { > - qp.sched.sync = sync[i % num_sync]; > - snprintf(globals->chaos_q[i].name, > - sizeof(globals->chaos_q[i].name), > - "chaos queue %d - %s", i, > - qtypes[i % num_sync]); > + if (qtype == num_sync) { > + qp.sched.sync = sync[i % num_sync]; > + snprintf(globals->chaos_q[i].name, > + sizeof(globals->chaos_q[i].name), > + "chaos queue %d - %s", i, > + qtypes[i % num_sync]); > + } else { > + qp.sched.sync = sync[qtype]; > + snprintf(globals->chaos_q[i].name, > + sizeof(globals->chaos_q[i].name), > + "chaos queue %d - %s", i, > + qtypes[qtype]); > + } > globals->chaos_q[i].handle = > odp_queue_create(globals->chaos_q[i].name, > ODP_QUEUE_TYPE_SCHED, > @@ -630,6 +646,26 @@ void scheduler_test_chaos(void) > CU_ASSERT(rc == 0); > } > > +void scheduler_test_chaos(void) > +{ > + chaos_run(3); > +} > + > +void scheduler_test_parallel(void) > +{ > + chaos_run(0); > +} > + > +void scheduler_test_atomic(void) > +{ > + chaos_run(1); > +} > + > +void scheduler_test_ordered(void) > +{ > + chaos_run(2); > +} > + > static void *schedule_common_(void *arg) > { > thread_args_t *args = (thread_args_t *)arg; > @@ -1521,6 +1557,9 @@ odp_testinfo_t scheduler_suite[] = { > ODP_TEST_INFO(scheduler_test_queue_destroy), > ODP_TEST_INFO(scheduler_test_groups), > ODP_TEST_INFO(scheduler_test_chaos), > + ODP_TEST_INFO(scheduler_test_parallel), > + ODP_TEST_INFO(scheduler_test_atomic), > + ODP_TEST_INFO(scheduler_test_ordered), > ODP_TEST_INFO(scheduler_test_1q_1t_n), > ODP_TEST_INFO(scheduler_test_1q_1t_a), > ODP_TEST_INFO(scheduler_test_1q_1t_o), > diff --git a/test/validation/scheduler/scheduler.h > b/test/validation/scheduler/scheduler.h > index bba79aa..cd69e92 100644 > --- a/test/validation/scheduler/scheduler.h > +++ b/test/validation/scheduler/scheduler.h > @@ -15,6 +15,9 @@ void scheduler_test_num_prio(void); > void scheduler_test_queue_destroy(void); > void scheduler_test_groups(void); > void scheduler_test_chaos(void); > +void scheduler_test_parallel(void); > +void scheduler_test_atomic(void); > +void scheduler_test_ordered(void); > void scheduler_test_1q_1t_n(void); > void scheduler_test_1q_1t_a(void); > void scheduler_test_1q_1t_o(void); > -- > 2.5.0 > >
_______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp