lkml.org 
[lkml]   [2009]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] ftrace: add stack trace to function tracer
Hi Steven,

2009/1/16 Steven Rostedt <rostedt@goodmis.org>:
> +static struct tracer_flags func_flags = {
> + .val = 0, /* By default: all flags disabled */
> + .opts = func_opts
> +};
> +
> +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;


This is just a small thing but set will always be 1 or 0. And if you want
the current val of your options, you can take old_flags :-)

Would you prefer I send a patch to not call the set_flag callback
when the option set/unset by the user is already set/unset ?


> + if (set)
> + register_ftrace_function(&trace_stack_ops);
> + else
> + unregister_ftrace_function(&trace_stack_ops);
> +
> + return 0;
> + }
> +
> + return -EINVAL;
> +}
> +
> static struct tracer function_trace __read_mostly =
> {
> .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,
> #endif
> --
> 1.5.6.5
>
> --
>


\
 
 \ /
  Last update: 2009-01-16 11:11    [W:0.136 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site