Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100650
b: refs/heads/master
c: 60bc080
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Jul 11, 2008
1 parent 5583dc3 commit 8e266d6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 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: a2bb6a3d85ef3124cd336403a95abc0540d3fbe2
refs/heads/master: 60bc080090e3bf6afa29c62cb25f913706551010
22 changes: 19 additions & 3 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ static DEFINE_PER_CPU(struct trace_array_cpu, max_data);
/* tracer_enabled is used to toggle activation of a tracer */
static int tracer_enabled = 1;

/* function tracing enabled */
int ftrace_function_enabled;

/*
* trace_nr_entries is the number of entries that is allocated
* for a buffer. Note, the number of entries is always rounded
Expand Down Expand Up @@ -134,6 +137,7 @@ static notrace void no_trace_init(struct trace_array *tr)
{
int cpu;

ftrace_function_enabled = 0;
if(tr->ctrl)
for_each_online_cpu(cpu)
tracing_reset(tr->data[cpu]);
Expand Down Expand Up @@ -985,7 +989,7 @@ function_trace_call(unsigned long ip, unsigned long parent_ip)
long disabled;
int cpu;

if (unlikely(!tracer_enabled))
if (unlikely(!ftrace_function_enabled))
return;

if (skip_trace(ip))
Expand All @@ -1010,11 +1014,15 @@ static struct ftrace_ops trace_ops __read_mostly =

void tracing_start_function_trace(void)
{
ftrace_function_enabled = 0;
register_ftrace_function(&trace_ops);
if (tracer_enabled)
ftrace_function_enabled = 1;
}

void tracing_stop_function_trace(void)
{
ftrace_function_enabled = 0;
unregister_ftrace_function(&trace_ops);
}
#endif
Expand Down Expand Up @@ -1850,8 +1858,10 @@ __tracing_open(struct inode *inode, struct file *file, int *ret)
m->private = iter;

/* stop the trace while dumping */
if (iter->tr->ctrl)
if (iter->tr->ctrl) {
tracer_enabled = 0;
ftrace_function_enabled = 0;
}

if (iter->trace && iter->trace->open)
iter->trace->open(iter);
Expand Down Expand Up @@ -1884,8 +1894,14 @@ int tracing_release(struct inode *inode, struct file *file)
iter->trace->close(iter);

/* reenable tracing if it was previously enabled */
if (iter->tr->ctrl)
if (iter->tr->ctrl) {
tracer_enabled = 1;
/*
* It is safe to enable function tracing even if it
* isn't used
*/
ftrace_function_enabled = 1;
}
mutex_unlock(&trace_types_lock);

seq_release(inode, file);
Expand Down

0 comments on commit 8e266d6

Please sign in to comment.