aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-03-17 18:09:55 -0400
committerSteven Rostedt <srostedt@redhat.com>2009-03-17 23:10:35 -0400
commitaf4617bdba34aa556272b34c3986b0a4d588f568 (patch)
treec46a6b695724ee27c0113f6affcebeffcefbcf23 /kernel
parent37886f6a9f62d22530ffee8d3f9215c8345b6969 (diff)
tracing: add global-clock option to provide cross CPU clock to traces
Impact: feature to allow better serialized clock This patch adds an option called "global-clock" that will allow the tracer to switch to a slower but more accurate (across CPUs) clock. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.c34
-rw-r--r--kernel/trace/trace.h1
2 files changed, 31 insertions, 4 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 3be2f788e10d..2f994caab0b7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -315,6 +315,7 @@ static const char *trace_options[] = {
315 "printk-msg-only", 315 "printk-msg-only",
316 "context-info", 316 "context-info",
317 "latency-format", 317 "latency-format",
318 "global-clock",
318 NULL 319 NULL
319}; 320};
320 321
@@ -2251,6 +2252,34 @@ static int set_tracer_option(struct tracer *trace, char *cmp, int neg)
2251 return 0; 2252 return 0;
2252} 2253}
2253 2254
2255static void set_tracer_flags(unsigned int mask, int enabled)
2256{
2257 /* do nothing if flag is already set */
2258 if (!!(trace_flags & mask) == !!enabled)
2259 return;
2260
2261 if (enabled)
2262 trace_flags |= mask;
2263 else
2264 trace_flags &= ~mask;
2265
2266 if (mask == TRACE_ITER_GLOBAL_CLK) {
2267 u64 (*func)(void);
2268
2269 if (enabled)
2270 func = trace_clock_global;
2271 else
2272 func = trace_clock_local;
2273
2274 mutex_lock(&trace_types_lock);
2275 ring_buffer_set_clock(global_trace.buffer, func);
2276
2277 if (max_tr.buffer)
2278 ring_buffer_set_clock(max_tr.buffer, func);
2279 mutex_unlock(&trace_types_lock);
2280 }
2281}
2282
2254static ssize_t 2283static ssize_t
2255tracing_trace_options_write(struct file *filp, const char __user *ubuf, 2284tracing_trace_options_write(struct file *filp, const char __user *ubuf,
2256 size_t cnt, loff_t *ppos) 2285 size_t cnt, loff_t *ppos)
@@ -2278,10 +2307,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf,
2278 int len = strlen(trace_options[i]); 2307 int len = strlen(trace_options[i]);
2279 2308
2280 if (strncmp(cmp, trace_options[i], len) == 0) { 2309 if (strncmp(cmp, trace_options[i], len) == 0) {
2281 if (neg) 2310 set_tracer_flags(1 << i, !neg);
2282 trace_flags &= ~(1 << i);
2283 else
2284 trace_flags |= (1 << i);
2285 break; 2311 break;
2286 } 2312 }
2287 } 2313 }
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index b0ecad8ecc34..26a7a28ca110 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -667,6 +667,7 @@ enum trace_iterator_flags {
667 TRACE_ITER_PRINTK_MSGONLY = 0x10000, 667 TRACE_ITER_PRINTK_MSGONLY = 0x10000,
668 TRACE_ITER_CONTEXT_INFO = 0x20000, /* Print pid/cpu/time */ 668 TRACE_ITER_CONTEXT_INFO = 0x20000, /* Print pid/cpu/time */
669 TRACE_ITER_LATENCY_FMT = 0x40000, 669 TRACE_ITER_LATENCY_FMT = 0x40000,
670 TRACE_ITER_GLOBAL_CLK = 0x80000,
670}; 671};
671 672
672/* 673/*