-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathparrot_trace.patch
177 lines (176 loc) · 4.66 KB
/
parrot_trace.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
diff -ruN lttng-modules-2.8.3/instrumentation/events/lttng-module/parrot_trace.h lttng-modules-2.8.3/instrumentation/events/lttng-module/parrot_trace.h
--- lttng-modules-2.8.3/instrumentation/events/lttng-module/parrot_trace.h 1970-01-01 01:00:00.000000000 +0100
+++ lttng-modules-2.8.3/instrumentation/events/lttng-module/parrot_trace.h 2014-08-05 18:23:43.398066875 +0200
@@ -0,0 +1,45 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM parrot_trace
+
+#if !defined(_PARROT_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _PARROT_TRACE_H
+
+#include "../../../probes/lttng-tracepoint-event.h"
+
+LTTNG_TRACEPOINT_EVENT(user_kevent_start,
+
+ TP_PROTO(int evt),
+
+ TP_ARGS(evt),
+
+ TP_FIELDS(
+ ctf_integer(int, event_start, evt)
+ )
+)
+
+LTTNG_TRACEPOINT_EVENT(user_kevent_stop,
+
+ TP_PROTO(int evt),
+
+ TP_ARGS(evt),
+
+ TP_FIELDS(
+ ctf_integer(int, event_stop, evt)
+ )
+)
+
+LTTNG_TRACEPOINT_EVENT(user_kmessage,
+
+ TP_PROTO(char *str),
+
+ TP_ARGS(str),
+
+ TP_FIELDS(
+ ctf_string(message, str)
+ )
+)
+
+#endif /* _PARROT_TRACE_H */
+
+/* This part must be outside protection */
+#include "../../../probes/define_trace.h"
diff -ruN lttng-modules-2.8.3/instrumentation/events/mainline/parrot_trace.h lttng-modules-2.8.3/instrumentation/events/mainline/parrot_trace.h
--- lttng-modules-2.8.3/instrumentation/events/mainline/parrot_trace.h 1970-01-01 01:00:00.000000000 +0100
+++ lttng-modules-2.8.3/instrumentation/events/mainline/parrot_trace.h 2014-08-05 18:23:43.398066875 +0200
@@ -0,0 +1,61 @@
+#undef TRACE_SYSEM
+#define TRACE_SYSTEM parrot_trace
+
+#if !defined(_PARROT_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _PARROT_TRACE_H
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(user_kevent_start,
+
+ TP_PROTO(int evt),
+
+ TP_ARGS(evt),
+
+ TP_STRUCT__entry(
+ __field( int, event_start)
+ ),
+
+ TP_fast_assign(
+ __entry->event_start = evt;
+ ),
+
+ TP_printk("start = %d", __entry->event_start)
+)
+
+TRACE_EVENT(user_kevent_stop,
+
+ TP_PROTO(int evt),
+
+ TP_ARGS(evt),
+
+ TP_STRUCT__entry(
+ __field( int, event_stop)
+ ),
+
+ TP_fast_assign(
+ __entry->event_stop = evt;
+ ),
+
+ TP_printk("stop = %d", __entry->event_stop)
+)
+
+TRACE_EVENT(user_kmessage,
+
+ TP_PROTO(char *str),
+
+ TP_ARGS(str),
+
+ TP_STRUCT__entry(
+ __string( message, str)
+ ),
+
+ TP_fast_assign(
+ __assign_str(message, str);
+ ),
+
+ TP_printk("message = %s", __get_str(message))
+)
+
+#endif
+
+#include <trace/define_trace.h>
diff -ruN lttng-modules-2.8.3/probes/lttng-probe-parrot.c lttng-modules-2.8.3/probes/lttng-probe-parrot.c
--- lttng-modules-2.8.3/probes/lttng-probe-parrot.c 1970-01-01 01:00:00.000000000 +0100
+++ lttng-modules-2.8.3/probes/lttng-probe-parrot.c 2014-08-05 18:23:43.398066875 +0200
@@ -0,0 +1,43 @@
+/*
+ * probes/lttng-probe-parrot.c
+ *
+ * Parrot LTTng probes.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; only
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <linux/module.h>
+#include "../wrapper/tracepoint.h"
+
+/*
+ * Create the tracepoint static inlines from the kernel to validate that our
+ * trace event macros match the kernel we run on.
+ */
+
+#include <trace/events/parrot_trace.h>
+
+/*
+ * Create LTTng tracepoint probes.
+ */
+#define LTTNG_PACKAGE_BUILD
+#define CREATE_TRACE_POINTS
+#define TRACE_INCLUDE_PATH ../instrumentation/events/lttng-module
+
+#include "../instrumentation/events/lttng-module/parrot_trace.h"
+
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Damien Riegel <[email protected]>");
+MODULE_DESCRIPTION("Parrot LTTng probes");
diff -Nur lttng-modules-2.8.3.orig/probes/Kbuild lttng-modules-2.8.3/probes/Kbuild
--- lttng-modules-2.8.3.orig/probes/Kbuild 2016-10-13 16:20:22.000000000 +0200
+++ lttng-modules-2.8.3/probes/Kbuild 2016-10-31 09:46:56.801717336 +0100
@@ -12,6 +12,12 @@
obj-$(CONFIG_LTTNG) += lttng-probe-power.o
obj-$(CONFIG_LTTNG) += lttng-probe-statedump.o
+ifneq ($(wildcard $(KERNELDIR)/include/trace/events/parrot_trace.h),)
+obj-m += lttng-probe-parrot.o
+else
+ $(warning "Parrot tracers missing in kernel tree")
+endif
+
ifneq ($(CONFIG_KVM),)
obj-$(CONFIG_LTTNG) += lttng-probe-kvm.o
ifneq ($(CONFIG_X86),)