X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=share%2Fkernelcompat.h;h=5cc5eaa22e70b963795619b963c1c2f8ed9504da;hb=93d0f2eaff675059588e958e3de74a1bb7dd4028;hp=2a8e0f253d1158e637d53f130eea3ca49de8b241;hpb=08230db7e2e536bddf0015fa663b6d10abea30f1;p=ust.git diff --git a/share/kernelcompat.h b/share/kernelcompat.h index 2a8e0f2..5cc5eaa 100644 --- a/share/kernelcompat.h +++ b/share/kernelcompat.h @@ -1,7 +1,6 @@ #ifndef KERNELCOMPAT_H #define KERNELCOMPAT_H -#include #include #include @@ -150,6 +149,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 +177,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 +191,6 @@ static inline u64 trace_clock_read64(void) return retval; } -#endif static inline u64 trace_clock_frequency(void) {