[alsa-devel] [very-RFC 6/8] Add TSN event-tracing
Henrik Austad
henrik at austad.us
Mon Jun 13 09:20:50 CEST 2016
On Sun, Jun 12, 2016 at 10:22:01PM -0400, Steven Rostedt wrote:
> On Sun, 12 Jun 2016 23:25:10 +0200
> Henrik Austad <henrik at austad.us> wrote:
>
> > > > +#include <linux/if_ether.h>
> > > > +#include <linux/if_vlan.h>
> > > > +/* #include <linux/skbuff.h> */
> > > > +
> > > > +/* FIXME: update to TRACE_CLASS to reduce overhead */
> > >
> > > I'm curious to why I didn't do this now. A class would make less
> > > duplication of typing too ;-)
> >
> > Yeah, I found this in a really great article written by some tracing-dude,
> > I hear he talks really, really fast!
>
> I plead the 5th!
>
> >
> > https://lwn.net/Articles/381064/
> >
> > > > +TRACE_EVENT(tsn_buffer_write,
> > > > +
> > > > + TP_PROTO(struct tsn_link *link,
> > > > + size_t bytes),
> > > > +
> > > > + TP_ARGS(link, bytes),
> > > > +
> > > > + TP_STRUCT__entry(
> > > > + __field(u64, stream_id)
> > > > + __field(size_t, size)
> > > > + __field(size_t, bsize)
> > > > + __field(size_t, size_left)
> > > > + __field(void *, buffer)
> > > > + __field(void *, head)
> > > > + __field(void *, tail)
> > > > + __field(void *, end)
> > > > + ),
> > > > +
> > > > + TP_fast_assign(
> > > > + __entry->stream_id = link->stream_id;
> > > > + __entry->size = bytes;
> > > > + __entry->bsize = link->used_buffer_size;
> > > > + __entry->size_left = (link->head - link->tail) % link->used_buffer_size;
> > >
> > > Move this logic into the print statement, since you save head and tail.
> >
> > Ok, any particular reason?
>
> Because it removes calculations during the trace. The calculations done
> in TP_printk() are done at the time of reading the trace, and
> calculations done in TP_fast_assign() are done during the recording and
> hence adding more overhead to the trace itself.
Aha! that makes sense, thanks!
(/me goes and updates the tracing-part)
-Henrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160613/ffc2fe64/attachment.sig>
More information about the Alsa-devel
mailing list