Message ID | 1447169760-15258-2-git-send-email-ivan.khoronzhuk@linaro.org |
---|---|
State | Superseded |
Headers | show |
On 10 November 2015 at 15:35, 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. > > Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> 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"); You could also warn if the timeout is not an (integer) multiple of the resolution but that is less of a problem. > } > > > -- > 1.9.1 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp
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"); }
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(+)