16949c4d83da54c25cebc73c01fb655c387da558
[deliverable/lttng-modules.git] / instrumentation / events / lttng-module / printk.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM printk
3
4 #if !defined(LTTNG_TRACE_PRINTK_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_PRINTK_H
6
7 #include "../../../probes/lttng-tracepoint-event.h"
8 #include <linux/version.h>
9
10 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
11
12 LTTNG_TRACEPOINT_EVENT(console,
13 TP_PROTO(const char *text, size_t len),
14
15 TP_ARGS(text, len),
16
17 TP_STRUCT__entry(
18 __dynamic_array_text(char, msg, len)
19 ),
20
21 TP_fast_assign(
22 tp_memcpy_dyn(msg, text)
23 ),
24
25 TP_printk("%s", __get_str(msg))
26 )
27
28 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
29
30 LTTNG_TRACEPOINT_EVENT_CONDITION(console,
31 TP_PROTO(const char *log_buf, unsigned start, unsigned end,
32 unsigned log_buf_len),
33
34 TP_ARGS(log_buf, start, end, log_buf_len),
35
36 TP_CONDITION(start != end),
37
38 TP_STRUCT__entry(
39 __dynamic_array_text(char, msg, end - start)
40 ),
41
42 TP_fast_assign(
43 tp_memcpy_dyn(msg, log_buf + start)
44 ),
45
46 TP_printk("%s", __get_str(msg))
47 )
48
49 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */
50
51 LTTNG_TRACEPOINT_EVENT_CONDITION(console,
52 TP_PROTO(const char *log_buf, unsigned start, unsigned end,
53 unsigned log_buf_len),
54
55 TP_ARGS(log_buf, start, end, log_buf_len),
56
57 TP_CONDITION(start != end),
58
59 TP_STRUCT__entry(
60 __dynamic_array_text_2(char, msg,
61 (start & (log_buf_len - 1)) > (end & (log_buf_len - 1))
62 ? log_buf_len - (start & (log_buf_len - 1))
63 : end - start,
64 (start & (log_buf_len - 1)) > (end & (log_buf_len - 1))
65 ? end & (log_buf_len - 1)
66 : 0)
67 ),
68
69 TP_fast_assign(
70 tp_memcpy_dyn_2(msg,
71 log_buf + (start & (log_buf_len - 1)),
72 log_buf)
73 ),
74
75 TP_printk("%s", __get_str(msg))
76 )
77
78 #endif
79
80 #endif /* LTTNG_TRACE_PRINTK_H */
81
82 /* This part must be outside protection */
83 #include "../../../probes/define_trace.h"
This page took 0.032142 seconds and 4 git commands to generate.