From: Pierre-Marc Fournier Date: Thu, 30 Jul 2009 19:30:50 +0000 (-0400) Subject: change to tsc trace clock X-Git-Tag: v1.9.1~942 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5f0046615cbb4f36d0c70199b40df7537e438198;p=lttng-ust.git change to tsc trace clock --- diff --git a/share/kernelcompat.h b/share/kernelcompat.h index 57d12f83..fada46f0 100644 --- a/share/kernelcompat.h +++ b/share/kernelcompat.h @@ -152,31 +152,31 @@ static __inline__ int get_count_order(unsigned int count) /* TRACE CLOCK */ -//ust// static inline u64 trace_clock_read64(void) -//ust// { -//ust// uint32_t low; -//ust// uint32_t high; -//ust// uint64_t retval; -//ust// __asm__ volatile ("rdtsc\n" : "=a" (low), "=d" (high)); -//ust// -//ust// retval = high; -//ust// retval <<= 32; -//ust// return retval | low; -//ust// } - static inline u64 trace_clock_read64(void) { - struct timeval tv; - u64 retval; - - gettimeofday(&tv, NULL); - retval = tv.tv_sec; - retval *= 1000000; - retval += tv.tv_usec; - - return retval; + uint32_t low; + uint32_t high; + uint64_t retval; + __asm__ volatile ("rdtsc\n" : "=a" (low), "=d" (high)); + + retval = high; + retval <<= 32; + return retval | low; } +//static inline u64 trace_clock_read64(void) +//{ +// struct timeval tv; +// u64 retval; +// +// gettimeofday(&tv, NULL); +// retval = tv.tv_sec; +// retval *= 1000000; +// retval += tv.tv_usec; +// +// return retval; +//} + static inline u64 trace_clock_frequency(void) { return 1000000LL;