Re: [PATCH 08/11] readahead: add tracing event

From: Steven Rostedt
Date: Fri Feb 12 2010 - 11:19:16 EST


On Tue, 2010-02-02 at 23:28 +0800, Wu Fengguang wrote:
> plain text document attachment (readahead-tracer.patch)
> Example output:

> + TP_printk("readahead-%s(dev=%d:%d, ino=%lu, "
> + "req=%lu+%lu, ra=%lu+%d-%d, async=%d) = %d",
> + ra_pattern_names[__entry->pattern],

The above totally breaks any parsing by tools. We have already have a
way to map values to strings with __print_symbolic():

__print_symbolic(__entry->pattern,
{ RA_PATTERN_INITIAL, "initial" },
{ RA_PATTERN_SUBSEQUENT, "subsequent"},
{ RA_PATTERN_CONTEXT, "context"},
{ RA_PATTERN_THRASH, "thrash"},
{ RA_PATTERN_MMAP_AROUND, "around"},
{ RA_PATTERN_FADVISE, "fadvise" },
{ RA_PATTERN_RANDOM, "random"},
{ RA_PATTERN_ALL, "all" }),

see include/trace/irq.h for another example.

-- Steve

> + MAJOR(__entry->dev),
> + MINOR(__entry->dev),
> + __entry->ino,
> + __entry->offset,
> + __entry->req_size,
> + __entry->start,
> + __entry->size,
> + __entry->async_size,
> + __entry->start > __entry->offset,
> + __entry->actual)
> +);
> +
> +#endif /* _TRACE_READAHEAD_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> --- linux.orig/mm/readahead.c 2010-02-01 21:55:43.000000000 +0800
> +++ linux/mm/readahead.c 2010-02-01 21:57:25.000000000 +0800
> @@ -19,11 +19,25 @@
> #include <linux/pagevec.h>
> #include <linux/pagemap.h>
>
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/readahead.h>
> +
> /*
> * Set async size to 1/# of the thrashing threshold.
> */
> #define READAHEAD_ASYNC_RATIO 8
>
> +const char * const ra_pattern_names[] = {
> + [RA_PATTERN_INITIAL] = "initial",
> + [RA_PATTERN_SUBSEQUENT] = "subsequent",
> + [RA_PATTERN_CONTEXT] = "context",
> + [RA_PATTERN_THRASH] = "thrash",
> + [RA_PATTERN_MMAP_AROUND] = "around",
> + [RA_PATTERN_FADVISE] = "fadvise",
> + [RA_PATTERN_RANDOM] = "random",
> + [RA_PATTERN_ALL] = "all",
> +};
> +


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