>
> snip
>
.....

> >> +
> >> +       for (i = 0; i < prios; i++) {
> >> +               odp_queue_param_t p;
> >> +               p.sched.prio  = i;
> >> +               p.sched.group = ODP_SCHED_GROUP_DEFAULT;
> >> +
> >> +               for (j = 0; j < QUEUES_PER_PRIO; j++) {
> >> +                       /* Per sched sync type */
> >> +                       char name[32];
> >> +                       odp_queue_t q;
> >> +
> >> +                       snprintf(name, sizeof(name), "sched_%d_%d_n", i,
> >> j);
> >> +                       p.sched.sync = ODP_SCHED_SYNC_NONE;
> >> +                       q = odp_queue_create(name, ODP_QUEUE_TYPE_SCHED,
> >> &p);
> >> +
> >> +                       if (q == ODP_QUEUE_INVALID) {
> >> +                               printf("Schedule queue create
> failed.\n");
> >> +                               return -1;
> >> +                       }
> >> +
> >> +                       snprintf(name, sizeof(name), "sched_%d_%d_a", i,
> >> j);
> >> +                       p.sched.sync = ODP_SCHED_SYNC_ATOMIC;
> >> +                       q = odp_queue_create(name, ODP_QUEUE_TYPE_SCHED,
> >> &p);
> >> +
> >> +                       if (q == ODP_QUEUE_INVALID) {
> >> +                               printf("Schedule queue create
> failed.\n");
> >> +                               return -1;
> >> +                       }
> >> +
> >> +                       snprintf(name, sizeof(name), "sched_%d_%d_o", i,
> >> j);
> >> +                       p.sched.sync = ODP_SCHED_SYNC_ORDERED;
> >> +                       q = odp_queue_create(name, ODP_QUEUE_TYPE_SCHED,
> >> &p);
> >> +
> >> +                       if (q == ODP_QUEUE_INVALID) {
> >> +                               printf("Schedule queue create
> failed.\n");
> >> +                               return -1;
> >> +                       }
> >> +               }
> >> +       }
> >
> >
> > I find the detail obscures the intent with these large loops in loops. A
> > comment would help, however better than that could it self document and
> be a
> > function that creates a given number of named queues with a name to
> match ?
> > Maybe this would become something used by other tests ?
>
> I don't think I catch your drift, do you mean adding a new function
> that creates a queue? to which you pass sched type and name?
>


I meant that the program flow would be clearer with a sub routine.

It could be as it is now where it calls ODP functions that describe at a
high level what you intend to happen
and then rather than starting 30 lines code with of loops of loops with

for (i = 0; i < prios; i++) {
....
....

It said instead create_quesues_for_tests ( args ......)

Making this overall function easier to comprehend at a glance, just a
suggestion.


>
> snip .......
>
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to