diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-03-17 17:22:06 -0400 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-03-17 23:06:31 -0400 |
commit | 37886f6a9f62d22530ffee8d3f9215c8345b6969 (patch) | |
tree | 046c9086682145fd2808af7197af669f08be6d0a /kernel/trace/trace.c | |
parent | 6adaad14d7d4d3ef31b4e2dc992b18b5da7c4eb3 (diff) | |
download | lwn-37886f6a9f62d22530ffee8d3f9215c8345b6969.tar.gz lwn-37886f6a9f62d22530ffee8d3f9215c8345b6969.zip |
ring-buffer: add api to allow a tracer to change clock source
This patch adds a new function called ring_buffer_set_clock that
allows a tracer to assign its own clock source to the buffer.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 8f89690230e6..3be2f788e10d 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -155,13 +155,6 @@ ns2usecs(cycle_t nsec) return nsec; } -cycle_t ftrace_now(int cpu) -{ - u64 ts = ring_buffer_time_stamp(cpu); - ring_buffer_normalize_time_stamp(cpu, &ts); - return ts; -} - /* * The global_trace is the descriptor that holds the tracing * buffers for the live tracing. For each CPU, it contains @@ -178,6 +171,20 @@ static struct trace_array global_trace; static DEFINE_PER_CPU(struct trace_array_cpu, global_trace_cpu); +cycle_t ftrace_now(int cpu) +{ + u64 ts; + + /* Early boot up does not have a buffer yet */ + if (!global_trace.buffer) + return trace_clock_local(); + + ts = ring_buffer_time_stamp(global_trace.buffer, cpu); + ring_buffer_normalize_time_stamp(global_trace.buffer, cpu, &ts); + + return ts; +} + /* * The max_tr is used to snapshot the global_trace when a maximum * latency is reached. Some tracers will use this to store a maximum |