[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0903020815530.4771@gandalf.stny.rr.com>
Date: Mon, 2 Mar 2009 08:23:22 -0500 (EST)
From: Steven Rostedt <rostedt@...dmis.org>
To: Tom Zanussi <tzanussi@...il.com>
cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Mathieu Desnoyers <compudj@...stal.dyndns.org>,
Masami Hiramatsu <mhiramat@...hat.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Jason Baron <jbaron@...hat.com>,
"Frank Ch. Eigler" <fche@...hat.com>, acme@...stprotocols.net,
Steven Rostedt <srostedt@...hat.com>
Subject: Re: [PATCH 07/10] tracing: add raw trace point recording
infrastructure
On Mon, 2 Mar 2009, Tom Zanussi wrote:
> > An example of this would be:
> >
> > TRACE_EVENT_FORMAT(sched_wakeup,
> > TPPROTO(struct rq *rq, struct task_struct *p, int success),
> > TPARGS(rq, p, success),
> > TPFMT("task %s:%d %s",
> > p->comm, p->pid, success?"succeeded":"failed"),
> > TRACE_STRUCT(
> > TRACE_FIELD(pid_t, pid, p->pid)
> > TRACE_FIELD(int, success, success)
> > ),
> > TPRAWFMT("task %d success=%d")
> > );
> >
> > This creates us a unique struct of:
> >
> > struct {
> > pid_t pid;
> > int success;
> > };
> >
> > And the way the call back would assign these values would be:
> >
> > entry->pid = p->pid;
> > entry->success = success;
> >
> > The nice part about this is that the creation of the assignent is done
> > via macro magic in the event tracer. Once the TRACE_EVENT_FORMAT is
> > created, the developer will then have a faster method to record
> > into the ring buffer. They do not need to worry about the tracer itself.
> >
>
> Nice improvements - I definitely was unhappy about having things spread
> around in different files unnecessarily. And I like the fact that your
> macros generate assignments too but am curious about what to do if you
> need to do something more complicated than an assignment e.g. in the
> block tracepoints I had to assign fields differently based on the value
> of blk_pc_request():
>
> if (blk_pc_request(rq)) {
> zed_event->sector = 0;
> zed_event->bytes = rq->data_len;
> zed_event->pdu_len = pdu_len;
> memcpy(zed_event->pdu, rq->cmd, pdu_len);
> } else {
> zed_event->sector = rq->hard_sector;
> zed_event->bytes = rq->hard_nr_sectors << 9;
> zed_event->pdu_len = 0;
> }
>
> Is there a way to define some fields but without the assignments, and do
> them manually somewhere else? I guess it would be nice to be able to
> define all events using TRACE_EVENT_FORMAT but have a way to special
> case certain events/fields.
>
> Anyway, sorry if it's already handled in the code - haven't had a chance
> to really peruse it.
Nope, you are right, it is not handled... yet ;-)
I was thinking about adding TRACE_FIELD_SPECIAL() that would allow for a
different means to copy the field.
TRACE_FIELD_SPECIAL(char*, pdu, rec,
TPCMD(memcpy((rec)->pdu, rq->cmd, pdu_len));
Where, rec would have your "zed_event", and the fourth argument would have
the way to handle that field.
I have not tried that yet, but I think this, or something similar, could
work.
Thanks,
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists