Re: [PATCH 1/1] ftrace - add support for tracing_thresh to function_graphtracer

From: Tim Bird
Date: Fri Feb 12 2010 - 22:47:25 EST


On 02/11/2010 04:26 PM, Steven Rostedt wrote:
> On Thu, 2010-02-11 at 16:01 -0800, Tim Bird wrote:
>> On 02/11/2010 03:10 PM, Steven Rostedt wrote:
>>> On Wed, 2010-02-10 at 14:52 -0800, Tim Bird wrote:
>>>> static struct tracer_opt trace_opts[] = {
>>>> /* Display overruns? (for self-debug purpose) */
>>>> @@ -53,6 +54,8 @@ static struct tracer_opt trace_opts[] = {
>>>> { TRACER_OPT(funcgraph-duration, TRACE_GRAPH_PRINT_DURATION) },
>>>> /* Display absolute time of an entry */
>>>> { TRACER_OPT(funcgraph-abstime, TRACE_GRAPH_PRINT_ABS_TIME) },
>>>> + /* Display function name on exit, instead of just closing brace */
>>>> + { TRACER_OPT(funcgraph-exit, TRACE_GRAPH_PRINT_FUNC_EXIT) },
>>>> { } /* Empty entry */
>>>
>>> I wonder if this should be enabled on start up of the function graph
>>> tracer if the threshold is set?
>>>
>>> Otherwise people will wonder WTF?
>>
>> Indeed. I'm not sure exactly how to do this.
>>
>> Would it be better to set the option when current_tracer
>> is set with 'function_graph', and tracing_thresh is non-zero?
>
> The above is the only one I would do. If tracing_thresh is non-zero when
> the function_graph tracer is set, on the start up code in the function
> tracer (graph_trace_init).
>
> Just enable the option if trace_thresh is set. If you enable function
> graph tracer and have the trace_thresh set, then this type of tracing
> starts immediately. It also keeps the code nicely in the
> trace_function_graph.c file, and does not need to touch the setting of
> tracing_thresh.

OK. Here's what I came up with. Pretty straightforward.
Do you want me to integrate this into the previous patch and
re-send, or just submit this by itself.

My apologies for getting this out so late. I'll be on
vacation with my family next week, so if you don't hear
from me, don't take it as a sign of disinterest. :-)

Index: linux-2.6.31.x86_64/kernel/trace/trace_functions_graph.c
===================================================================
--- linux-2.6.31.x86_64.orig/kernel/trace/trace_functions_graph.c 2010-02-10 14:07:47.000000000 -0800
+++ linux-2.6.31.x86_64/kernel/trace/trace_functions_graph.c 2010-02-12 16:13:53.925957633 -0800
@@ -298,6 +298,11 @@
return ret;
tracing_start_cmdline_record();

+ if (tracing_thresh)
+ tracer_flags.val |= TRACE_GRAPH_PRINT_FUNC_EXIT;
+ else
+ tracer_flags.val &= ~TRACE_GRAPH_PRINT_FUNC_EXIT;
+
return 0;
}



=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Corporation of America
=============================

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/