aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/include
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>2011-03-16 19:05:58 -0400
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>2011-03-16 19:05:58 -0400
commite4e9699bcf4b5ea207c859e056bb705e30f06f10 (patch)
treebb004ac5b3d639ebf9830d0430992065a5091d4f /arch/x86/include
parent710944c4e1f7468dba1a0c4fa36b4cda5846f350 (diff)
downloadlinux-linaro-android-e4e9699bcf4b5ea207c859e056bb705e30f06f10.tar.gz
trace-clock-userspace
TRACE_CLOCK and TRACE_CLOCK_FREQ in clock_gettime These new options to clock_gettime allows the user to retreive the TSC frequency and the current TSC from userspace. We use the LTTng infrastructure to make sure the TSC is synchronized. If it is not, we fallback to a syscall (which for the moment does the same thing but in the future will be modified to ensure consistency for the tracing between user and kernel space). The main difference with using the TSC clocksource directly is that the time starts at machine boot and not at Linux boot which makes it possible to correlate user and kernelspace events. Also we export frequency and cycles, we don't do the conversion in sec.nsec from the kernel since we don't need it. The differences between the v1 are : - we validated on 32 bits the clock_gettime vDSO doesn't exist so it cleans up the vDSO code; - the syscall is now properly defined using the posix timer architecture - we export the frequency to userspace so we don't need to convert the cycles in sec.nsec anymore. Which means that on 64 bits machine, the nsec field will contain the whole cycle counter and on 32 bits the value is split between the two fields sec and nsec. - remove the rdtsc_barrier() which is overkill for tracing purpose - trace_clock_is_sync field is updated as soon as the LTTng trace clock detects an inconsistency Updated benchmarks (with 20000000 iterations reading the tsc before and after each call on an i7 920): 64 bits with vDSO average cycles for clock_realtime: 101 average cycles for clock_monotonic: 104 average cycles for clock_trace: 52 64 bits without vDSO (using syscall) average cycles for clock_realtime: 240 average cycles for clock_monotonic: 256 average cycles for clock_trace: 219 32 bits (without vDSO) average cycles for clock_realtime: 649 average cycles for clock_monotonic: 661 average cycles for clock_trace: 616 Signed-off-by: Julien Desfossez <julien.desfossez@polymtl.ca> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Diffstat (limited to 'arch/x86/include')
-rw-r--r--arch/x86/include/asm/trace-clock.h7
-rw-r--r--arch/x86/include/asm/vgtod.h1
-rw-r--r--arch/x86/include/asm/vsyscall.h8
3 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86/include/asm/trace-clock.h b/arch/x86/include/asm/trace-clock.h
index 5f6a36684c9..8ca73323366 100644
--- a/arch/x86/include/asm/trace-clock.h
+++ b/arch/x86/include/asm/trace-clock.h
@@ -11,12 +11,19 @@
*/
#include <linux/timex.h>
+#include <linux/time.h>
#include <asm/system.h>
#include <asm/processor.h>
#include <asm/atomic.h>
/* Minimum duration of a probe, in cycles */
#define TRACE_CLOCK_MIN_PROBE_DURATION 200
+#define TRACE_CLOCK_RES TRACE_CLOCK_MIN_PROBE_DURATION
+
+union lttng_timespec {
+ struct timespec ts;
+ u64 lttng_ts;
+};
extern cycles_t trace_clock_async_tsc_read(void);
diff --git a/arch/x86/include/asm/vgtod.h b/arch/x86/include/asm/vgtod.h
index 3d61e204826..06abe8f409a 100644
--- a/arch/x86/include/asm/vgtod.h
+++ b/arch/x86/include/asm/vgtod.h
@@ -12,6 +12,7 @@ struct vsyscall_gtod_data {
u32 wall_time_nsec;
int sysctl_enabled;
+ int trace_clock_is_sync;
struct timezone sys_tz;
struct { /* extract of a clocksource struct */
cycle_t (*vread)(void);
diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h
index d0983d255fb..47b80f3ba4d 100644
--- a/arch/x86/include/asm/vsyscall.h
+++ b/arch/x86/include/asm/vsyscall.h
@@ -39,6 +39,14 @@ extern struct timezone sys_tz;
extern void map_vsyscall(void);
+#ifdef CONFIG_X86_64
+extern void update_trace_clock_is_sync_vdso(void);
+#else
+static inline void update_trace_clock_is_sync_vdso(void)
+{
+}
+#endif
+
#endif /* __KERNEL__ */
#endif /* _ASM_X86_VSYSCALL_H */