2 * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com)
4 * Contains LTTng trace clock mapping to LTTng trace clock or mainline monotonic
5 * clock. This wrapper depends on CONFIG_HIGH_RES_TIMERS=y.
7 * Dual LGPL v2.1/GPL v2 license.
10 #ifndef _LTT_TRACE_CLOCK_H
11 #define _LTT_TRACE_CLOCK_H
13 #ifdef CONFIG_HAVE_TRACE_CLOCK
14 #include <linux/trace-clock.h>
15 #else /* CONFIG_HAVE_TRACE_CLOCK */
17 #include <linux/hardirq.h>
18 #include <linux/ktime.h>
19 #include <linux/time.h>
20 #include <linux/hrtimer.h>
22 static inline u64
trace_clock_monotonic_wrapper(void)
27 * Refuse to trace from NMIs with this wrapper, because an NMI could
28 * nest over the xtime write seqlock and deadlock.
34 return (u64
) ktime
.tv64
;
37 static inline u32
trace_clock_read32(void)
39 return (u32
) trace_clock_monotonic_wrapper();
42 static inline u64
trace_clock_read64(void)
44 return (u64
) trace_clock_monotonic_wrapper();
47 static inline u64
trace_clock_frequency(void)
49 return (u64
)NSEC_PER_SEC
;
52 static inline u32
trace_clock_freq_scale(void)
57 static inline int get_trace_clock(void)
59 printk(KERN_WARNING
"LTTng: Using mainline kernel monotonic clock.\n");
60 printk(KERN_WARNING
" * NMIs will not be traced,\n");
61 printk(KERN_WARNING
" * expect significant performance degradation compared to the\n");
62 printk(KERN_WARNING
" LTTng trace clocks.\n");
63 printk(KERN_WARNING
"You should consider deploying a kernel with the the LTTng kernel\n");
64 printk(KERN_WARNING
"patches, or, better, ask the Linux tracing maintainers to integrate\n");
65 printk(KERN_WARNING
"them if you care deeply about this.\n");
67 #warning "LTTng: Using mainline kernel monotonic clock. NMIs will not be traced, and expect significant performance degradation compared to the LTTng trace clocks. You should consider deploying a kernel with the the LTTng kernel patches, or, better, ask the Linux tracing maintainers to integrate them if you care deeply about this."
72 static inline void put_trace_clock(void)
76 #endif /* CONFIG_HAVE_TRACE_CLOCK */
78 #endif /* _LTT_TRACE_CLOCK_H */
This page took 0.031164 seconds and 4 git commands to generate.