All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTTng-module PATCH] Update prink:console tracepoint for 3.10 kernel
@ 2013-06-28  5:14 Yannick Brosseau
  0 siblings, 0 replies; 2+ messages in thread
From: Yannick Brosseau @ 2013-06-28  5:14 UTC (permalink / raw)
  To: lttng-dev

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
---
 instrumentation/events/lttng-module/printk.h |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/instrumentation/events/lttng-module/printk.h b/instrumentation/events/lttng-module/printk.h
index 4c744f9..16f5716 100644
--- a/instrumentation/events/lttng-module/printk.h
+++ b/instrumentation/events/lttng-module/printk.h
@@ -9,6 +9,31 @@
 
 #define MSG_TRACE_MAX_LEN	2048
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
+TRACE_EVENT(console,
+        TP_PROTO(const char *text, size_t len),
+
+        TP_ARGS(text, len),
+
+        TP_STRUCT__entry(
+                __dynamic_array_text(char, msg, min_t(unsigned, len, MSG_TRACE_MAX_LEN))
+        ),
+
+        TP_fast_assign(
+                tp_memcpy_dyn(msg,
+                        ({
+                                char lmsg[MSG_TRACE_MAX_LEN + 1];
+				unsigned start = 0;
+                                if (len > MSG_TRACE_MAX_LEN) {
+                                        start = len - MSG_TRACE_MAX_LEN;
+					len = MSG_TRACE_MAX_LEN;
+				}
+                                memcpy(lmsg, text + start, len);
+                                lmsg[len] = 0;
+                                lmsg;
+                        })
+                )
+#else
 TRACE_EVENT_CONDITION(console,
 	TP_PROTO(const char *log_buf, unsigned start, unsigned end,
 		 unsigned log_buf_len),
@@ -54,6 +79,7 @@ TRACE_EVENT_CONDITION(console,
 				lmsg;
 			})
 		)
+#endif
 	),
 
 	TP_printk("%s", __get_str(msg))
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTTng-module PATCH] Update prink:console tracepoint for 3.10 kernel
       [not found] <1372396469-23371-1-git-send-email-yannick.brosseau@gmail.com>
@ 2013-06-28 19:42 ` Mathieu Desnoyers
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2013-06-28 19:42 UTC (permalink / raw)
  To: Yannick Brosseau; +Cc: lttng-dev

* Yannick Brosseau (yannick.brosseau@gmail.com) wrote:
> Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
> ---
>  instrumentation/events/lttng-module/printk.h |   26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/instrumentation/events/lttng-module/printk.h b/instrumentation/events/lttng-module/printk.h
> index 4c744f9..16f5716 100644
> --- a/instrumentation/events/lttng-module/printk.h
> +++ b/instrumentation/events/lttng-module/printk.h
> @@ -9,6 +9,31 @@
>  
>  #define MSG_TRACE_MAX_LEN	2048
>  
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
> +TRACE_EVENT(console,
> +        TP_PROTO(const char *text, size_t len),
> +
> +        TP_ARGS(text, len),
> +
> +        TP_STRUCT__entry(
> +                __dynamic_array_text(char, msg, min_t(unsigned, len, MSG_TRACE_MAX_LEN))
> +        ),
> +
> +        TP_fast_assign(
> +                tp_memcpy_dyn(msg,
> +                        ({
> +                                char lmsg[MSG_TRACE_MAX_LEN + 1];
> +				unsigned start = 0;

tab alignment issues ?

Thanks,

Mathieu

> +                                if (len > MSG_TRACE_MAX_LEN) {
> +                                        start = len - MSG_TRACE_MAX_LEN;
> +					len = MSG_TRACE_MAX_LEN;
> +				}
> +                                memcpy(lmsg, text + start, len);
> +                                lmsg[len] = 0;
> +                                lmsg;
> +                        })
> +                )
> +#else
>  TRACE_EVENT_CONDITION(console,
>  	TP_PROTO(const char *log_buf, unsigned start, unsigned end,
>  		 unsigned log_buf_len),
> @@ -54,6 +79,7 @@ TRACE_EVENT_CONDITION(console,
>  				lmsg;
>  			})
>  		)
> +#endif
>  	),
>  
>  	TP_printk("%s", __get_str(msg))
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-28 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-28  5:14 [LTTng-module PATCH] Update prink:console tracepoint for 3.10 kernel Yannick Brosseau
     [not found] <1372396469-23371-1-git-send-email-yannick.brosseau@gmail.com>
2013-06-28 19:42 ` Mathieu Desnoyers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.