diff mbox

[API-NEXT] validation: scheduler: add timing tests for scheduled queue types

Message ID 1451519364-29289-1-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer Dec. 30, 2015, 11:49 p.m. UTC
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.fischofer@linaro.org>
---
 test/validation/scheduler/scheduler.c | 51 ++++++++++++++++++++++++++++++-----
 test/validation/scheduler/scheduler.h |  3 +++
 2 files changed, 48 insertions(+), 6 deletions(-)

Comments

Bill Fischofer Jan. 20, 2016, 4:58 p.m. UTC | #1
ping.

On Wed, Dec 30, 2015 at 5:49 PM, Bill Fischofer <bill.fischofer@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.fischofer@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

>

>
Ivan Khoronzhuk Jan. 20, 2016, 7:43 p.m. UTC | #2
On 20.01.16 18:58, Bill Fischofer wrote:
> ping.
>
> On Wed, Dec 30, 2015 at 5:49 PM, Bill Fischofer <bill.fischofer@linaro.org <mailto:bill.fischofer@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.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>>

Please, decrease CHAOS_NUM_ROUNDS, say 1000. That's more then enough.
Especially now, when it's multiplied on 4 with number of tests.
Also, see below.

>     ---
>       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]);
>     +               }

		      unsigned int qtype_num;

		      qtype_num = qtype == num_sync ? i % num_sync : qtype;
		      qp.sched.sync = sync[qtype_num];
		      snprintf(globals->chaos_q[i].name,
			       sizeof(globals->chaos_q[i].name),
			       "chaos queue %d - %s", i,
			       qtypes[qtype_num]);


>                      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
>
Ivan Khoronzhuk Jan. 20, 2016, 8:24 p.m. UTC | #3
On 20.01.16 21:43, Ivan Khoronzhuk wrote:
>
>
> On 20.01.16 18:58, Bill Fischofer wrote:
>> ping.
>>
>> On Wed, Dec 30, 2015 at 5:49 PM, Bill Fischofer <bill.fischofer@linaro.org <mailto:bill.fischofer@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.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>>
>
> Please, decrease CHAOS_NUM_ROUNDS, say 1000. That's more then enough.
> Especially now, when it's multiplied on 4 with number of tests.
> Also, see below.
>
>>     ---
>>       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]);
>>     +               }
>
>                unsigned int qtype_num;
>
>                qtype_num = qtype == num_sync ? i % num_sync : qtype;
>                qp.sched.sync = sync[qtype_num];
>                snprintf(globals->chaos_q[i].name,
>                     sizeof(globals->chaos_q[i].name),
>                     "chaos queue %d - %s", i,
>                     qtypes[qtype_num]);
>
>
>>                      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),
better to be after *_test_ordered test.

>>     +       ODP_TEST_INFO(scheduler_test_parallel),
>>     +       ODP_TEST_INFO(scheduler_test_atomic),
>>     +       ODP_TEST_INFO(scheduler_test_ordered),
here.
>>              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
>>
>
Bill Fischofer Jan. 20, 2016, 9:31 p.m. UTC | #4
Ok, v2 submitted with requested changes.  Thanks.

Bill

On Wed, Jan 20, 2016 at 2:24 PM, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org
> wrote:


>

>

> On 20.01.16 21:43, Ivan Khoronzhuk wrote:

>

>>

>>

>> On 20.01.16 18:58, Bill Fischofer wrote:

>>

>>> ping.

>>>

>>> On Wed, Dec 30, 2015 at 5:49 PM, Bill Fischofer <

>>> bill.fischofer@linaro.org <mailto:bill.fischofer@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.fischofer@linaro.org <mailto:

>>> bill.fischofer@linaro.org>>

>>>

>>

>> Please, decrease CHAOS_NUM_ROUNDS, say 1000. That's more then enough.

>> Especially now, when it's multiplied on 4 with number of tests.

>> Also, see below.

>>

>>     ---

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

>>>     +               }

>>>

>>

>>                unsigned int qtype_num;

>>

>>                qtype_num = qtype == num_sync ? i % num_sync : qtype;

>>                qp.sched.sync = sync[qtype_num];

>>                snprintf(globals->chaos_q[i].name,

>>                     sizeof(globals->chaos_q[i].name),

>>                     "chaos queue %d - %s", i,

>>                     qtypes[qtype_num]);

>>

>>

>>                      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),

>>>

>> better to be after *_test_ordered test.

>

>     +       ODP_TEST_INFO(scheduler_test_parallel),

