diff mbox

[1/2] example: odp_timer_simple: decrease timer pool resolution

Message ID 1468862206-25102-1-git-send-email-brian.brooks@linaro.org
State Accepted
Commit 25f82fc54a78100098eae5b22719571b6991c955
Headers show

Commit Message

Brian Brooks July 18, 2016, 5:16 p.m. UTC
POSIX timer overruns are experienced on Linux generic platforms
when resolution is less than one millisecond. Decrease resolution
from 10 microseconds to 10 milliseconds so this example program
works as intended on generic Linux platforms.

Signed-off-by: Brian Brooks <brian.brooks@linaro.org>

---
 example/timer/odp_timer_simple.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.9.0

Comments

Mike Holmes July 18, 2016, 5:41 p.m. UTC | #1
Is 10 milliseconds adequate for real work ?

Should this be in some way calculated depending on the platform
capabilities where it is executes since this example will also be run  on
real HW accelerated systems and for those I assume we want the better
resolution.

On 18 July 2016 at 13:16, Brian Brooks <brian.brooks@linaro.org> wrote:

> POSIX timer overruns are experienced on Linux generic platforms

> when resolution is less than one millisecond. Decrease resolution

> from 10 microseconds to 10 milliseconds so this example program

> works as intended on generic Linux platforms.

>

> Signed-off-by: Brian Brooks <brian.brooks@linaro.org>

> ---

>  example/timer/odp_timer_simple.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/example/timer/odp_timer_simple.c

> b/example/timer/odp_timer_simple.c

> index 98c08ce..70804bb 100644

> --- a/example/timer/odp_timer_simple.c

> +++ b/example/timer/odp_timer_simple.c

> @@ -61,8 +61,8 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)

>         /*

>          * Create pool of timeouts

>          */

> -       tparams.res_ns = 10 * ODP_TIME_USEC_IN_NS;

> -       tparams.min_tmo = 10 * ODP_TIME_USEC_IN_NS;

> +       tparams.res_ns = 10 * ODP_TIME_MSEC_IN_NS;

> +       tparams.min_tmo = 10 * ODP_TIME_MSEC_IN_NS;

>         tparams.max_tmo = 1 * ODP_TIME_SEC_IN_NS;

>         tparams.num_timers = 1; /* One timer per worker */

>         tparams.priv = 0; /* Shared */

> --

> 2.9.0

>

>



-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Brian Brooks July 18, 2016, 6:29 p.m. UTC | #2
On 07/18 13:41:32, Mike Holmes wrote:
> Is 10 milliseconds adequate for real work ?

> 

> Should this be in some way calculated depending on the platform

> capabilities where it is executes since this example will also be run  on

> real HW accelerated systems and for those I assume we want the better

> resolution.


I think you just created a new feature request. :) Enable applications to
discover the maximum timer pool resolution supported by the platform.

This example app expires its timers every two seconds, so this patch just
tweaks it to work (it failed on my machine) with the reference implementation
on a generic Linux platform.
Yi He Oct. 21, 2016, 6:17 a.m. UTC | #3
Reply for Kevin Wang to add his review.

Best Regards, Yi

On 19 July 2016 at 02:29, Brian Brooks <brian.brooks@linaro.org> wrote:

> On 07/18 13:41:32, Mike Holmes wrote:

> > Is 10 milliseconds adequate for real work ?

> >

> > Should this be in some way calculated depending on the platform

> > capabilities where it is executes since this example will also be run  on

> > real HW accelerated systems and for those I assume we want the better

> > resolution.

>

> I think you just created a new feature request. :) Enable applications to

> discover the maximum timer pool resolution supported by the platform.

>

> This example app expires its timers every two seconds, so this patch just

> tweaks it to work (it failed on my machine) with the reference

> implementation

> on a generic Linux platform.

>
Kevin Wang Oct. 21, 2016, 7:10 a.m. UTC | #4
Reviewed-by: Kevin Wang <kevin.wang@linaro.org>


On 21 October 2016 at 14:17, Yi He <yi.he@linaro.org> wrote:

> Reply for Kevin Wang to add his review.

>

> Best Regards, Yi

>

> On 19 July 2016 at 02:29, Brian Brooks <brian.brooks@linaro.org> wrote:

>

>> On 07/18 13:41:32, Mike Holmes wrote:

>> > Is 10 milliseconds adequate for real work ?

>> >

>> > Should this be in some way calculated depending on the platform

>> > capabilities where it is executes since this example will also be run

>> on

>> > real HW accelerated systems and for those I assume we want the better

>> > resolution.

>>

>> I think you just created a new feature request. :) Enable applications to

>> discover the maximum timer pool resolution supported by the platform.

>>

>> This example app expires its timers every two seconds, so this patch just

>> tweaks it to work (it failed on my machine) with the reference

>> implementation

>> on a generic Linux platform.

>>

>

>



-- 
Thanks,
Kevin
Maxim Uvarov Oct. 21, 2016, 1:17 p.m. UTC | #5
Merged both patches. Second one with my review only.

Maxim.

On 10/21/16 10:10, Kevin Wang wrote:
> Reviewed-by: Kevin Wang <kevin.wang@linaro.org>

>

> On 21 October 2016 at 14:17, Yi He <yi.he@linaro.org> wrote:

>

>> Reply for Kevin Wang to add his review.

>>

>> Best Regards, Yi

>>

>> On 19 July 2016 at 02:29, Brian Brooks <brian.brooks@linaro.org> wrote:

>>

>>> On 07/18 13:41:32, Mike Holmes wrote:

>>>> Is 10 milliseconds adequate for real work ?

>>>>

>>>> Should this be in some way calculated depending on the platform

>>>> capabilities where it is executes since this example will also be run

>>> on

>>>> real HW accelerated systems and for those I assume we want the better

>>>> resolution.

>>> I think you just created a new feature request. :) Enable applications to

>>> discover the maximum timer pool resolution supported by the platform.

>>>

>>> This example app expires its timers every two seconds, so this patch just

>>> tweaks it to work (it failed on my machine) with the reference

>>> implementation

>>> on a generic Linux platform.

>>>

>>

>
diff mbox

Patch

diff --git a/example/timer/odp_timer_simple.c b/example/timer/odp_timer_simple.c
index 98c08ce..70804bb 100644
--- a/example/timer/odp_timer_simple.c
+++ b/example/timer/odp_timer_simple.c
@@ -61,8 +61,8 @@  int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
 	/*
 	 * Create pool of timeouts
 	 */
-	tparams.res_ns = 10 * ODP_TIME_USEC_IN_NS;
-	tparams.min_tmo = 10 * ODP_TIME_USEC_IN_NS;
+	tparams.res_ns = 10 * ODP_TIME_MSEC_IN_NS;
+	tparams.min_tmo = 10 * ODP_TIME_MSEC_IN_NS;
 	tparams.max_tmo = 1 * ODP_TIME_SEC_IN_NS;
 	tparams.num_timers = 1; /* One timer per worker */
 	tparams.priv = 0; /* Shared */