diff mbox

[PATCHv5,6/6] validation: odp_timer.c: run at least one thread

Message ID 1423124161-18716-7-git-send-email-ola.liljedahl@linaro.org
State Accepted
Commit 339b9e32da12cbbff4d2b9d74f40a6fc68ed1102
Headers show

Commit Message

Ola Liljedahl Feb. 5, 2015, 8:16 a.m. UTC
Ensure we run at least one worker thread.

Signed-off-by: Ola Liljedahl <ola.liljedahl@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 mbox

Patch

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;