Message ID | 1435927118-12397-3-git-send-email-ivan.khoronzhuk@linaro.org |
---|---|
State | New |
Headers | show |
Patch has warnings Using patch: lng-odp_Patch_2-2_example_timer_use_ability_to_indicate_that_event_was_lost.mbox Trying to apply patch Patch applied WARNING: line over 80 characters #40: FILE: example/timer/odp_timer_test.c:147: + if (++wait > WAIT_NUM && odp_atomic_load_u32(&gbls->remain) On 3 July 2015 at 08:38, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> wrote: > In case if for some reason one of the TMOs was lost, the test will > be polling forever in order to take it and delete. It can be used to > indicate that event was lost. Just abort the test if it cannot receive > one of the "last" TMOs for some period. > > Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> > --- > example/timer/odp_timer_test.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/example/timer/odp_timer_test.c > b/example/timer/odp_timer_test.c > index 584a581..906bd15 100644 > --- a/example/timer/odp_timer_test.c > +++ b/example/timer/odp_timer_test.c > @@ -21,6 +21,7 @@ > > #define MAX_WORKERS 32 /**< Max worker threads */ > #define NUM_TMOS 10000 /**< Number of timers */ > +#define WAIT_NUM 10 /**< Max tries to rx last tmo per > worker */ > > > /** Test arguments */ > @@ -141,6 +142,7 @@ static void test_abs_timeouts(int thr, test_globals_t > *gbls) > tick = odp_timer_current_tick(gbls->tp); > > while (1) { > + int wait = 0; > odp_event_t ev; > odp_timer_set_t rc; > > @@ -166,6 +168,9 @@ static void test_abs_timeouts(int thr, test_globals_t > *gbls) > ev = odp_schedule(&queue, sched_tmo); > /* Check if odp_schedule() timed out, possibly > there > * are no remaining timeouts to receive */ > + if (++wait > WAIT_NUM && > odp_atomic_load_u32(&gbls->remain) > + < gbls->num_workers) > + EXAMPLE_ABORT("At least one TMO was > lost\n"); > } while (ev == ODP_EVENT_INVALID && > (int)odp_atomic_load_u32(&gbls->remain) > 0); > > -- > 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 584a581..906bd15 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -21,6 +21,7 @@ #define MAX_WORKERS 32 /**< Max worker threads */ #define NUM_TMOS 10000 /**< Number of timers */ +#define WAIT_NUM 10 /**< Max tries to rx last tmo per worker */ /** Test arguments */ @@ -141,6 +142,7 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) tick = odp_timer_current_tick(gbls->tp); while (1) { + int wait = 0; odp_event_t ev; odp_timer_set_t rc; @@ -166,6 +168,9 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) ev = odp_schedule(&queue, sched_tmo); /* Check if odp_schedule() timed out, possibly there * are no remaining timeouts to receive */ + if (++wait > WAIT_NUM && odp_atomic_load_u32(&gbls->remain) + < gbls->num_workers) + EXAMPLE_ABORT("At least one TMO was lost\n"); } while (ev == ODP_EVENT_INVALID && (int)odp_atomic_load_u32(&gbls->remain) > 0);
In case if for some reason one of the TMOs was lost, the test will be polling forever in order to take it and delete. It can be used to indicate that event was lost. Just abort the test if it cannot receive one of the "last" TMOs for some period. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> --- example/timer/odp_timer_test.c | 5 +++++ 1 file changed, 5 insertions(+)