Move immediate.h, marker.h and tracepoint.h to include/ust/
[ust.git] / share / kernelcompat.h
index 63964888e6de5f93850e230ea899d047d0c75d6b..5cc5eaa22e70b963795619b963c1c2f8ed9504da 100644 (file)
@@ -3,8 +3,6 @@
 
 #include <kcompat.h>
 
-#include "compiler.h"
-
 #include <string.h>
 #include <sys/time.h>
 
@@ -93,8 +91,6 @@ static inline long IS_ERR(const void *ptr)
 /* ATTRIBUTES */
 
 #define ____cacheline_aligned
-#define __init
-#define __exit
 
 /* MATH */
 
@@ -142,7 +138,7 @@ static __inline__ int get_count_order(unsigned int count)
 #define __ALIGN_MASK(x,mask)   (((x)+(mask))&~(mask))
 #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
 #define PAGE_SIZE sysconf(_SC_PAGE_SIZE)
-#define PAGE_MASK (PAGE_SIZE-1)
+#define PAGE_MASK (~(PAGE_SIZE-1))
 
 
 
@@ -153,17 +149,35 @@ 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// }
+/* 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;
+       uint32_t high;
+       uint64_t retval;
+       __asm__ volatile ("rdtsc\n" : "=a" (low), "=d" (high));
+
+       retval = high;
+       retval <<= 32;
+       return retval | low;
+}
+#endif
 
 static inline u64 trace_clock_read64(void)
 {
@@ -189,14 +203,4 @@ static inline u32 trace_clock_freq_scale(void)
 }
 
 
-/* LISTS */
-
-#define list_add_rcu list_add
-#define list_for_each_entry_rcu list_for_each_entry
-
-
-#define EXPORT_SYMBOL_GPL(a) /*nothing*/
-
-#define smp_processor_id() (-1)
-
 #endif /* KERNELCOMPAT_H */
This page took 0.022798 seconds and 4 git commands to generate.