diff mbox

[1/3,v2] example: timer: warn if timeout less than resolution

Message ID 1447166428-23791-2-git-send-email-ivan.khoronzhuk@linaro.org
State Superseded
Headers show

Commit Message

Ivan Khoronzhuk Nov. 10, 2015, 2:40 p.m. UTC
The period shouldn't be less than timer resolution. If it's less
there is no guarantee about timeout accuracy, it can be executed
right after setting it or after up to timer resolution timeout or
even be set late, in which case application will be stopped with
error. So it's better to warn user that timeout is less then
resolution instead of silence.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 example/timer/odp_timer_test.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 94619e4..aee01c8 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -311,6 +311,9 @@  static void parse_args(int argc, char *argv[], test_args_t *args)
 			break;
 		}
 	}
+
+	if (args->period_us < args->resolution_us)
+		printf("\n\tWarn: timeout is set less then resolution\n");
 }