Ola,

The patch with your corrections is included in the series that I sent recently:
"[lng-odp] [PATCH v2 0/5] preparation series before updating odp time API"

On 07.09.15 14:55, Ivan Khoronzhuk wrote:
Ola,

On 07.09.15 14:45, Ola Liljedahl wrote:
On 7 September 2015 at 11:45, Ivan Khoronzhuk <ivan.khoronz...@linaro.org 
<mailto:ivan.khoronz...@linaro.org>> wrote:

    Petri,

    Maybe this peace of code should migrate to some other place,
    but on my opinion it has more common with time API then cpu API.

    The table to check time table mixes time/cycles with timer API example, and 
it
    is confusing a little. Here it doesn't bear any sense except time API has 
something
    common with timer API, but that's not true.

I agree that the code shouldn't be in the timer example. If anything, we could 
print the conversion from ns to timer ticks in the example.

Agree. I'll adopt it for timer.



    Maybe it can be deleted at all, just want to leave it somewhere.


    On 03.09.15 11:50, Ivan Khoronzhuk wrote:

        The linux-generic implements timers supposing that timers are based
        on CPU cycle counter. It's not always true and timer API can have
        nothing common with CPU cycles. Thus timer test shouldn't print
        here conversion cycles/ns table for time API.

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

        I'm not sure about moving the table to validation test, but it can
        be useful to visually see resolution impact.
        This patch should be included in
        "odp-lng] [Patch 0/4] preparation series before updating odp time API"
        https://lists.linaro.org/pipermail/lng-odp/2015-August/014850.html
        But before let's clarify it.

           example/timer/odp_timer_test.c | 21 ---------------------
           test/validation/time/time.c    | 21 ++++++++++++++++++++-
           2 files changed, 20 insertions(+), 22 deletions(-)

        diff --git a/example/timer/odp_timer_test.c 
b/example/timer/odp_timer_test.c
        index 49630b0..6248939 100644
        --- a/example/timer/odp_timer_test.c
        +++ b/example/timer/odp_timer_test.c
        @@ -322,7 +322,6 @@ int main(int argc, char *argv[])
                 odph_linux_pthread_t thread_tbl[MAX_WORKERS];
                 int num_workers;
                 odp_queue_t queue;
        -       uint64_t cycles, ns;
                 odp_queue_param_t param;
                 odp_pool_param_t params;
                 odp_timer_pool_param_t tparams;
        @@ -446,26 +445,6 @@ int main(int argc, char *argv[])
                         return -1;
                 }

        -       printf("CPU freq %"PRIu64" Hz\n", odp_sys_cpu_hz());
        -       printf("Cycles vs nanoseconds:\n");
        -       ns = 0;
        -       cycles = odp_time_ns_to_cycles(ns);
        -
        -       printf("  %12"PRIu64" ns      ->  %12"PRIu64" cycles\n", ns, 
cycles);
        -       printf("  %12"PRIu64" cycles  ->  %12"PRIu64" ns\n", cycles,
        -              odp_time_cycles_to_ns(cycles));
        -
        -       for (ns = 1; ns <= 100*ODP_TIME_SEC; ns *= 10) {
        -               cycles = odp_time_ns_to_cycles(ns);
        -
        -               printf("  %12"PRIu64" ns      ->  %12"PRIu64" 
cycles\n", ns,
        -                      cycles);
        -               printf("  %12"PRIu64" cycles  ->  %12"PRIu64" ns\n", 
cycles,
        -                      odp_time_cycles_to_ns(cycles));
        -       }
        -
        -       printf("\n");
        -
                 gbls->num_workers = num_workers;

                 /* Initialize number of timeouts to receive */
        diff --git a/test/validation/time/time.c b/test/validation/time/time.c
        index 4b81c2c..ae5e77c 100644
        --- a/test/validation/time/time.c
        +++ b/test/validation/time/time.c
        @@ -45,7 +45,7 @@ void time_test_odp_cycles_negative_diff(void)
           /* check that related conversions come back to the same value */
           void time_test_odp_time_conversion(void)
           {
        -       uint64_t ns1, ns2, cycles;
        +       uint64_t ns, ns1, ns2, cycles;
                 uint64_t upper_limit, lower_limit;

                 ns1 = 100;
        @@ -59,6 +59,25 @@ void time_test_odp_time_conversion(void)
                 upper_limit = ns1 + TOLERANCE;
                 lower_limit = ns1 - TOLERANCE;
                 CU_ASSERT((ns2 <= upper_limit) && (ns2 >= lower_limit));
        +
        +       printf("Cycles vs nanoseconds:\n");
        +       ns = 0;
        +       cycles = odp_time_ns_to_cycles(ns);
        +
        +       printf("  %12" PRIu64 " ns      ->  %12" PRIu64 " cycles\n", 
ns, cycles);
        +       printf("  %12" PRIu64 " cycles  ->  %12" PRIu64 " ns\n", cycles,
        +              odp_time_cycles_to_ns(cycles));
        +
        +       for (ns = 1; ns <= 100 * ODP_TIME_SEC; ns *= 10) {
        +               cycles = odp_time_ns_to_cycles(ns);
        +
        +               printf("  %12" PRIu64 " ns      ->  %12" PRIu64 " 
cycles\n", ns,
        +                      cycles);
        +               printf("  %12" PRIu64 " cycles  ->  %12" PRIu64 " 
ns\n", cycles,
        +                      odp_time_cycles_to_ns(cycles));
        +       }
        +
        +       printf("\n");

Creating a new validation test is a different thing (and thus a different 
patch). Also the code above doesn't actually validate anything (there is no 
CU_ASSERT etc), it just prints some information that might be useful for a 
human observer. Is it useful?

Yes. I didn't saw example for time, and probably there is no reason for that.
Also it's not place for validation.
So, no validation test changes here.
Thanks.


           }

           CU_TestInfo time_suite_time[] = {


    --
    Regards,
    Ivan Khoronzhuk

    _______________________________________________
    lng-odp mailing list
    lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
    https://lists.linaro.org/mailman/listinfo/lng-odp




--
Regards,
Ivan Khoronzhuk
_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to