Blame view
kernel/trace/trace_export.c
5.14 KB
770cb2434 tracing: add form... |
1 2 3 4 5 6 7 8 |
/* * trace_export.c - export basic ftrace utilities to user space * * Copyright (C) 2009 Steven Rostedt <srostedt@redhat.com> */ #include <linux/stringify.h> #include <linux/kallsyms.h> #include <linux/seq_file.h> |
770cb2434 tracing: add form... |
9 10 11 12 |
#include <linux/uaccess.h> #include <linux/ftrace.h> #include <linux/module.h> #include <linux/init.h> |
770cb2434 tracing: add form... |
13 14 |
#include "trace_output.h" |
4e5292ea1 tracing: use the ... |
15 16 |
#undef TRACE_SYSTEM #define TRACE_SYSTEM ftrace |
da4d03020 tracing: new form... |
17 |
|
e59a0bff3 ftrace: Add FTRAC... |
18 19 20 21 22 |
/* * The FTRACE_ENTRY_REG macro allows ftrace entry to define register * function and thus become accesible via perf. */ #undef FTRACE_ENTRY_REG |
02aa3162e ftrace: Allow to ... |
23 24 25 26 |
#define FTRACE_ENTRY_REG(name, struct_name, id, tstruct, print, \ filter, regfn) \ FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print), \ filter) |
e59a0bff3 ftrace: Add FTRAC... |
27 |
|
4e5292ea1 tracing: use the ... |
28 29 30 |
/* not needed for this file */ #undef __field_struct #define __field_struct(type, item) |
da4d03020 tracing: new form... |
31 |
|
4e5292ea1 tracing: use the ... |
32 |
#undef __field |
05ffa2d02 ftrace: add compi... |
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
#define __field(type, item) type item; #undef __field_desc #define __field_desc(type, container, item) type item; #undef __array #define __array(type, item, size) type item[size]; #undef __array_desc #define __array_desc(type, container, item, size) type item[size]; #undef __dynamic_array #define __dynamic_array(type, item) type item[]; #undef F_STRUCT #define F_STRUCT(args...) args #undef F_printk #define F_printk(fmt, args...) fmt, args #undef FTRACE_ENTRY |
02aa3162e ftrace: Allow to ... |
54 55 56 57 58 59 60 61 62 63 |
#define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter) \ struct ____ftrace_##name { \ tstruct \ }; \ static void __always_unused ____ftrace_check_##name(void) \ { \ struct ____ftrace_##name *__entry = NULL; \ \ /* force compile-time check on F_printk() */ \ printk(print); \ |
05ffa2d02 ftrace: add compi... |
64 65 66 |
} #undef FTRACE_ENTRY_DUP |
02aa3162e ftrace: Allow to ... |
67 68 69 |
#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print, filter) \ FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print), \ filter) |
05ffa2d02 ftrace: add compi... |
70 71 |
#include "trace_entries.h" |
4e5292ea1 tracing: use the ... |
72 73 74 75 76 |
#undef __field #define __field(type, item) \ ret = trace_define_field(event_call, #type, #item, \ offsetof(typeof(field), item), \ sizeof(field.item), \ |
02aa3162e ftrace: Allow to ... |
77 |
is_signed_type(type), filter_type); \ |
4e5292ea1 tracing: use the ... |
78 79 80 81 82 83 84 85 86 |
if (ret) \ return ret; #undef __field_desc #define __field_desc(type, container, item) \ ret = trace_define_field(event_call, #type, #item, \ offsetof(typeof(field), \ container.item), \ sizeof(field.container.item), \ |
02aa3162e ftrace: Allow to ... |
87 |
is_signed_type(type), filter_type); \ |
4e5292ea1 tracing: use the ... |
88 89 90 91 92 |
if (ret) \ return ret; #undef __array #define __array(type, item, len) \ |
042957801 tracing/events: S... |
93 |
do { \ |
87291347c tracing: Fix arra... |
94 |
char *type_str = #type"["__stringify(len)"]"; \ |
042957801 tracing/events: S... |
95 |
BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
87291347c tracing: Fix arra... |
96 |
ret = trace_define_field(event_call, type_str, #item, \ |
4e5292ea1 tracing: use the ... |
97 |
offsetof(typeof(field), item), \ |
fb7ae981c tracing: Fix sign... |
98 |
sizeof(field.item), \ |
02aa3162e ftrace: Allow to ... |
99 |
is_signed_type(type), filter_type); \ |
042957801 tracing/events: S... |
100 101 102 |
if (ret) \ return ret; \ } while (0); |
4e5292ea1 tracing: use the ... |
103 104 105 106 107 108 109 |
#undef __array_desc #define __array_desc(type, container, item, len) \ BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ ret = trace_define_field(event_call, #type "[" #len "]", #item, \ offsetof(typeof(field), \ container.item), \ |
fb7ae981c tracing: Fix sign... |
110 |
sizeof(field.container.item), \ |
02aa3162e ftrace: Allow to ... |
111 |
is_signed_type(type), filter_type); \ |
4e5292ea1 tracing: use the ... |
112 113 114 115 |
if (ret) \ return ret; #undef __dynamic_array |
809826a38 tracing: Have __d... |
116 117 118 |
#define __dynamic_array(type, item) \ ret = trace_define_field(event_call, #type, #item, \ offsetof(typeof(field), item), \ |
02aa3162e ftrace: Allow to ... |
119 |
0, is_signed_type(type), filter_type);\ |
809826a38 tracing: Have __d... |
120 121 |
if (ret) \ return ret; |
4e5292ea1 tracing: use the ... |
122 123 |
#undef FTRACE_ENTRY |
02aa3162e ftrace: Allow to ... |
124 |
#define FTRACE_ENTRY(name, struct_name, id, tstruct, print, filter) \ |
7e4f44b15 tracing: Annotate... |
125 |
static int __init \ |
4e5292ea1 tracing: use the ... |
126 |
ftrace_define_fields_##name(struct ftrace_event_call *event_call) \ |
e45f2e2bd tracing/filters: ... |
127 |
{ \ |
4e5292ea1 tracing: use the ... |
128 |
struct struct_name field; \ |
e45f2e2bd tracing/filters: ... |
129 |
int ret; \ |
02aa3162e ftrace: Allow to ... |
130 |
int filter_type = filter; \ |
e45f2e2bd tracing/filters: ... |
131 |
\ |
4e5292ea1 tracing: use the ... |
132 |
tstruct; \ |
e45f2e2bd tracing/filters: ... |
133 134 135 |
\ return ret; \ } |
4e5292ea1 tracing: use the ... |
136 |
#include "trace_entries.h" |
509e760cd tracing: Add prin... |
137 138 |
#undef __entry #define __entry REC |
4e5292ea1 tracing: use the ... |
139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
#undef __field #define __field(type, item) #undef __field_desc #define __field_desc(type, container, item) #undef __array #define __array(type, item, len) #undef __array_desc #define __array_desc(type, container, item, len) #undef __dynamic_array #define __dynamic_array(type, item) |
509e760cd tracing: Add prin... |
153 |
#undef F_printk |
01de982ab tracing: Fix ftra... |
154 |
#define F_printk(fmt, args...) __stringify(fmt) ", " __stringify(args) |
509e760cd tracing: Add prin... |
155 |
|
e59a0bff3 ftrace: Add FTRAC... |
156 |
#undef FTRACE_ENTRY_REG |
02aa3162e ftrace: Allow to ... |
157 158 |
#define FTRACE_ENTRY_REG(call, struct_name, etype, tstruct, print, filter,\ regfn) \ |
770cb2434 tracing: add form... |
159 |
\ |
523c81135 tracing: Fix some... |
160 |
struct ftrace_event_class __refdata event_class_ftrace_##call = { \ |
2e33af029 tracing: Move fie... |
161 162 |
.system = __stringify(TRACE_SYSTEM), \ .define_fields = ftrace_define_fields_##call, \ |
ffb9f9952 tracing: Remove r... |
163 |
.fields = LIST_HEAD_INIT(event_class_ftrace_##call.fields),\ |
e59a0bff3 ftrace: Add FTRAC... |
164 |
.reg = regfn, \ |
2e33af029 tracing: Move fie... |
165 166 |
}; \ \ |
e4a9ea5ee tracing: Replace ... |
167 |
struct ftrace_event_call __used event_##call = { \ |
2e33af029 tracing: Move fie... |
168 |
.class = &event_class_ftrace_##call, \ |
abb43f699 tracing: Fix anon... |
169 170 171 172 |
{ \ .name = #call, \ }, \ .event.type = etype, \ |
509e760cd tracing: Add prin... |
173 |
.print_fmt = print, \ |
754cb0071 tracing: remove f... |
174 |
.flags = TRACE_EVENT_FL_IGNORE_ENABLE, \ |
e1112b4d9 tracing/filters: ... |
175 |
}; \ |
e4a9ea5ee tracing: Replace ... |
176 177 |
struct ftrace_event_call __used \ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call; |
e1112b4d9 tracing/filters: ... |
178 |
|
e59a0bff3 ftrace: Add FTRAC... |
179 |
#undef FTRACE_ENTRY |
02aa3162e ftrace: Allow to ... |
180 |
#define FTRACE_ENTRY(call, struct_name, etype, tstruct, print, filter) \ |
e59a0bff3 ftrace: Add FTRAC... |
181 |
FTRACE_ENTRY_REG(call, struct_name, etype, \ |
02aa3162e ftrace: Allow to ... |
182 |
PARAMS(tstruct), PARAMS(print), filter, NULL) |
e59a0bff3 ftrace: Add FTRAC... |
183 |
|
ced39002f ftrace, perf: Add... |
184 185 186 187 |
int ftrace_event_is_function(struct ftrace_event_call *call) { return call == &event_function; } |
4e5292ea1 tracing: use the ... |
188 |
#include "trace_entries.h" |