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) |
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) | |||
155 | return nsec; | 155 | return nsec; |
156 | } | 156 | } |
157 | 157 | ||
158 | cycle_t ftrace_now(int cpu) | ||
159 | { | ||
160 | u64 ts = ring_buffer_time_stamp(cpu); | ||
161 | ring_buffer_normalize_time_stamp(cpu, &ts); | ||
162 | return ts; | ||
163 | } | ||
164 | |||
165 | /* | 158 | /* |
166 | * The global_trace is the descriptor that holds the tracing | 159 | * The global_trace is the descriptor that holds the tracing |
167 | * buffers for the live tracing. For each CPU, it contains | 160 | * buffers for the live tracing. For each CPU, it contains |
@@ -178,6 +171,20 @@ static struct trace_array global_trace; | |||
178 | 171 | ||
179 | static DEFINE_PER_CPU(struct trace_array_cpu, global_trace_cpu); | 172 | static DEFINE_PER_CPU(struct trace_array_cpu, global_trace_cpu); |
180 | 173 | ||
174 | cycle_t ftrace_now(int cpu) | ||
175 | { | ||
176 | u64 ts; | ||
177 | |||
178 | /* Early boot up does not have a buffer yet */ | ||
179 | if (!global_trace.buffer) | ||
180 | return trace_clock_local(); | ||
181 | |||
182 | ts = ring_buffer_time_stamp(global_trace.buffer, cpu); | ||
183 | ring_buffer_normalize_time_stamp(global_trace.buffer, cpu, &ts); | ||
184 | |||
185 | return ts; | ||
186 | } | ||
187 | |||
181 | /* | 188 | /* |
182 | * The max_tr is used to snapshot the global_trace when a maximum | 189 | * The max_tr is used to snapshot the global_trace when a maximum |
183 | * latency is reached. Some tracers will use this to store a maximum | 190 | * latency is reached. Some tracers will use this to store a maximum |