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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]