diff options
-rw-r--r-- | src/modules/flow/ff.c | 2 | ||||
-rw-r--r-- | src/modules/flow/flow.c | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/modules/flow/ff.c b/src/modules/flow/ff.c index f4280b9..98ac597 100644 --- a/src/modules/flow/ff.c +++ b/src/modules/flow/ff.c @@ -41,7 +41,7 @@ ff_t * ff_free(ff_t *ff) ff_t * ff_new(unsigned size, void (*populator)(void *context, unsigned size, const ff_data_t *other, ff_data_t *field), void *context) { - ff_t *ff; + ff_t *ff; ff = calloc(1, sizeof(ff_t)); if (!ff) diff --git a/src/modules/flow/flow.c b/src/modules/flow/flow.c index c26817a..86632a0 100644 --- a/src/modules/flow/flow.c +++ b/src/modules/flow/flow.c @@ -137,15 +137,16 @@ static til_module_context_t * flow_create_context(const til_module_t *module, ti if (!ctxt) return NULL; + ctxt->n_elements_per_cpu = elements_per_cpu; + ctxt->n_elements = elements_per_cpu * n_cpus; + ctxt->ff = ff_new(s->size, flow_ff_populator, ctxt); if (!ctxt->ff) return til_module_context_free(&ctxt->til_module_context); - for (unsigned i = 0; i < s->count; i++) + for (unsigned i = 0; i < ctxt->n_elements; i++) ctxt->elements[i] = rand_element(&ctxt->til_module_context.seed); - ctxt->n_elements_per_cpu = elements_per_cpu; - ctxt->n_elements = elements_per_cpu * n_cpus; ctxt->taps.speed = til_tap_init_float(ctxt, &ctxt->speed, 1, &ctxt->vars.speed, "speed"); flow_update_taps(ctxt, stream); |