From: Pierre-Marc Fournier Date: Wed, 16 Sep 2009 04:47:52 +0000 (-0400) Subject: restore gettimeofday()-based time source X-Git-Tag: v1.9.1~912 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=79cb25368d3d2069c7189c45ccb751c9f9fcc59d;p=lttng-ust.git restore gettimeofday()-based time source Because we don't have appropriate frequency and scale functions for the tsc time source, it can break lttv by producing timestamps whose seconds value is too high, to the point it breaks lttv. So for now, use gettimeofday(). --- diff --git a/share/kernelcompat.h b/share/kernelcompat.h index 2a8e0f25..219ee118 100644 --- a/share/kernelcompat.h +++ b/share/kernelcompat.h @@ -150,6 +150,23 @@ static __inline__ int get_count_order(unsigned int count) /* TRACE CLOCK */ +/* There are two types of clocks that can be used. + - TSC based clock + - gettimeofday() clock + + Microbenchmarks on Linux 2.6.30 on Core2 Duo 3GHz (functions are inlined): + Calls (100000000) to tsc(): 4004035641 cycles or 40 cycles/call + Calls (100000000) to gettimeofday(): 9723158352 cycles or 97 cycles/call + + For merging traces with the kernel, a time source compatible with that of + the kernel is necessary. + +*/ + +#if 0 +/* WARNING: Make sure to set frequency and scaling functions that will not + * result in lttv timestamps (sec.nsec) with seconds greater than 2**32-1. + */ static inline u64 trace_clock_read64(void) { uint32_t low; @@ -161,8 +178,8 @@ static inline u64 trace_clock_read64(void) retval <<= 32; return retval | low; } +#endif -#if 0 static inline u64 trace_clock_read64(void) { struct timeval tv; @@ -175,7 +192,6 @@ static inline u64 trace_clock_read64(void) return retval; } -#endif static inline u64 trace_clock_frequency(void) {