xref: /linux/include/trace/events/printk.h (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM printk
3 
4 #if !defined(_TRACE_PRINTK_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_PRINTK_H
6 
7 #include <linux/tracepoint.h>
8 
9 TRACE_EVENT(console,
10 	TP_PROTO(const char *text, size_t len),
11 
12 	TP_ARGS(text, len),
13 
14 	TP_STRUCT__entry(
15 		__dynamic_array(char, msg, len + 1)
16 	),
17 
18 	TP_fast_assign(
19 		/*
20 		 * Each trace entry is printed in a new line.
21 		 * If the msg finishes with '\n', cut it off
22 		 * to avoid blank lines in the trace.
23 		 */
24 		if ((len > 0) && (text[len-1] == '\n'))
25 			len -= 1;
26 
27 		memcpy(__get_str(msg), text, len);
28 		__get_str(msg)[len] = 0;
29 	),
30 
31 	TP_printk("%s", __get_str(msg))
32 );
33 #endif /* _TRACE_PRINTK_H */
34 
35 /* This part must be outside protection */
36 #include <trace/define_trace.h>
37