Re: [PATCH 6/7] ftrace, perf: Distinguish ftrace function eventfield type

From: Steven Rostedt
Date: Fri Feb 03 2012 - 09:16:43 EST


On Sat, 2012-01-28 at 19:43 +0100, Jiri Olsa wrote:
>
> +#define FILTER_TYPE_TRACE_FN FILTER_TRACE_FN
> +#define FILTER_TYPE_TRACE_GRAPH_ENT FILTER_OTHER
> +#define FILTER_TYPE_TRACE_GRAPH_RET FILTER_OTHER
> +#define FILTER_TYPE_TRACE_CTX FILTER_OTHER
> +#define FILTER_TYPE_TRACE_WAKE FILTER_OTHER
> +#define FILTER_TYPE_TRACE_STACK FILTER_OTHER
> +#define FILTER_TYPE_TRACE_USER_STACK FILTER_OTHER
> +#define FILTER_TYPE_TRACE_BPRINT FILTER_OTHER
> +#define FILTER_TYPE_TRACE_PRINT FILTER_OTHER
> +#define FILTER_TYPE_TRACE_MMIO_RW FILTER_OTHER
> +#define FILTER_TYPE_TRACE_MMIO_MAP FILTER_OTHER
> +#define FILTER_TYPE_TRACE_BRANCH FILTER_OTHER
> +#define FILTER_TYPE(arg) FILTER_TYPE_##arg
> +
> #undef FTRACE_ENTRY
> #define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \

If all FTRACE_ENTRY needs a filter defined (as you did with the #defines
above), then we should just add a FILTER field to FTRACE_ENTRY(). The
defines are just ugly, and will be a pain if we ever add or remove a
type. If we remove a type, we'll probably forget to remove the define
for it.

#define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter)

int filter_type = filter;

And then the trace entries can have the type of filter.

F_STRUCT(
...
),

FILTER_OTHER

That would be much cleaner.

-- Steve

> int \
> @@ -123,6 +137,7 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call) \
> { \
> struct struct_name field; \
> int ret; \
> + int filter_type = FILTER_TYPE(id); \
> \
> tstruct; \
> \


--
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/