Increase TEST_ROUNDS for all schedulers except SP for more deterministic test results. SP is too slow to handle the increased running time.
Use an explicit scheduling group to inform the scheduler of the threads that will join the group. Add a timeout to the schedule call for draining queues. Signed-off-by: Brian Brooks <[email protected]> Signed-off-by: Ola Liljedahl <[email protected]> --- test/common_plat/performance/odp_sched_latency.c | 62 ++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/test/common_plat/performance/odp_sched_latency.c b/test/common_plat/performance/odp_sched_latency.c index 026f2f6c..3fd969ca 100644 --- a/test/common_plat/performance/odp_sched_latency.c +++ b/test/common_plat/performance/odp_sched_latency.c @@ -28,7 +28,13 @@ #define MAX_WORKERS 64 /**< Maximum number of worker threads */ #define MAX_QUEUES 4096 /**< Maximum number of queues */ #define EVENT_POOL_SIZE (1024 * 1024) /**< Event pool size */ + +#ifdef ODP_SCHEDULE_SP #define TEST_ROUNDS (4 * 1024 * 1024) /**< Test rounds for each thread */ +#else +#define TEST_ROUNDS (32 * 1024 * 1024) /**< Test rounds for each thread */ +#endif + #define MAIN_THREAD 1 /**< Thread ID performing maintenance tasks */ /* Default values for command line arguments */ @@ -105,6 +111,9 @@ typedef union { typedef struct { core_stat_t core_stat[MAX_WORKERS]; /**< Core specific stats */ odp_barrier_t barrier; /**< Barrier for thread synchronization */ +#ifdef ODP_SCHEDULE_SCALABLE + odp_schedule_group_t schedule_group; +#endif odp_pool_t pool; /**< Pool for allocating test events */ test_args_t args; /**< Parsed command line arguments */ odp_queue_t queue[NUM_PRIOS][MAX_QUEUES]; /**< Scheduled queues */ @@ -461,6 +470,20 @@ static int run_thread(void *arg ODP_UNUSED) return -1; } +#ifdef ODP_SCHEDULE_SCALABLE + int err; + odp_thrmask_t thrmask; + + odp_thrmask_zero(&thrmask); + odp_thrmask_set(&thrmask, thr); + + err = odp_schedule_group_join(globals->schedule_group, &thrmask); + if (err != 0) { + LOG_ERR("odp_schedule_group_join failed\n"); + return -1; + } +#endif + if (thr == MAIN_THREAD) { args = &globals->args; @@ -485,6 +508,13 @@ static int run_thread(void *arg ODP_UNUSED) if (test_schedule(thr, globals)) return -1; +#ifdef ODP_SCHEDULE_SCALABLE + err = odp_schedule_group_leave(globals->schedule_group, &thrmask); + if (err != 0) { + LOG_ERR("odp_schedule_group_leave failed\n"); + return -1; + } +#endif return 0; } @@ -717,6 +747,31 @@ int main(int argc, char *argv[]) } globals->pool = pool; +#ifdef ODP_SCHEDULE_SCALABLE + /* + * Create scheduler group + */ + odp_thrmask_t expected_thrmask; + int cpu; + int thr; + + odp_thrmask_zero(&expected_thrmask); + /* This is a odp_thrmask_from_cpumask() */ + cpu = odp_cpumask_first(&cpumask); + thr = 1; + while (0 <= cpu) { + odp_thrmask_set(&expected_thrmask, thr++); + cpu = odp_cpumask_next(&cpumask, cpu); + } + + globals->schedule_group = + odp_schedule_group_create("sg0", &expected_thrmask); + if (globals->schedule_group == ODP_SCHED_GROUP_INVALID) { + LOG_ERR("odp_schedule_group_create failed\n"); + return -1; + } +#endif + /* * Create queues for schedule test */ @@ -738,7 +793,11 @@ int main(int argc, char *argv[]) param.type = ODP_QUEUE_TYPE_SCHED; param.sched.prio = prio; param.sched.sync = args.sync_type; +#ifdef ODP_SCHEDULE_SCALABLE + param.sched.group = globals->schedule_group; +#else param.sched.group = ODP_SCHED_GROUP_ALL; +#endif for (j = 0; j < args.prio[i].queues; j++) { name[9] = '0' + j / 10; @@ -783,6 +842,9 @@ int main(int argc, char *argv[]) } } +#ifdef ODP_SCHEDULE_SCALABLE + ret += odp_schedule_group_destroy(globals->schedule_group); +#endif ret += odp_shm_free(shm); ret += odp_pool_destroy(pool); ret += odp_term_local(); -- 2.12.2
