> You multiply seconds by 1,000,000,000 and add the nanoseconds to get the > epoch > offset in terms of nanoseconds - this can be stored in a uint64_t. And, > now you > can "spec" that time is in terms of nanoseconds not "implementation > defined". > The application can now do arithmetic too. > > > Third, compression/conversion usually mean division operation. Division > is tens of times heavier operation than sum, dec, mult. Currently, ODP API > is defined so that conversion is done only when application asks for it > (odp_time_t <-> nsec time). Compression is a trade-off between storage > space size and performance. > > I prefer to measure. Perhaps time operations using CPU tick masked by a > timespec > should be added here: > > > https://git.linaro.org/people/ola.liljedahl/sw_scheduler.git/tree/time_ben > ch.c > > Taking the difference between two 64-bit values and calling > nsec_from_cntr() is > quite fast - as fast (faster on ARM) as calling clock_gettime() once > through the vDSO. >
Realized after sending yesterday that timespec is pretty fast to convert into nsec. So, I did add that as the last patch of v3. So, size of odp_time_t (in odp-linux) is 64 bits after this set. Hopefully, everybody are happy with this now. I'd really like to work one change at the time: first take HW time counter into use, then optimize timespec implementation, etc. One problem, one patch set. -Petri
