Skip to content

Commit

Permalink
tracing: explain why stack tracer is empty
Browse files Browse the repository at this point in the history
If the stack tracing is disabled (by default) the stack_trace file
will only contain the header:

 # cat /debug/tracing/stack_trace
        Depth    Size      Location    (0 entries)
        -----    ----      --------

This can be frustrating to a developer that does not realize that the
stack tracer is disabled. This patch adds the following text:

  # cat /debug/tracing/stack_trace
        Depth    Size      Location    (0 entries)
        -----    ----      --------
 #
 #  Stack tracer disabled
 #
 # To enable the stack tracer, either add 'stacktrace' to the
 # kernel command line
 # or 'echo 1 > /proc/sys/kernel/stack_tracer_enabled'
 #

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
  • Loading branch information
Steven Rostedt committed Mar 13, 2009
1 parent 2da03ec commit e447e1d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions kernel/trace/trace_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,17 @@ static int trace_lookup_stack(struct seq_file *m, long i)
#endif
}

static void print_disabled(struct seq_file *m)
{
seq_puts(m, "#\n"
"# Stack tracer disabled\n"
"#\n"
"# To enable the stack tracer, either add 'stacktrace' to the\n"
"# kernel command line\n"
"# or 'echo 1 > /proc/sys/kernel/stack_tracer_enabled'\n"
"#\n");
}

static int t_show(struct seq_file *m, void *v)
{
long i;
Expand All @@ -255,6 +266,10 @@ static int t_show(struct seq_file *m, void *v)
" (%d entries)\n"
" ----- ---- --------\n",
max_stack_trace.nr_entries);

if (!stack_tracer_enabled && !max_stack_size)
print_disabled(m);

return 0;
}

Expand Down

0 comments on commit e447e1d

Please sign in to comment.