From 04cf1d6de47e21b330f377b5e4f0d11cc638d4d9 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Mon, 12 Dec 2011 16:34:33 +0100 Subject: Allow to configure the number of preprocessing threads --- ipecamera/ipecamera.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ipecamera') diff --git a/ipecamera/ipecamera.c b/ipecamera/ipecamera.c index c170174..d963494 100644 --- a/ipecamera/ipecamera.c +++ b/ipecamera/ipecamera.c @@ -407,12 +407,17 @@ int ipecamera_start(pcilib_context_t *vctx, pcilib_event_t event_mask, pcilib_ev if (flags&PCILIB_EVENT_FLAG_PREPROCESS) { ctx->n_preproc = pcilib_get_cpu_count(); + + // it would be greate to detect hyperthreading cores and ban them switch (ctx->n_preproc) { case 1: break; case 2-3: ctx->n_preproc -= 1; break; default: ctx->n_preproc -= 2; break; } - + + if ((vctx->params.parallel.max_threads)&&(vctx->params.parallel.max_threads < ctx->n_preproc)) + ctx->n_preproc = vctx->params.parallel.max_threads; + ctx->preproc = (ipecamera_preprocessor_t*)malloc(ctx->n_preproc * sizeof(ipecamera_preprocessor_t)); if (!ctx->preproc) { ipecamera_stop(vctx, PCILIB_EVENT_FLAGS_DEFAULT); -- cgit v1.2.3