public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: "Frédéric Weisbecker" <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing/ftrace: better manage the context info for events
Date: Fri, 30 Jan 2009 11:21:26 -0200	[thread overview]
Message-ID: <20090130132126.GS627@ghostprotocols.net> (raw)
In-Reply-To: <c62985530901300455h55695931nb67936e0e5b54aeb@mail.gmail.com>

Em Fri, Jan 30, 2009 at 01:55:50PM +0100, Frédéric Weisbecker escreveu:
> 2009/1/30 Arnaldo Carvalho de Melo <acme@ghostprotocols.net>:
> > Em Fri, Jan 30, 2009 at 10:34:46AM -0200, Arnaldo Carvalho de Melo escreveu:
> >> Em Fri, Jan 30, 2009 at 12:59:05AM -0800, Frederic Weisbecker escreveu:
> >> > Impact: make trace_event more convenient for tracers
> >> >
> >> > All tracers (for the moment) that use the struct trace_event want to have
> >> > the context info printed before their own output: the pid/cmdline, cpu, and timestamp.
> >> >
> >> > But some other tracers that want to implement their trace_event callbacks will
> >> > not necessary need these information or they may want to format them as they want.
> >> >
> >> > This patch adds a new default-enabled trace option: TRACE_ITER_CONTEXT_INFO
> >> > When disabled through:
> >> >
> >> > echo nocontext-info > /debugfs/tracing/trace_options
> >> >
> >> > The pid, cpu and timestamps headers will not be printed.
> >> >
> >> > IE with the sched_switch tracer with context-info (default):
> >> >
> >> >             bash-2935  [001]   100.356561:   2935:120:S ==> [001]     0:140:R <idle>
> >> >           <idle>-0     [000]   100.412804:      0:140:R   + [000]    11:115:S events/0
> >> >           <idle>-0     [000]   100.412816:      0:140:R ==> [000]    11:115:R events/0
> >> >         events/0-11    [000]   100.412829:     11:115:S ==> [000]     0:140:R <idle>
> >> >
> >> > Without context-info:
> >> >
> >> >   2935:120:S ==> [001]     0:140:R <idle>
> >> >      0:140:R   + [000]    11:115:S events/0
> >> >      0:140:R ==> [000]    11:115:R events/0
> >> >     11:115:S ==> [000]     0:140:R <idle>
> >> >
> >> > A tracer can disable it at runtime by clearing the bit TRACE_ITER_CONTEXT_INFO in trace_flags.
> >> >
> >> > Moreover, two callbacks have been added inside trace_event:
> >> > _ context_info() which let a tracer override the format of the context info
> >> > _ lat_context_info() which do the same with the latency_trace file
> >> >
> >> > If they are not defined, the usual way of printing the context info will be used.
> >>
> >> Please wait a bit, I'm trying to use it and the first thing I notice was
> >> that I need the trace_iterator in the context callback, to get the
> >> timestamp.
> >
> > Sorry, false alarm, the iterator is there, I was trying to build the
> > whole binary trace record in the trace_event->bin(), but its not
> > possible, so I'll do it in two function calls context + trace.
> >
> > - Arnaldo
> >
> 
> Do you need the trace_iterator from one of your event print callback?
> Such as in bin() ?

Yes, I'm finding the callbacks a complicating factor, I think that we
should have instead a flag in the struct trace_event and struct tracer
telling that we don't need the context printed and the default routine
exported to tracers.

That way minimise change on the old tracers but allow new ones to use
the default context to be called from trace_event->trace() and not from
trace_event->bin().

So, to summarize, for blktrace I would use:

struct trace_event {
	.flags	= DONT_PRINT_CONTEXT | OTHER_FUTURE_FLAGS,
	.bin	= blktrace_print_bin,
	.trace	= blktrace_print_trace,
}

blktrace_print_bin(iter)
{
	full control with access to iter to get timestamp, cpu, etc
}

blktrace_print_trace(iter)
{
	print_default_context()
	print tracer specific stuff
}

Back to trying to use your patch to show the problems in the form of a
working blktrace synthesizer to use with:

cat /d/tracing/trace_pipe | blkparse -i -

- Arnaldo

  reply	other threads:[~2009-01-30 13:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-30  8:59 [PATCH] tracing/ftrace: better manage the context info for events Frederic Weisbecker
2009-01-30  9:02 ` Frederic Weisbecker
2009-01-30 12:34 ` Arnaldo Carvalho de Melo
2009-01-30 12:39   ` Arnaldo Carvalho de Melo
2009-01-30 12:55     ` Frédéric Weisbecker
2009-01-30 13:21       ` Arnaldo Carvalho de Melo [this message]
2009-01-30 13:54         ` Arnaldo Carvalho de Melo
2009-01-30 14:14           ` Frédéric Weisbecker
2009-01-30 16:56 ` Steven Rostedt
2009-01-30 17:21   ` Arnaldo Carvalho de Melo
2009-02-02 22:28     ` [PATCH tip 0/3] tracing/blkftrace improvements Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090130132126.GS627@ghostprotocols.net \
    --to=acme@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox