Added implementation and validation test for schedule
group info struct.
Signed-off-by: Petri Savolainen <[email protected]>
---
platform/linux-generic/odp_schedule.c | 21 +++++++++++++++++++++
test/validation/scheduler/scheduler.c | 8 ++++++++
2 files changed, 29 insertions(+)
diff --git a/platform/linux-generic/odp_schedule.c
b/platform/linux-generic/odp_schedule.c
index a10cdc4..14a1197 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -869,6 +869,27 @@ int odp_schedule_group_thrmask(odp_schedule_group_t group,
return ret;
}
+int odp_schedule_group_info(odp_schedule_group_t group,
+ odp_schedule_group_info_t *info)
+{
+ int ret;
+
+ odp_spinlock_lock(&sched->grp_lock);
+
+ if (group < ODP_CONFIG_SCHED_GRPS &&
+ group >= _ODP_SCHED_GROUP_NAMED &&
+ sched->sched_grp[group].name[0] != 0) {
+ info->name = sched->sched_grp[group].name;
+ info->thrmask = *sched->sched_grp[group].mask;
+ ret = 0;
+ } else {
+ ret = -1;
+ }
+
+ odp_spinlock_unlock(&sched->grp_lock);
+ return ret;
+}
+
/* This function is a no-op in linux-generic */
void odp_schedule_prefetch(int num ODP_UNUSED)
{
diff --git a/test/validation/scheduler/scheduler.c
b/test/validation/scheduler/scheduler.c
index 5631618..9ed6119 100644
--- a/test/validation/scheduler/scheduler.c
+++ b/test/validation/scheduler/scheduler.c
@@ -260,6 +260,7 @@ void scheduler_test_groups(void)
int thr_id = odp_thread_id();
odp_thrmask_t zeromask, mymask, testmask;
odp_schedule_group_t mygrp1, mygrp2, lookup;
+ odp_schedule_group_info_t info;
odp_thrmask_zero(&zeromask);
odp_thrmask_zero(&mymask);
@@ -290,6 +291,13 @@ void scheduler_test_groups(void)
CU_ASSERT(rc == 0);
CU_ASSERT(odp_thrmask_isset(&testmask, thr_id));
+ /* Info struct */
+ memset(&info, 0, sizeof(odp_schedule_group_info_t));
+ rc = odp_schedule_group_info(mygrp1, &info);
+ CU_ASSERT(rc == 0);
+ CU_ASSERT(odp_thrmask_equal(&info.thrmask, &mymask) != 0);
+ CU_ASSERT(strcmp(info.name, "Test Group 1") == 0);
+
/* We can't join or leave an unknown group */
rc = odp_schedule_group_join(ODP_SCHED_GROUP_INVALID, &mymask);
CU_ASSERT(rc != 0);
--
2.7.2
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp