lkml.org 
[lkml]   [2010]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH 08/11] readahead: add tracing event
From
Date
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",
> +};
> +




\
 
 \ /
  Last update: 2010-02-12 17:21    [W:0.183 / U:4.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site