mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 15:33:28 +00:00
In order to promote interoperability between userspace tracers and ftrace, add a trace_clock that reports raw TSC values which will then be recorded in the ring buffer. Userspace tracers that also record TSCs are then on exactly the same time base as the kernel and events can be unambiguously interlaced. Tested: Enabled a tracepoint and the "tsc" trace_clock and saw very large timestamp values. v2: Move arch-specific bits out of generic code. v3: Rename "x86-tsc", cleanups v7: Generic arch bits in Kbuild. Google-Bug-Id: 6980623 Link: http://lkml.kernel.org/r/[email protected] Acked-by: Ingo Molnar <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Signed-off-by: David Sharp <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
22 lines
335 B
C
22 lines
335 B
C
/*
|
|
* X86 trace clocks
|
|
*/
|
|
#include <asm/trace_clock.h>
|
|
#include <asm/barrier.h>
|
|
#include <asm/msr.h>
|
|
|
|
/*
|
|
* trace_clock_x86_tsc(): A clock that is just the cycle counter.
|
|
*
|
|
* Unlike the other clocks, this is not in nanoseconds.
|
|
*/
|
|
u64 notrace trace_clock_x86_tsc(void)
|
|
{
|
|
u64 ret;
|
|
|
|
rdtsc_barrier();
|
|
rdtscll(ret);
|
|
|
|
return ret;
|
|
}
|