aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-11-12 00:14:40 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-12 05:52:02 -0500
commit52f232cb720a7babb752849cbc2cab2d24021209 (patch)
tree47c7e800549457bd5ab9b54f47729acac6e10780 /kernel/trace/trace.c
parent1f0d69a9fc815db82f15722bf05227190b1d714d (diff)
tracing: likely/unlikely branch annotation tracer
Impact: new likely/unlikely branch tracer This patch adds a way to record the instances of the likely() and unlikely() branch condition annotations. When "unlikely" is set in /debugfs/tracing/iter_ctrl the unlikely conditions will be added to any of the ftrace tracers. The change takes effect when a new tracer is passed into the current_tracer file. For example: bash-3471 [003] 357.014755: [INCORRECT] sched_info_dequeued:sched_stats.h:177 bash-3471 [003] 357.014756: [correct] update_curr:sched_fair.c:489 bash-3471 [003] 357.014758: [correct] calc_delta_fair:sched_fair.c:411 bash-3471 [003] 357.014759: [correct] account_group_exec_runtime:sched_stats.h:356 bash-3471 [003] 357.014761: [correct] update_curr:sched_fair.c:489 bash-3471 [003] 357.014763: [INCORRECT] calc_delta_fair:sched_fair.c:411 bash-3471 [003] 357.014765: [correct] calc_delta_mine:sched.c:1279 Which shows the normal tracer heading, as well as whether the condition was correct "[correct]" or was mistaken "[INCORRECT]", followed by the function, file name and line number. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a3f7ae9cd8e1..83d38634bc90 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -258,6 +258,9 @@ static const char *trace_options[] = {
258 "sched-tree", 258 "sched-tree",
259 "ftrace_printk", 259 "ftrace_printk",
260 "ftrace_preempt", 260 "ftrace_preempt",
261#ifdef CONFIG_UNLIKELY_TRACER
262 "unlikely",
263#endif
261 NULL 264 NULL
262}; 265};
263 266
@@ -1648,6 +1651,18 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
1648 trace_seq_print_cont(s, iter); 1651 trace_seq_print_cont(s, iter);
1649 break; 1652 break;
1650 } 1653 }
1654 case TRACE_UNLIKELY: {
1655 struct trace_unlikely *field;
1656
1657 trace_assign_type(field, entry);
1658
1659 trace_seq_printf(s, "[%s] %s:%s:%d\n",
1660 field->correct ? "correct" : "INCORRECT",
1661 field->func,
1662 field->file,
1663 field->line);
1664 break;
1665 }
1651 default: 1666 default:
1652 trace_seq_printf(s, "Unknown type %d\n", entry->type); 1667 trace_seq_printf(s, "Unknown type %d\n", entry->type);
1653 } 1668 }
@@ -1787,6 +1802,18 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter)
1787 return print_return_function(iter); 1802 return print_return_function(iter);
1788 break; 1803 break;
1789 } 1804 }
1805 case TRACE_UNLIKELY: {
1806 struct trace_unlikely *field;
1807
1808 trace_assign_type(field, entry);
1809
1810 trace_seq_printf(s, "[%s] %s:%s:%d\n",
1811 field->correct ? "correct" : "INCORRECT",
1812 field->func,
1813 field->file,
1814 field->line);
1815 break;
1816 }
1790 } 1817 }
1791 return TRACE_TYPE_HANDLED; 1818 return TRACE_TYPE_HANDLED;
1792} 1819}
@@ -2592,6 +2619,7 @@ static int tracing_set_tracer(char *buf)
2592 if (t == current_trace) 2619 if (t == current_trace)
2593 goto out; 2620 goto out;
2594 2621
2622 trace_unlikely_disable();
2595 if (current_trace && current_trace->reset) 2623 if (current_trace && current_trace->reset)
2596 current_trace->reset(tr); 2624 current_trace->reset(tr);
2597 2625
@@ -2599,6 +2627,7 @@ static int tracing_set_tracer(char *buf)
2599 if (t->init) 2627 if (t->init)
2600 t->init(tr); 2628 t->init(tr);
2601 2629
2630 trace_unlikely_enable(tr);
2602 out: 2631 out:
2603 mutex_unlock(&trace_types_lock); 2632 mutex_unlock(&trace_types_lock);
2604 2633