Ensure we run at least one worker thread.

Signed-off-by: Ola Liljedahl <ola.liljed...@linaro.org>
---
(This document/code contribution attached is provided under the terms of
agreement LES-LTM-21309)

 test/validation/odp_timer.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 5218406..1f673c0 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -270,9 +270,13 @@ static void test_odp_timer_all(void)
 {
        odp_pool_param_t params;
        odp_timer_pool_param_t tparam;
-       /* This is a stressfull test - need to reserve some cpu cycles
-        * @TODO move to test/performance */
-       int num_workers = min(odp_sys_cpu_count()-1, MAX_WORKERS);
+       /* Reserve at least one core for running other processes so the timer
+        * test hopefully can run undisturbed and thus get better timing
+        * results. */
+       int num_workers = min(odp_sys_cpu_count() - 1, MAX_WORKERS);
+       /* On a single-CPU machine run at least one thread */
+       if (num_workers < 1)
+               num_workers = 1;
 
        /* Create timeout pools */
        params.tmo.num = (NTIMERS + 1) * num_workers;
-- 
1.9.1


_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to