X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=share%2Fkernelcompat.h;h=9139e75275ddf4c8c3e86d7d30c0916b32233b6d;hb=98963de4a2dfae12d8aafa0f9a6d97cf4a44e12d;hp=b442718e2af19a7e611aa36d03f04118834f6ab8;hpb=c1dea0b3d1312d0e3747da93eb949145c487eeba;p=ust.git diff --git a/share/kernelcompat.h b/share/kernelcompat.h index b442718..9139e75 100644 --- a/share/kernelcompat.h +++ b/share/kernelcompat.h @@ -159,25 +159,25 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, unsigned long prev; switch (size) { case 1: - asm volatile("lock cmpxchgb %b1,%2" + asm volatile("lock; cmpxchgb %b1,%2" : "=a"(prev) : "q"(new), "m"(*__xg(ptr)), "0"(old) : "memory"); return prev; case 2: - asm volatile("lock cmpxchgw %w1,%2" + asm volatile("lock; cmpxchgw %w1,%2" : "=a"(prev) : "r"(new), "m"(*__xg(ptr)), "0"(old) : "memory"); return prev; case 4: - asm volatile("lock cmpxchgl %k1,%2" + asm volatile("lock; cmpxchgl %k1,%2" : "=a"(prev) : "r"(new), "m"(*__xg(ptr)), "0"(old) : "memory"); return prev; case 8: - asm volatile("lock cmpxchgq %1,%2" + asm volatile("lock; cmpxchgq %1,%2" : "=a"(prev) : "r"(new), "m"(*__xg(ptr)), "0"(old) : "memory"); @@ -290,19 +290,39 @@ 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) { - return 0LL; + struct timeval tv; + u64 retval; + + gettimeofday(&tv, NULL); + retval = tv.tv_sec; + retval *= 1000000; + retval += tv.tv_usec; + + return retval; } -static inline unsigned int trace_clock_frequency(void) +static inline u64 trace_clock_frequency(void) { - return 0LL; + return 1000000LL; } static inline u32 trace_clock_freq_scale(void) { - return 0; + return 1; }