Re: [PATCH v2] kmemtrace: print binary output only if 'bin' optionis set

From: Ingo Molnar
Date: Fri Jul 03 2009 - 05:56:03 EST



* Eduard - Gabriel Munteanu <eduard.munteanu@xxxxxxxxxxx> wrote:

> On Fri, Jul 03, 2009 at 05:34:24PM +0800, Li Zefan wrote:
> > Currently by default the output of kmemtrace is binary format instead
> > of human-readable output.
> >
> > This patch makes the following changes:
> > - We'll see human-readable output by default
> > - We'll see binary output if 'bin' option is set
> >
> > Note: you may probably need to explicitly disable context-info binary
> > output:
> >
> > # echo 0 > options/context-info
> > # echo 1 > options/bin
> > # cat trace_pipe
> >
> > v2:
> > - use %pF to print call_site
> >
> > Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
> > Acked-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
> > Acked-by: Eduard - Gabriel Munteanu <eduard.munteanu@xxxxxxxxxxx>
> > ---
> > kernel/trace/kmemtrace.c | 120 ++++++++++++++++++++++++++++++++++-----------
> > 1 files changed, 90 insertions(+), 30 deletions(-)
> >
> > diff --git a/kernel/trace/kmemtrace.c b/kernel/trace/kmemtrace.c
> > index 1edaa95..74903b6 100644
> > --- a/kernel/trace/kmemtrace.c
> > +++ b/kernel/trace/kmemtrace.c
> > @@ -239,12 +239,52 @@ struct kmemtrace_user_event_alloc {
> > };
> >
> > static enum print_line_t
> > -kmemtrace_print_alloc_user(struct trace_iterator *iter,
> > - struct kmemtrace_alloc_entry *entry)
> > +kmemtrace_print_alloc_user(struct trace_iterator *iter, int flags)
> > +{
> > + struct trace_seq *s = &iter->seq;
> > + struct kmemtrace_alloc_entry *entry;
> > + int ret;
> > +
> > + trace_assign_type(entry, iter->ent);
> > +
> > + ret = trace_seq_printf(s, "type_id %d call_site %pF ptr %lu "
> > + "bytes_req %lu bytes_alloc %lu gfp_flags %lu node %d\n",
> > + entry->type_id, (void *)entry->call_site, (unsigned long)entry->ptr,
> > + (unsigned long)entry->bytes_req, (unsigned long)entry->bytes_alloc,
> > + (unsigned long)entry->gfp_flags, entry->node);
> > +
> > + if (!ret)
> > + return TRACE_TYPE_PARTIAL_LINE;
> > + return TRACE_TYPE_HANDLED;
> > +}
>
> [snip]
>
> kmemtrace_print_alloc_user() is meant for kmemtrace-user, that's
> what the naming is meant to convey. Also,
> kmemtrace_print_alloc_user_bin is kinda long. Could you leave the
> former as it was and come up with another name for the non-binary
> variant?

should i hold off on this patch for now?

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