>>>     +       ODP_TEST_INFO(scheduler_test_atomic),

>>>     +       ODP_TEST_INFO(scheduler_test_ordered),

>>>

>> here.

>

>              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

>>>

>>>

>>

> --

> Regards,

> Ivan Khoronzhuk

>
Ivan Khoronzhuk Jan. 20, 2016, 9:36 p.m. UTC | #5
Seems you've missed simplification.

On 20.01.16 23:31, Bill Fischofer wrote:
> Ok, v2 submitted with requested changes.  Thanks.
>
> Bill
>
> On Wed, Jan 20, 2016 at 2:24 PM, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org>> wrote:
>
>
>
>     On 20.01.16 21:43, Ivan Khoronzhuk wrote:
>
>
>
>         On 20.01.16 18:58, Bill Fischofer wrote:
>
>             ping.
>
>             On Wed, Dec 30, 2015 at 5:49 PM, Bill Fischofer <bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:bill.fischofer@linaro.org <mailto:bill.fischofer@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.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>>>
>
>
>         Please, decrease CHAOS_NUM_ROUNDS, say 1000. That's more then enough.
>         Especially now, when it's multiplied on 4 with number of tests.
>         Also, see below.
>
>                  ---
>                    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]);
>                  +               }
?

It's easier to support, and was in previous version proposed.

                unsigned int qtype_num;

                qtype_num = qtype == num_sync ? i % num_sync : qtype;
                qp.sched.sync = sync[qtype_num];
                snprintf(globals->chaos_q[i].name,
                     sizeof(globals->chaos_q[i].name),
                     "chaos queue %d - %s", i,
                     qtypes[qtype_num]);

>
>
>                         unsigned int qtype_num;
>
>                         qtype_num = qtype == num_sync ? i % num_sync : qtype;
>                         qp.sched.sync = sync[qtype_num];
>                         snprintf(globals->chaos_q[i].name,
>                              sizeof(globals->chaos_q[i].name),
>                              "chaos queue %d - %s", i,
>                              qtypes[qtype_num]);
>
>
>                                   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),
>
>     better to be after *_test_ordered test.
>
>                  +       ODP_TEST_INFO(scheduler_test_parallel),
>                  +       ODP_TEST_INFO(scheduler_test_atomic),
>                  +       ODP_TEST_INFO(scheduler_test_ordered),
>
>     here.
>
>                           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 <mailto:lng-odp@lists.linaro.org>
>             https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>     --
>     Regards,
>     Ivan Khoronzhuk
>
>
Bill Fischofer Jan. 20, 2016, 10:02 p.m. UTC | #6
On Wed, Jan 20, 2016 at 3:36 PM, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org
> wrote:


> Seems you've missed simplification.



Can you be more specific?  You requested that CHAOS_NUM_ROUNDS be reduced
to 1000 and the test ordering be rearranged.  Did I miss something else?


>

>

> On 20.01.16 23:31, Bill Fischofer wrote:

>

>> Ok, v2 submitted with requested changes.  Thanks.

>>

>> Bill

>>

>> On Wed, Jan 20, 2016 at 2:24 PM, Ivan Khoronzhuk <

>> ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org>> wrote:

>>

>>

>>

>>     On 20.01.16 21:43, Ivan Khoronzhuk wrote:

>>

>>

>>

>>         On 20.01.16 18:58, Bill Fischofer wrote:

>>

>>             ping.

>>

>>             On Wed, Dec 30, 2015 at 5:49 PM, Bill Fischofer <

>> bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:

>> bill.fischofer@linaro.org <mailto:bill.fischofer@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.fischofer@linaro.org

>> <mailto:bill.fischofer@linaro.org> <mailto:bill.fischofer@linaro.org

>> <mailto:bill.fischofer@linaro.org>>>

>>

>>

>>

>>         Please, decrease CHAOS_NUM_ROUNDS, say 1000. That's more then

>> enough.

>>         Especially now, when it's multiplied on 4 with number of tests.

>>         Also, see below.

>>

>>                  ---

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

>>                  +               }

>>

> ?

>

> It's easier to support, and was in previous version proposed.

>

>

>                unsigned int qtype_num;

>

>                qtype_num = qtype == num_sync ? i % num_sync : qtype;

>                qp.sched.sync = sync[qtype_num];

>                snprintf(globals->chaos_q[i].name,

>                     sizeof(globals->chaos_q[i].name),

>                     "chaos queue %d - %s", i,

>                     qtypes[qtype_num]);

>

>

>>

>>                         unsigned int qtype_num;

>>

>>                         qtype_num = qtype == num_sync ? i % num_sync :

>> qtype;

>>                         qp.sched.sync = sync[qtype_num];

>>                         snprintf(globals->chaos_q[i].name,

>>                              sizeof(globals->chaos_q[i].name),

>>                              "chaos queue %d - %s", i,

>>                              qtypes[qtype_num]);

>>

>>

>>                                   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),

>>

>>     better to be after *_test_ordered test.

>>

>>                  +       ODP_TEST_INFO(scheduler_test_parallel),

>>                  +       ODP_TEST_INFO(scheduler_test_atomic),

>>                  +       ODP_TEST_INFO(scheduler_test_ordered),

>>

>>     here.

>>

>>                           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 <mailto:lng-odp@lists.linaro.org>

>>             https://lists.linaro.org/mailman/listinfo/lng-odp

>>

>>

>>

>>     --

>>     Regards,

>>     Ivan Khoronzhuk

>>

>>

>>

> --

> Regards,

> Ivan Khoronzhuk

>
Ivan Khoronzhuk Jan. 20, 2016, 10:09 p.m. UTC | #7
On 21.01.16 00:02, Bill Fischofer wrote:
>
>
> On Wed, Jan 20, 2016 at 3:36 PM, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org>> wrote:
>
>     Seems you've missed simplification.
>
>
> Can you be more specific?  You requested that CHAOS_NUM_ROUNDS be reduced to 1000 and the test ordering be rearranged.  Did I miss something else?

It's in my previous replies.
Proposition to use shorter variant of if/else construct in the patch.
snprintf has same format, so better to use one function. It's easier to support.
    ||
    ||
    \/

"
                unsigned int qtype_num;

                qtype_num = qtype == num_sync ? i % num_sync : qtype;
                qp.sched.sync = sync[qtype_num];
                snprintf(globals->chaos_q[i].name, sizeof(globals->chaos_q[i].name),
                         "chaos queue %d - %s", i, qtypes[qtype_num]);
"

It was replied it below
    ||
    ||
    \/

>
>
>
>     On 20.01.16 23:31, Bill Fischofer wrote:
>
>         Ok, v2 submitted with requested changes.  Thanks.
>
>         Bill
>
>         On Wed, Jan 20, 2016 at 2:24 PM, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org> <mailto:ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org>>> wrote:
>
>
>
>              On 20.01.16 21:43, Ivan Khoronzhuk wrote:
>
>
>
>                  On 20.01.16 18:58, Bill Fischofer wrote:
>
>                      ping.
>
>                      On Wed, Dec 30, 2015 at 5:49 PM, Bill Fischofer <bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>> <mailto:bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:bill.fischofer@linaro.org <mailto:bill.fischofer@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.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>> <mailto:bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>>>>
>
>
>
>                  Please, decrease CHAOS_NUM_ROUNDS, say 1000. That's more then enough.
>                  Especially now, when it's multiplied on 4 with number of tests.
>                  Also, see below.
>
>                           ---
>                             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]);
>                           +               }
>
>     ?
>
>     It's easier to support, and was in previous version proposed.
>
>
>                     unsigned int qtype_num;
>
>                     qtype_num = qtype == num_sync ? i % num_sync : qtype;
>                     qp.sched.sync = sync[qtype_num];
>                     snprintf(globals->chaos_q[i].name,
>                          sizeof(globals->chaos_q[i].name),
>                          "chaos queue %d - %s", i,
>                          qtypes[qtype_num]);
>
>
>
>                                  unsigned int qtype_num;
>
>                                  qtype_num = qtype == num_sync ? i % num_sync : qtype;
>                                  qp.sched.sync = sync[qtype_num];
>                                  snprintf(globals->chaos_q[i].name,
>                                       sizeof(globals->chaos_q[i].name),
>                                       "chaos queue %d - %s", i,
>                                       qtypes[qtype_num]);
>
>
>                                            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),
>
>              better to be after *_test_ordered test.
>
>                           +       ODP_TEST_INFO(scheduler_test_parallel),
>                           +       ODP_TEST_INFO(scheduler_test_atomic),
>                           +       ODP_TEST_INFO(scheduler_test_ordered),
>
>              here.
>
>                                    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 <mailto:lng-odp@lists.linaro.org> <mailto:lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>>
>         https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>              --
>              Regards,
>              Ivan Khoronzhuk
>
>
>
>     --
>     Regards,
>     Ivan Khoronzhuk
>
>
Bill Fischofer Jan. 20, 2016, 10:26 p.m. UTC | #8
OK, sorry, missed that.  v3 submitted with that simplification.  Thanks.

On Wed, Jan 20, 2016 at 4:09 PM, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org
> wrote:


>

>

> On 21.01.16 00:02, Bill Fischofer wrote:

>

>>

>>

>> On Wed, Jan 20, 2016 at 3:36 PM, Ivan Khoronzhuk <

>> ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org>> wrote:

>>

>>     Seems you've missed simplification.

>>

>>

>> Can you be more specific?  You requested that CHAOS_NUM_ROUNDS be reduced

>> to 1000 and the test ordering be rearranged.  Did I miss something else?

>>

>

> It's in my previous replies.

> Proposition to use shorter variant of if/else construct in the patch.

> snprintf has same format, so better to use one function. It's easier to

> support.

>    ||

>    ||

>    \/

>

> "

>                unsigned int qtype_num;

>

>                qtype_num = qtype == num_sync ? i % num_sync : qtype;

>                qp.sched.sync = sync[qtype_num];

>                snprintf(globals->chaos_q[i].name,

> sizeof(globals->chaos_q[i].name),

>                         "chaos queue %d - %s", i, qtypes[qtype_num]);

> "

>

> It was replied it below

>    ||

>    ||

>    \/

>

>

>>

>>

>>     On 20.01.16 23:31, Bill Fischofer wrote:

>>

>>         Ok, v2 submitted with requested changes.  Thanks.

>>

>>         Bill

>>

>>         On Wed, Jan 20, 2016 at 2:24 PM, Ivan Khoronzhuk <

>> ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org> <mailto:

>> ivan.khoronzhuk@linaro.org <mailto:ivan.khoronzhuk@linaro.org>>> wrote:

>>

>>

>>

>>              On 20.01.16 21:43, Ivan Khoronzhuk wrote:

>>

>>

>>

>>                  On 20.01.16 18:58, Bill Fischofer wrote:

>>

>>                      ping.

>>

>>                      On Wed, Dec 30, 2015 at 5:49 PM, Bill Fischofer <

>> bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:

>> bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>> <mailto:

>> bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:

>> bill.fischofer@linaro.org <mailto:bill.fischofer@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.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:

>> bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>> <mailto:

>> bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org> <mailto:

>> bill.fischofer@linaro.org <mailto:bill.fischofer@linaro.org>>>>

>>

>>

>>

>>

>>                  Please, decrease CHAOS_NUM_ROUNDS, say 1000. That's more

>> then enough.

>>                  Especially now, when it's multiplied on 4 with number of

>> tests.

>>                  Also, see below.

>>

>>                           ---

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

>>                           +               }

>>

>>     ?

>>

>>     It's easier to support, and was in previous version proposed.

>>

>>

>>                     unsigned int qtype_num;

>>

>>                     qtype_num = qtype == num_sync ? i % num_sync : qtype;

>>                     qp.sched.sync = sync[qtype_num];

>>                     snprintf(globals->chaos_q[i].name,

>>                          sizeof(globals->chaos_q[i].name),

>>                          "chaos queue %d - %s", i,

>>                          qtypes[qtype_num]);

>>

>>

>>

>>                                  unsigned int qtype_num;

>>

>>                                  qtype_num = qtype == num_sync ? i %

>> num_sync : qtype;

>>                                  qp.sched.sync = sync[qtype_num];

>>                                  snprintf(globals->chaos_q[i].name,

>>                                       sizeof(globals->chaos_q[i].name),

>>                                       "chaos queue %d - %s", i,

>>                                       qtypes[qtype_num]);

>>

>>

>>                                            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),

>>

>>              better to be after *_test_ordered test.

>>

>>                           +       ODP_TEST_INFO(scheduler_test_parallel),

>>                           +       ODP_TEST_INFO(scheduler_test_atomic),

>>                           +       ODP_TEST_INFO(scheduler_test_ordered),

>>

>>              here.

>>

>>                                    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 <mailto:lng-odp@lists.linaro.org>

>> <mailto:lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>>

>>         https://lists.linaro.org/mailman/listinfo/lng-odp

>>

>>

>>

>>              --

>>              Regards,

>>              Ivan Khoronzhuk

>>

>>

>>

>>     --

>>     Regards,

>>     Ivan Khoronzhuk

>>

>>

>>

> --

> Regards,

> Ivan Khoronzhuk

>
diff mbox

Patch

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