diff mbox

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

Message ID 1447943403-24803-2-git-send-email-ivan.khoronzhuk@linaro.org
State Accepted
Commit dc8984ae27ba81f76634cf1e58489664dc1569c4
Headers show

Commit Message

Ivan Khoronzhuk Nov. 19, 2015, 2:30 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.

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

Comments

Ola Liljedahl Nov. 27, 2015, 7:01 p.m. UTC | #1
On 19 November 2015 at 15:30, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
wrote:

> 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.

>

> Reviewed-by: Ola Liljedahl <ola.liljedahl@linaro.org>

> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

>

You reposted this patch although it was already reviewed. Hereby I approve
of it agan.
Reviewed-by: Ola Liljedahl <ola.liljedahl@linaro.org>



> ---

>  example/timer/odp_timer_test.c | 3 +++

>  1 file changed, 3 insertions(+)

>

> 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");

>  }

>

>

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
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");
 }