Re: [PATCH 7/7] ftrace, perf: Add filter support for function traceevent

From: Jiri Olsa
Date: Mon Feb 06 2012 - 19:20:27 EST


On Sat, Jan 28, 2012 at 07:43:29PM +0100, Jiri Olsa wrote:
> Adding support to filter function trace event via perf
> interface. It is now possible to use filter interface
> in the perf tool like:
>
> perf record -e ftrace:function --filter="(ip == mm_*)" ls
>
> The filter syntax is restricted to the the 'ip' field only,
> and following operators are accepted '==' '!=' '||', ending
> up with the filter strings like:
>
> ip == f1[, ]f2 ... || ip != f3[, ]f4 ...
>
> with comma ',' or space ' ' as a function separator. If the
> space ' ' is used as a separator, the right side of the
> assignment needs to be enclosed in double quotes '"'.
>
> The '==' operator adds trace filter with same effect as would
> be added via set_ftrace_filter file.
>
> The '!=' operator adds trace filter with same effect as would
> be added via set_ftrace_notrace file.
>
> The right side of the '!=', '==' operators is list of functions
> or regexp. to be added to filter separated by space.
>
> The '||' operator is used for connecting multiple filter definitions
> together. It is possible to have more than one '==' and '!='
> operators within one filter string.
>
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>

SNIP

> static void perf_ftrace_function_enable(struct perf_event *event)
> diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
> index eb04a2a..c8a64ec 100644
> --- a/kernel/trace/trace_events_filter.c
> +++ b/kernel/trace/trace_events_filter.c
> @@ -54,6 +54,13 @@ struct filter_op {
> int precedence;
> };
>
> +static struct filter_op filter_ftrace_ops[] = {
> + { OP_OR, "||", 1 },
> + { OP_NE, "!=", 2 },
> + { OP_EQ, "==", 2 },
> + { OP_NONE, "OP_NONE", 0 },
> +};

ugh.. just found I cannot define filter_ftrace_ops like this,
will send fix with new version.

thanks,
jirka
--
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/