Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140640
b: refs/heads/master
c: 3eb36aa
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Jan 16, 2009
1 parent c0b61d0 commit 5d7cdf8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5e4abc9839191e213965e0f1dbf36e2e44356c3a
refs/heads/master: 3eb36aa05329a47cbe201c151fd0024a4a3649cd
61 changes: 36 additions & 25 deletions trunk/kernel/trace/trace_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ function_stack_trace_call(unsigned long ip, unsigned long parent_ip)

if (likely(disabled == 1)) {
pc = preempt_count();
trace_function(tr, data, ip, parent_ip, flags, pc);
/*
* skip over 5 funcs:
* __ftrace_trace_stack,
Expand All @@ -154,24 +155,6 @@ static struct ftrace_ops trace_ops __read_mostly =
.func = function_trace_call,
};

void tracing_start_function_trace(void)
{
ftrace_function_enabled = 0;

if (trace_flags & TRACE_ITER_PREEMPTONLY)
trace_ops.func = function_trace_call_preempt_only;
else
trace_ops.func = function_trace_call;

register_ftrace_function(&trace_ops);
ftrace_function_enabled = 1;
}

void tracing_stop_function_trace(void)
{
ftrace_function_enabled = 0;
unregister_ftrace_function(&trace_ops);
}
static struct ftrace_ops trace_stack_ops __read_mostly =
{
.func = function_stack_trace_call,
Expand All @@ -194,17 +177,45 @@ static struct tracer_flags func_flags = {
.opts = func_opts
};

void tracing_start_function_trace(void)
{
ftrace_function_enabled = 0;

if (trace_flags & TRACE_ITER_PREEMPTONLY)
trace_ops.func = function_trace_call_preempt_only;
else
trace_ops.func = function_trace_call;

if (func_flags.val & TRACE_FUNC_OPT_STACK)
register_ftrace_function(&trace_stack_ops);
else
register_ftrace_function(&trace_ops);

ftrace_function_enabled = 1;
}

void tracing_stop_function_trace(void)
{
ftrace_function_enabled = 0;
/* OK if they are not registered */
unregister_ftrace_function(&trace_stack_ops);
unregister_ftrace_function(&trace_ops);
}

static int func_set_flag(u32 old_flags, u32 bit, int set)
{
if (bit == TRACE_FUNC_OPT_STACK) {
/* do nothing if already set */
if (!!set == !!(func_flags.val & TRACE_FUNC_OPT_STACK))
return 0;

if (set)
if (set) {
unregister_ftrace_function(&trace_ops);
register_ftrace_function(&trace_stack_ops);
else
} else {
unregister_ftrace_function(&trace_stack_ops);
register_ftrace_function(&trace_ops);
}

return 0;
}
Expand All @@ -214,14 +225,14 @@ static int func_set_flag(u32 old_flags, u32 bit, int set)

static struct tracer function_trace __read_mostly =
{
.name = "function",
.init = function_trace_init,
.reset = function_trace_reset,
.start = function_trace_start,
.name = "function",
.init = function_trace_init,
.reset = function_trace_reset,
.start = function_trace_start,
.flags = &func_flags,
.set_flag = func_set_flag,
#ifdef CONFIG_FTRACE_SELFTEST
.selftest = trace_selftest_startup_function,
.selftest = trace_selftest_startup_function,
#endif
};

Expand Down

0 comments on commit 5d7cdf8

Please sign in to comment.