aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-07 08:41:14 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-07 08:41:17 -0400
commit86665c75da41889f92b774f31ea5a9a436f392a8 (patch)
tree94b003ab677a64b7d0a6dcca1f636bbbc2a187c9 /kernel/trace/trace.c
parent93776a8ec746cf9d32c36e5a5b23d28d8be28826 (diff)
parent1bbe2a83ab68e5cf8c66c372c7cb3b51910c2cfe (diff)
Merge branch 'tracing/urgent' into tracing/ftrace
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2a81decf99bc..32653c8c6e26 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -30,6 +30,7 @@
30#include <linux/percpu.h> 30#include <linux/percpu.h>
31#include <linux/splice.h> 31#include <linux/splice.h>
32#include <linux/kdebug.h> 32#include <linux/kdebug.h>
33#include <linux/string.h>
33#include <linux/ctype.h> 34#include <linux/ctype.h>
34#include <linux/init.h> 35#include <linux/init.h>
35#include <linux/poll.h> 36#include <linux/poll.h>
@@ -147,8 +148,7 @@ static int __init set_ftrace_dump_on_oops(char *str)
147} 148}
148__setup("ftrace_dump_on_oops", set_ftrace_dump_on_oops); 149__setup("ftrace_dump_on_oops", set_ftrace_dump_on_oops);
149 150
150long 151unsigned long long ns2usecs(cycle_t nsec)
151ns2usecs(cycle_t nsec)
152{ 152{
153 nsec += 500; 153 nsec += 500;
154 do_div(nsec, 1000); 154 do_div(nsec, 1000);
@@ -1623,7 +1623,11 @@ static void test_cpu_buff_start(struct trace_iterator *iter)
1623 return; 1623 return;
1624 1624
1625 cpumask_set_cpu(iter->cpu, iter->started); 1625 cpumask_set_cpu(iter->cpu, iter->started);
1626 trace_seq_printf(s, "##### CPU %u buffer started ####\n", iter->cpu); 1626
1627 /* Don't print started cpu buffer for the first entry of the trace */
1628 if (iter->idx > 1)
1629 trace_seq_printf(s, "##### CPU %u buffer started ####\n",
1630 iter->cpu);
1627} 1631}
1628 1632
1629static enum print_line_t print_trace_fmt(struct trace_iterator *iter) 1633static enum print_line_t print_trace_fmt(struct trace_iterator *iter)
@@ -1858,6 +1862,11 @@ __tracing_open(struct inode *inode, struct file *file)
1858 if (current_trace) 1862 if (current_trace)
1859 *iter->trace = *current_trace; 1863 *iter->trace = *current_trace;
1860 1864
1865 if (!alloc_cpumask_var(&iter->started, GFP_KERNEL))
1866 goto fail;
1867
1868 cpumask_clear(iter->started);
1869
1861 if (current_trace && current_trace->print_max) 1870 if (current_trace && current_trace->print_max)
1862 iter->tr = &max_tr; 1871 iter->tr = &max_tr;
1863 else 1872 else
@@ -1908,6 +1917,7 @@ __tracing_open(struct inode *inode, struct file *file)
1908 if (iter->buffer_iter[cpu]) 1917 if (iter->buffer_iter[cpu])
1909 ring_buffer_read_finish(iter->buffer_iter[cpu]); 1918 ring_buffer_read_finish(iter->buffer_iter[cpu]);
1910 } 1919 }
1920 free_cpumask_var(iter->started);
1911 fail: 1921 fail:
1912 mutex_unlock(&trace_types_lock); 1922 mutex_unlock(&trace_types_lock);
1913 kfree(iter->trace); 1923 kfree(iter->trace);
@@ -1951,6 +1961,7 @@ static int tracing_release(struct inode *inode, struct file *file)
1951 1961
1952 seq_release(inode, file); 1962 seq_release(inode, file);
1953 mutex_destroy(&iter->mutex); 1963 mutex_destroy(&iter->mutex);
1964 free_cpumask_var(iter->started);
1954 kfree(iter->trace); 1965 kfree(iter->trace);
1955 kfree(iter); 1966 kfree(iter);
1956 return 0; 1967 return 0;
@@ -2349,9 +2360,9 @@ static const char readme_msg[] =
2349 "# mkdir /debug\n" 2360 "# mkdir /debug\n"
2350 "# mount -t debugfs nodev /debug\n\n" 2361 "# mount -t debugfs nodev /debug\n\n"
2351 "# cat /debug/tracing/available_tracers\n" 2362 "# cat /debug/tracing/available_tracers\n"
2352 "wakeup preemptirqsoff preemptoff irqsoff ftrace sched_switch none\n\n" 2363 "wakeup preemptirqsoff preemptoff irqsoff function sched_switch nop\n\n"
2353 "# cat /debug/tracing/current_tracer\n" 2364 "# cat /debug/tracing/current_tracer\n"
2354 "none\n" 2365 "nop\n"
2355 "# echo sched_switch > /debug/tracing/current_tracer\n" 2366 "# echo sched_switch > /debug/tracing/current_tracer\n"
2356 "# cat /debug/tracing/current_tracer\n" 2367 "# cat /debug/tracing/current_tracer\n"
2357 "sched_switch\n" 2368 "sched_switch\n"