Dmitry Eremin-Solenikov(lumag) replied on github web page: test/validation/api/time/time.c line 19 @@ -423,11 +423,12 @@ static void time_test_accuracy(time_cb time_cur, time_from_ns_cb time_from_ns) { int i; odp_time_t t1, t2, wait, diff; - clock_t c1, c2; + struct timeval tv1, tv2, tvdiff; double sec_t, sec_c; odp_time_t sec = time_from_ns(ODP_TIME_SEC_IN_NS); - c1 = clock(); + i = gettimeofday(&tv1, NULL);
Comment: Nice idea, I will update this PR. > muvarov wrote > Ok, Than. Agree. >> muvarov wrote >> also please add link to bugz if it's bug fix to git comment. >>> muvarov wrote >>> gettimeofday() may be changed on NTP/PTP and it's not good for measuring >>> intervals. clock_gettime(CLOCK_MONOTONIC, ...) I think will be good one >>> here. >>>> Dmitry Eremin-Solenikov(lumag) wrote: >>>> This example is not generic enough. It uses atomic primitives directly. >>>>> muvarov wrote >>>>> This kind of thing which is better to avoid. If we are going to merge odp >>>>> implementations platforms to common repo then it might be libs which are >>>>> suitable for linux-generic are not needed for other platform. I think >>>>> examples Makefiles have to be more common. >>>>>> Dmitry Eremin-Solenikov(lumag) wrote: >>>>>> I will change that to `gettimeofday()`. >>>>>>> Petri Savolainen(psavol) wrote: >>>>>>> time_t is an integer value of seconds, right? sec_c is the reference >>>>>>> that we compare ODP time measurement against. Test passes if ODP >>>>>>> measures within +-5% the reference. Usage of time() change the >>>>>>> reference to be very coarse grained (e.g. 4, 5 or 6 sec), while the >>>>>>> real time spent on the wait loop may be e.g. 5.453 sec and ODP may >>>>>>> measure 5.461 sec and the time() measures just 5.0 sec. So, test result >>>>>>> would be "fail" (5.461 vs 5.0) although ODP measurement error was >>>>>>> only+0.14% (5.461 vs 5.453). >>>>>>>> Dmitry Eremin-Solenikov(lumag) wrote: >>>>>>>> Well, no. Please recheck. I will update description to mention that is >>>>>>>> means static linking of libodp-linux into examples. >>>>>>>>> muvarov wrote >>>>>>>>> At his time if --disable-static-link is specified then linking is >>>>>>>>> static. If it's not specified that it's dynamic. I'm looking on >>>>>>>>> odp_generator. https://github.com/Linaro/odp/pull/377#discussion_r161400055 updated_at 2018-01-14 14:50:03