Thread (64 messages) flat view 64 messages, 9 authors, 2016-06-23

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

From: Henrik Austad <hidden>
Date: 2016-06-13 07:20:59
Also in: alsa-devel, linux-media, lkml

On Sun, Jun 12, 2016 at 10:22:01PM -0400, Steven Rostedt wrote:
On Sun, 12 Jun 2016 23:25:10 +0200
Henrik Austad [off-list ref] wrote:
quoted
quoted
quoted
+#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!
quoted
https://lwn.net/Articles/381064/
quoted
quoted
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help