Re: [very-RFC 6/8] Add TSN event-tracing

Henrik Austad
2016-06-13T07:20:56Z

[-- Attachment #1: Type: text/plain, Size: 1917 bytes --]

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@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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]