Blame view
kernel/trace/trace.h
23.5 KB
bc0c38d13 ftrace: latency t... |
1 2 3 4 |
#ifndef _LINUX_KERNEL_TRACE_H #define _LINUX_KERNEL_TRACE_H #include <linux/fs.h> |
60063497a atomic: use <linu... |
5 |
#include <linux/atomic.h> |
bc0c38d13 ftrace: latency t... |
6 7 |
#include <linux/sched.h> #include <linux/clocksource.h> |
3928a8a2d ftrace: make work... |
8 |
#include <linux/ring_buffer.h> |
bd8ac686c ftrace: mmiotrace... |
9 |
#include <linux/mmiotrace.h> |
4e5292ea1 tracing: use the ... |
10 |
#include <linux/tracepoint.h> |
d13744cd6 tracing/ftrace: a... |
11 |
#include <linux/ftrace.h> |
24f1e32c6 hw-breakpoints: R... |
12 |
#include <linux/hw_breakpoint.h> |
9504504cb tracing: make tra... |
13 |
#include <linux/trace_seq.h> |
97f202515 tracing/events: m... |
14 |
#include <linux/ftrace_event.h> |
9504504cb tracing: make tra... |
15 |
|
72829bc3d ftrace: move enum... |
16 17 18 19 20 21 22 |
enum trace_type { __TRACE_FIRST_TYPE = 0, TRACE_FN, TRACE_CTX, TRACE_WAKE, TRACE_STACK, |
dd0e545f0 ftrace: printk fo... |
23 |
TRACE_PRINT, |
48ead0203 tracing/core: bri... |
24 |
TRACE_BPRINT, |
bd8ac686c ftrace: mmiotrace... |
25 26 |
TRACE_MMIO_RW, TRACE_MMIO_MAP, |
9f029e83e ftrace: rename un... |
27 |
TRACE_BRANCH, |
287b6e68c tracing/function-... |
28 29 |
TRACE_GRAPH_RET, TRACE_GRAPH_ENT, |
02b67518e tracing: add supp... |
30 |
TRACE_USER_STACK, |
c71a89615 blktrace: add ftr... |
31 |
TRACE_BLK, |
72829bc3d ftrace: move enum... |
32 |
|
f0868d1e2 ftrace: set up tr... |
33 |
__TRACE_LAST_TYPE, |
72829bc3d ftrace: move enum... |
34 |
}; |
bc0c38d13 ftrace: latency t... |
35 |
|
0a1c49db8 tracing: use macr... |
36 37 |
#undef __field #define __field(type, item) type item; |
86387f7ee ftrace: add stack... |
38 |
|
d73150943 tracing: show det... |
39 40 |
#undef __field_struct #define __field_struct(type, item) __field(type, item) |
86387f7ee ftrace: add stack... |
41 |
|
d73150943 tracing: show det... |
42 43 |
#undef __field_desc #define __field_desc(type, container, item) |
02b67518e tracing: add supp... |
44 |
|
0a1c49db8 tracing: use macr... |
45 46 |
#undef __array #define __array(type, item, size) type item[size]; |
1427cdf05 tracing: infrastr... |
47 |
|
d73150943 tracing: show det... |
48 49 |
#undef __array_desc #define __array_desc(type, container, item, size) |
777e208d4 ftrace: take adva... |
50 |
|
0a1c49db8 tracing: use macr... |
51 52 |
#undef __dynamic_array #define __dynamic_array(type, item) type item[]; |
777e208d4 ftrace: take adva... |
53 |
|
0a1c49db8 tracing: use macr... |
54 55 |
#undef F_STRUCT #define F_STRUCT(args...) args |
742390728 tracing/fastboot:... |
56 |
|
0a1c49db8 tracing: use macr... |
57 58 59 60 61 62 |
#undef FTRACE_ENTRY #define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \ struct struct_name { \ struct trace_entry ent; \ tstruct \ } |
777e208d4 ftrace: take adva... |
63 |
|
0a1c49db8 tracing: use macr... |
64 65 |
#undef TP_ARGS #define TP_ARGS(args...) args |
52f232cb7 tracing: likely/u... |
66 |
|
0a1c49db8 tracing: use macr... |
67 68 |
#undef FTRACE_ENTRY_DUP #define FTRACE_ENTRY_DUP(name, name_struct, id, tstruct, printk) |
1e9b51c28 x86, bts, ftrace:... |
69 |
|
0a1c49db8 tracing: use macr... |
70 |
#include "trace_entries.h" |
36994e58a tracing/kmemtrace... |
71 |
|
0a1c49db8 tracing: use macr... |
72 73 74 75 |
/* * syscalls are special, and need special handling, this is why * they are not included in trace_entries.h */ |
bed1ffca0 tracing/syscalls:... |
76 77 78 79 80 81 82 83 84 |
struct syscall_trace_enter { struct trace_entry ent; int nr; unsigned long args[]; }; struct syscall_trace_exit { struct trace_entry ent; int nr; |
99df5a6a2 trace/syscalls: C... |
85 |
long ret; |
bed1ffca0 tracing/syscalls:... |
86 |
}; |
93ccae7a2 tracing/kprobes: ... |
87 |
struct kprobe_trace_entry_head { |
413d37d1e tracing: Add kpro... |
88 89 |
struct trace_entry ent; unsigned long ip; |
413d37d1e tracing: Add kpro... |
90 |
}; |
93ccae7a2 tracing/kprobes: ... |
91 |
struct kretprobe_trace_entry_head { |
413d37d1e tracing: Add kpro... |
92 93 94 |
struct trace_entry ent; unsigned long func; unsigned long ret_ip; |
413d37d1e tracing: Add kpro... |
95 |
}; |
dd0e545f0 ftrace: printk fo... |
96 |
/* |
fc5e27ae4 mmiotrace: handle... |
97 98 |
* trace_flag_type is an enumeration that holds different * states when a trace occurs. These are: |
9244489a7 ftrace: handle ar... |
99 |
* IRQS_OFF - interrupts were disabled |
9de36825b tracing: trace_bp... |
100 |
* IRQS_NOSUPPORT - arch does not support irqs_disabled_flags |
bd9cfca9c tracing: format c... |
101 |
* NEED_RESCHED - reschedule is requested |
9244489a7 ftrace: handle ar... |
102 103 |
* HARDIRQ - inside an interrupt handler * SOFTIRQ - inside a softirq handler |
fc5e27ae4 mmiotrace: handle... |
104 105 106 |
*/ enum trace_flag_type { TRACE_FLAG_IRQS_OFF = 0x01, |
9244489a7 ftrace: handle ar... |
107 108 109 110 |
TRACE_FLAG_IRQS_NOSUPPORT = 0x02, TRACE_FLAG_NEED_RESCHED = 0x04, TRACE_FLAG_HARDIRQ = 0x08, TRACE_FLAG_SOFTIRQ = 0x10, |
fc5e27ae4 mmiotrace: handle... |
111 |
}; |
5bf9a1ee3 ftrace: inject ma... |
112 |
#define TRACE_BUF_SIZE 1024 |
bc0c38d13 ftrace: latency t... |
113 114 115 116 117 118 119 |
/* * The CPU trace array - it consists of thousands of trace entries * plus some other descriptor data: (for example which task started * the trace, etc.) */ struct trace_array_cpu { |
bc0c38d13 ftrace: latency t... |
120 |
atomic_t disabled; |
2cadf9135 tracing: add bina... |
121 |
void *buffer_page; /* ring buffer spare */ |
4e3c3333f ftrace: fix time ... |
122 |
|
bc0c38d13 ftrace: latency t... |
123 124 125 126 127 128 129 |
unsigned long saved_latency; unsigned long critical_start; unsigned long critical_end; unsigned long critical_sequence; unsigned long nice; unsigned long policy; unsigned long rt_priority; |
2f26ebd54 tracing: use time... |
130 |
unsigned long skipped_entries; |
bc0c38d13 ftrace: latency t... |
131 132 133 134 135 |
cycle_t preempt_timestamp; pid_t pid; uid_t uid; char comm[TASK_COMM_LEN]; }; |
bc0c38d13 ftrace: latency t... |
136 137 138 139 140 141 |
/* * The trace array - an array of per-CPU trace arrays. This is the * highest level data structure that individual tracers deal with. * They have on/off state as well: */ struct trace_array { |
3928a8a2d ftrace: make work... |
142 |
struct ring_buffer *buffer; |
bc0c38d13 ftrace: latency t... |
143 |
unsigned long entries; |
bc0c38d13 ftrace: latency t... |
144 145 |
int cpu; cycle_t time_start; |
b3806b431 ftrace: user run ... |
146 |
struct task_struct *waiter; |
bc0c38d13 ftrace: latency t... |
147 148 |
struct trace_array_cpu *data[NR_CPUS]; }; |
7104f300c ftrace: type cast... |
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 178 179 |
#define FTRACE_CMP_TYPE(var, type) \ __builtin_types_compatible_p(typeof(var), type *) #undef IF_ASSIGN #define IF_ASSIGN(var, entry, etype, id) \ if (FTRACE_CMP_TYPE(var, etype)) { \ var = (typeof(var))(entry); \ WARN_ON(id && (entry)->type != id); \ break; \ } /* Will cause compile errors if type is not found. */ extern void __ftrace_bad_type(void); /* * The trace_assign_type is a verifier that the entry type is * the same as the type being assigned. To add new types simply * add a line with the following format: * * IF_ASSIGN(var, ent, type, id); * * Where "type" is the trace type that includes the trace_entry * as the "ent" item. And "id" is the trace identifier that is * used in the trace_type enum. * * If the type can have more than one id, then use zero. */ #define trace_assign_type(var, ent) \ do { \ IF_ASSIGN(var, ent, struct ftrace_entry, TRACE_FN); \ IF_ASSIGN(var, ent, struct ctx_switch_entry, 0); \ |
7104f300c ftrace: type cast... |
180 |
IF_ASSIGN(var, ent, struct stack_entry, TRACE_STACK); \ |
02b67518e tracing: add supp... |
181 |
IF_ASSIGN(var, ent, struct userstack_entry, TRACE_USER_STACK);\ |
7104f300c ftrace: type cast... |
182 |
IF_ASSIGN(var, ent, struct print_entry, TRACE_PRINT); \ |
48ead0203 tracing/core: bri... |
183 |
IF_ASSIGN(var, ent, struct bprint_entry, TRACE_BPRINT); \ |
7104f300c ftrace: type cast... |
184 185 186 187 |
IF_ASSIGN(var, ent, struct trace_mmiotrace_rw, \ TRACE_MMIO_RW); \ IF_ASSIGN(var, ent, struct trace_mmiotrace_map, \ TRACE_MMIO_MAP); \ |
9f029e83e ftrace: rename un... |
188 |
IF_ASSIGN(var, ent, struct trace_branch, TRACE_BRANCH); \ |
287b6e68c tracing/function-... |
189 190 191 192 |
IF_ASSIGN(var, ent, struct ftrace_graph_ent_entry, \ TRACE_GRAPH_ENT); \ IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry, \ TRACE_GRAPH_RET); \ |
7104f300c ftrace: type cast... |
193 194 |
__ftrace_bad_type(); \ } while (0) |
2c4f035f6 tracing/ftrace: c... |
195 |
|
adf9f1957 tracing/ftrace: i... |
196 197 198 199 200 201 |
/* * An option specific to a tracer. This is a boolean value. * The bit is the bit index that sets its value on the * flags value in struct tracer_flags. */ struct tracer_opt { |
9de36825b tracing: trace_bp... |
202 203 |
const char *name; /* Will appear on the trace_options file */ u32 bit; /* Mask assigned in val field in tracer_flags */ |
adf9f1957 tracing/ftrace: i... |
204 205 206 207 208 209 210 211 |
}; /* * The set of specific options for a tracer. Your tracer * have to set the initial value of the flags val. */ struct tracer_flags { u32 val; |
9de36825b tracing: trace_bp... |
212 |
struct tracer_opt *opts; |
adf9f1957 tracing/ftrace: i... |
213 214 215 216 |
}; /* Makes more easy to define a tracer opt */ #define TRACER_OPT(s, b) .name = #s, .bit = b |
034939b65 tracing/ftrace: h... |
217 |
|
6eaaa5d57 tracing/core: use... |
218 219 220 221 222 223 224 225 226 227 228 |
/** * struct tracer - a specific tracer and its callbacks to interact with debugfs * @name: the name chosen to select it on the available_tracers file * @init: called when one switches to this tracer (echo name > current_tracer) * @reset: called when one switches to another tracer * @start: called when tracing is unpaused (echo 1 > tracing_enabled) * @stop: called when tracing is paused (echo 0 > tracing_enabled) * @open: called when the trace file is opened * @pipe_open: called when the trace_pipe file is opened * @wait_pipe: override how the user waits for traces on trace_pipe * @close: called when the trace file is released |
c521efd17 tracing: Add pipe... |
229 |
* @pipe_close: called when the trace_pipe file is released |
6eaaa5d57 tracing/core: use... |
230 231 232 233 234 235 236 |
* @read: override the default read callback on trace_pipe * @splice_read: override the default splice_read callback on trace_pipe * @selftest: selftest to run on boot (see trace_selftest.c) * @print_headers: override the first lines that describe your columns * @print_line: callback that prints a trace * @set_flag: signals one of your private flags changed (trace_options file) * @flags: your private flags |
bc0c38d13 ftrace: latency t... |
237 238 239 |
*/ struct tracer { const char *name; |
1c80025a4 tracing/ftrace: c... |
240 |
int (*init)(struct trace_array *tr); |
bc0c38d13 ftrace: latency t... |
241 |
void (*reset)(struct trace_array *tr); |
9036990d4 ftrace: restructu... |
242 243 |
void (*start)(struct trace_array *tr); void (*stop)(struct trace_array *tr); |
bc0c38d13 ftrace: latency t... |
244 |
void (*open)(struct trace_iterator *iter); |
107bad8be ftrace: add trace... |
245 |
void (*pipe_open)(struct trace_iterator *iter); |
6eaaa5d57 tracing/core: use... |
246 |
void (*wait_pipe)(struct trace_iterator *iter); |
bc0c38d13 ftrace: latency t... |
247 |
void (*close)(struct trace_iterator *iter); |
c521efd17 tracing: Add pipe... |
248 |
void (*pipe_close)(struct trace_iterator *iter); |
107bad8be ftrace: add trace... |
249 250 251 |
ssize_t (*read)(struct trace_iterator *iter, struct file *filp, char __user *ubuf, size_t cnt, loff_t *ppos); |
3c56819b1 tracing: splice s... |
252 253 254 255 256 257 |
ssize_t (*splice_read)(struct trace_iterator *iter, struct file *filp, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags); |
60a11774b ftrace: add self-... |
258 259 260 261 |
#ifdef CONFIG_FTRACE_STARTUP_TEST int (*selftest)(struct tracer *trace, struct trace_array *tr); #endif |
8bba1bf5e x86, ftrace: call... |
262 |
void (*print_header)(struct seq_file *m); |
2c4f035f6 tracing/ftrace: c... |
263 |
enum print_line_t (*print_line)(struct trace_iterator *iter); |
adf9f1957 tracing/ftrace: i... |
264 265 |
/* If you handled the flag setting, return 0 */ int (*set_flag)(u32 old_flags, u32 bit, int set); |
bc0c38d13 ftrace: latency t... |
266 |
struct tracer *next; |
9de36825b tracing: trace_bp... |
267 |
struct tracer_flags *flags; |
9a24470b2 tracing: Align 4 ... |
268 |
int print_max; |
ef710e100 tracing: Shrink m... |
269 |
int use_max_tr; |
bc0c38d13 ftrace: latency t... |
270 |
}; |
f9520750c tracing: make tra... |
271 |
|
e4a3f541f tracing: Still tr... |
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
/* Only current can touch trace_recursion */ #define trace_recursion_inc() do { (current)->trace_recursion++; } while (0) #define trace_recursion_dec() do { (current)->trace_recursion--; } while (0) /* Ring buffer has the 10 LSB bits to count */ #define trace_recursion_buffer() ((current)->trace_recursion & 0x3ff) /* for function tracing recursion */ #define TRACE_INTERNAL_BIT (1<<11) #define TRACE_GLOBAL_BIT (1<<12) /* * Abuse of the trace_recursion. * As we need a way to maintain state if we are tracing the function * graph in irq because we want to trace a particular function that * was called in irq context but we have irq tracing off. Since this * can only be modified by current, we can reuse trace_recursion. */ #define TRACE_IRQ_BIT (1<<13) #define trace_recursion_set(bit) do { (current)->trace_recursion |= (bit); } while (0) #define trace_recursion_clear(bit) do { (current)->trace_recursion &= ~(bit); } while (0) #define trace_recursion_test(bit) ((current)->trace_recursion & (bit)) |
b04cc6b1f tracing/core: int... |
294 |
#define TRACE_PIPE_ALL_CPU -1 |
b6f11df26 trace: Call traci... |
295 |
int tracer_init(struct tracer *t, struct trace_array *tr); |
9036990d4 ftrace: restructu... |
296 |
int tracing_is_enabled(void); |
45dcd8b8a ftrace: move mmio... |
297 |
void trace_wake_up(void); |
3928a8a2d ftrace: make work... |
298 |
void tracing_reset(struct trace_array *tr, int cpu); |
213cc0607 ftrace: introduce... |
299 |
void tracing_reset_online_cpus(struct trace_array *tr); |
9456f0fa6 tracing: reset ri... |
300 301 |
void tracing_reset_current(int cpu); void tracing_reset_current_online_cpus(void); |
bc0c38d13 ftrace: latency t... |
302 |
int tracing_open_generic(struct inode *inode, struct file *filp); |
5452af664 tracing/ftrace: f... |
303 304 305 306 307 |
struct dentry *trace_create_file(const char *name, mode_t mode, struct dentry *parent, void *data, const struct file_operations *fops); |
bc0c38d13 ftrace: latency t... |
308 |
struct dentry *tracing_init_dentry(void); |
d618b3e6e ftrace: sysprof u... |
309 |
|
51a763dd8 tracing: Introduc... |
310 |
struct ring_buffer_event; |
e77405ad8 tracing: pass aro... |
311 312 313 314 315 316 317 |
struct ring_buffer_event * trace_buffer_lock_reserve(struct ring_buffer *buffer, int type, unsigned long len, unsigned long flags, int pc); void trace_buffer_unlock_commit(struct ring_buffer *buffer, |
51a763dd8 tracing: Introduc... |
318 319 |
struct ring_buffer_event *event, unsigned long flags, int pc); |
45dcd8b8a ftrace: move mmio... |
320 321 |
struct trace_entry *tracing_get_trace_entry(struct trace_array *tr, struct trace_array_cpu *data); |
c4a8e8be2 trace: better man... |
322 323 324 |
struct trace_entry *trace_find_next_entry(struct trace_iterator *iter, int *ent_cpu, u64 *ent_ts); |
955b61e59 ftrace,kdb: Exten... |
325 326 327 328 329 330 331 |
int trace_empty(struct trace_iterator *iter); void *trace_find_next_entry_inc(struct trace_iterator *iter); void trace_init_global_iter(struct trace_iterator *iter); void tracing_iter_reset(struct trace_iterator *iter, int cpu); |
6eaaa5d57 tracing/core: use... |
332 333 |
void default_wait_pipe(struct trace_iterator *iter); void poll_wait_pipe(struct trace_iterator *iter); |
bc0c38d13 ftrace: latency t... |
334 335 336 337 |
void ftrace(struct trace_array *tr, struct trace_array_cpu *data, unsigned long ip, unsigned long parent_ip, |
38697053f ftrace: preempt d... |
338 |
unsigned long flags, int pc); |
bc0c38d13 ftrace: latency t... |
339 |
void tracing_sched_switch_trace(struct trace_array *tr, |
bc0c38d13 ftrace: latency t... |
340 341 |
struct task_struct *prev, struct task_struct *next, |
38697053f ftrace: preempt d... |
342 |
unsigned long flags, int pc); |
57422797d ftrace: add wakeu... |
343 344 |
void tracing_sched_wakeup_trace(struct trace_array *tr, |
57422797d ftrace: add wakeu... |
345 346 |
struct task_struct *wakee, struct task_struct *cur, |
38697053f ftrace: preempt d... |
347 |
unsigned long flags, int pc); |
6fb44b717 ftrace: add trace... |
348 |
void trace_function(struct trace_array *tr, |
6fb44b717 ftrace: add trace... |
349 350 |
unsigned long ip, unsigned long parent_ip, |
38697053f ftrace: preempt d... |
351 |
unsigned long flags, int pc); |
0a772620a tracing: Make gra... |
352 353 354 355 |
void trace_graph_function(struct trace_array *tr, unsigned long ip, unsigned long parent_ip, unsigned long flags, int pc); |
62b915f10 tracing: Add grap... |
356 357 358 |
void trace_default_header(struct seq_file *m); void print_trace_header(struct seq_file *m, struct trace_iterator *iter); int trace_empty(struct trace_iterator *iter); |
bc0c38d13 ftrace: latency t... |
359 |
|
287b6e68c tracing/function-... |
360 |
void trace_graph_return(struct ftrace_graph_ret *trace); |
e49dc19c6 ftrace: function ... |
361 |
int trace_graph_entry(struct ftrace_graph_ent *trace); |
1a0799a8f tracing/function-... |
362 |
void set_graph_array(struct trace_array *tr); |
1e9b51c28 x86, bts, ftrace:... |
363 |
|
41bc8144d ftrace: fix up cm... |
364 365 |
void tracing_start_cmdline_record(void); void tracing_stop_cmdline_record(void); |
e168e0516 ftrace: fix sched... |
366 367 368 |
void tracing_sched_switch_assign_trace(struct trace_array *tr); void tracing_stop_sched_switch_record(void); void tracing_start_sched_switch_record(void); |
bc0c38d13 ftrace: latency t... |
369 370 |
int register_tracer(struct tracer *type); void unregister_tracer(struct tracer *type); |
b5130b1e7 tracing: do not u... |
371 |
int is_tracing_stopped(void); |
955b61e59 ftrace,kdb: Exten... |
372 373 374 375 376 377 378 379 380 |
enum trace_file_type { TRACE_FILE_LAT_FMT = 1, TRACE_FILE_ANNOTATE = 2, }; extern cpumask_var_t __read_mostly tracing_buffer_mask; #define for_each_tracing_cpu(cpu) \ for_each_cpu(cpu, tracing_buffer_mask) |
bc0c38d13 ftrace: latency t... |
381 382 |
extern unsigned long nsecs_to_usecs(unsigned long nsecs); |
0e9501735 function-graph: A... |
383 |
extern unsigned long tracing_thresh; |
5d4a9dba2 tracing: only sho... |
384 |
#ifdef CONFIG_TRACER_MAX_TRACE |
bc0c38d13 ftrace: latency t... |
385 |
extern unsigned long tracing_max_latency; |
bc0c38d13 ftrace: latency t... |
386 387 388 389 |
void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); void update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu); |
5d4a9dba2 tracing: only sho... |
390 |
#endif /* CONFIG_TRACER_MAX_TRACE */ |
bc0c38d13 ftrace: latency t... |
391 |
|
c0a0d0d3f tracing/core: Mak... |
392 |
#ifdef CONFIG_STACKTRACE |
e77405ad8 tracing: pass aro... |
393 |
void ftrace_trace_stack(struct ring_buffer *buffer, unsigned long flags, |
c0a0d0d3f tracing/core: Mak... |
394 |
int skip, int pc); |
1fd8df2c3 tracing/kprobes: ... |
395 396 |
void ftrace_trace_stack_regs(struct ring_buffer *buffer, unsigned long flags, int skip, int pc, struct pt_regs *regs); |
e77405ad8 tracing: pass aro... |
397 |
void ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, |
c0a0d0d3f tracing/core: Mak... |
398 399 400 401 402 |
int pc); void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, int pc); #else |
e1f7992e0 tracing: Fix func... |
403 |
static inline void ftrace_trace_stack(struct ring_buffer *buffer, |
c0a0d0d3f tracing/core: Mak... |
404 405 406 |
unsigned long flags, int skip, int pc) { } |
1fd8df2c3 tracing/kprobes: ... |
407 408 409 410 411 |
static inline void ftrace_trace_stack_regs(struct ring_buffer *buffer, unsigned long flags, int skip, int pc, struct pt_regs *regs) { } |
e1f7992e0 tracing: Fix func... |
412 |
static inline void ftrace_trace_userstack(struct ring_buffer *buffer, |
c0a0d0d3f tracing/core: Mak... |
413 414 415 416 417 418 419 420 421 |
unsigned long flags, int pc) { } static inline void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, int pc) { } #endif /* CONFIG_STACKTRACE */ |
536149910 ftrace: add stack... |
422 |
|
e309b41dd ftrace: remove no... |
423 |
extern cycle_t ftrace_now(int cpu); |
bc0c38d13 ftrace: latency t... |
424 |
|
4ca530852 tracing: protect ... |
425 |
extern void trace_find_cmdline(int pid, char comm[]); |
f7d48cbde tracing/ftrace: m... |
426 |
|
bc0c38d13 ftrace: latency t... |
427 428 |
#ifdef CONFIG_DYNAMIC_FTRACE extern unsigned long ftrace_update_tot_cnt; |
d05cdb25d ftrace: fix dynam... |
429 430 |
#define DYN_FTRACE_TEST_NAME trace_selftest_dynamic_test_func extern int DYN_FTRACE_TEST_NAME(void); |
95950c2ec ftrace: Add self-... |
431 432 |
#define DYN_FTRACE_TEST_NAME2 trace_selftest_dynamic_test_func2 extern int DYN_FTRACE_TEST_NAME2(void); |
bc0c38d13 ftrace: latency t... |
433 |
#endif |
020e5f85c tracing/events: A... |
434 435 |
extern int ring_buffer_expanded; extern bool tracing_selftest_disabled; |
9288f99aa this_cpu: Use thi... |
436 |
DECLARE_PER_CPU(int, ftrace_cpu_disabled); |
020e5f85c tracing/events: A... |
437 |
|
60a11774b ftrace: add self-... |
438 |
#ifdef CONFIG_FTRACE_STARTUP_TEST |
60a11774b ftrace: add self-... |
439 440 |
extern int trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr); |
7447dce96 tracing/function-... |
441 442 |
extern int trace_selftest_startup_function_graph(struct tracer *trace, struct trace_array *tr); |
60a11774b ftrace: add self-... |
443 444 |
extern int trace_selftest_startup_irqsoff(struct tracer *trace, struct trace_array *tr); |
60a11774b ftrace: add self-... |
445 446 |
extern int trace_selftest_startup_preemptoff(struct tracer *trace, struct trace_array *tr); |
60a11774b ftrace: add self-... |
447 448 |
extern int trace_selftest_startup_preemptirqsoff(struct tracer *trace, struct trace_array *tr); |
60a11774b ftrace: add self-... |
449 450 |
extern int trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr); |
fb1b6d8b5 ftrace: add nop t... |
451 452 |
extern int trace_selftest_startup_nop(struct tracer *trace, struct trace_array *tr); |
60a11774b ftrace: add self-... |
453 454 |
extern int trace_selftest_startup_sched_switch(struct tracer *trace, struct trace_array *tr); |
80e5ea450 ftrace: add trace... |
455 456 |
extern int trace_selftest_startup_branch(struct tracer *trace, struct trace_array *tr); |
60a11774b ftrace: add self-... |
457 |
#endif /* CONFIG_FTRACE_STARTUP_TEST */ |
c7aafc549 ftrace: cleanups |
458 |
extern void *head_page(struct trace_array_cpu *data); |
cf8e34746 tracing: fix inco... |
459 |
extern unsigned long long ns2usecs(cycle_t nsec); |
1fd8f2a3f tracing/function-... |
460 |
extern int |
40ce74f19 tracing: remove r... |
461 |
trace_vbprintk(unsigned long ip, const char *fmt, va_list args); |
48ead0203 tracing/core: bri... |
462 |
extern int |
40ce74f19 tracing: remove r... |
463 |
trace_vprintk(unsigned long ip, const char *fmt, va_list args); |
659372d3e tracing: add trac... |
464 465 466 467 468 |
extern int trace_array_vprintk(struct trace_array *tr, unsigned long ip, const char *fmt, va_list args); int trace_array_printk(struct trace_array *tr, unsigned long ip, const char *fmt, ...); |
955b61e59 ftrace,kdb: Exten... |
469 470 |
void trace_printk_seq(struct trace_seq *s); enum print_line_t print_trace_line(struct trace_iterator *iter); |
c7aafc549 ftrace: cleanups |
471 |
|
4e6555190 ftrace: sched tra... |
472 |
extern unsigned long trace_flags; |
5079f3261 ftrace: Move sett... |
473 |
extern int trace_clock_id; |
15e6cb367 tracing: add a tr... |
474 |
/* Standard output formatting function used for function return traces */ |
fb52607af tracing/function-... |
475 |
#ifdef CONFIG_FUNCTION_GRAPH_TRACER |
62b915f10 tracing: Add grap... |
476 477 478 479 480 481 482 483 |
/* Flag options */ #define TRACE_GRAPH_PRINT_OVERRUN 0x1 #define TRACE_GRAPH_PRINT_CPU 0x2 #define TRACE_GRAPH_PRINT_OVERHEAD 0x4 #define TRACE_GRAPH_PRINT_PROC 0x8 #define TRACE_GRAPH_PRINT_DURATION 0x10 #define TRACE_GRAPH_PRINT_ABS_TIME 0x20 |
d7a8d9e90 tracing: Have gra... |
484 485 486 |
extern enum print_line_t print_graph_function_flags(struct trace_iterator *iter, u32 flags); extern void print_graph_headers_flags(struct seq_file *s, u32 flags); |
0706f1c48 tracing: adding f... |
487 488 |
extern enum print_line_t trace_print_graph_duration(unsigned long long duration, struct trace_seq *s); |
62b915f10 tracing: Add grap... |
489 490 491 492 493 494 495 496 |
extern void graph_trace_open(struct trace_iterator *iter); extern void graph_trace_close(struct trace_iterator *iter); extern int __trace_graph_entry(struct trace_array *tr, struct ftrace_graph_ent *trace, unsigned long flags, int pc); extern void __trace_graph_return(struct trace_array *tr, struct ftrace_graph_ret *trace, unsigned long flags, int pc); |
ea4e2bc4d ftrace: graph of ... |
497 498 499 500 |
#ifdef CONFIG_DYNAMIC_FTRACE /* TODO: make this variable */ #define FTRACE_GRAPH_MAX_FUNCS 32 |
c7c6b1fe9 ftrace: Allow to ... |
501 |
extern int ftrace_graph_filter_enabled; |
ea4e2bc4d ftrace: graph of ... |
502 503 504 505 506 507 |
extern int ftrace_graph_count; extern unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS]; static inline int ftrace_graph_addr(unsigned long addr) { int i; |
c7c6b1fe9 ftrace: Allow to ... |
508 |
if (!ftrace_graph_filter_enabled) |
ea4e2bc4d ftrace: graph of ... |
509 510 511 |
return 1; for (i = 0; i < ftrace_graph_count; i++) { |
e4a3f541f tracing: Still tr... |
512 513 514 515 516 517 518 519 520 521 |
if (addr == ftrace_graph_funcs[i]) { /* * If no irqs are to be traced, but a set_graph_function * is set, and called by an interrupt handler, we still * want to trace it. */ if (in_irq()) trace_recursion_set(TRACE_IRQ_BIT); else trace_recursion_clear(TRACE_IRQ_BIT); |
ea4e2bc4d ftrace: graph of ... |
522 |
return 1; |
e4a3f541f tracing: Still tr... |
523 |
} |
ea4e2bc4d ftrace: graph of ... |
524 525 526 527 |
} return 0; } |
15e6cb367 tracing: add a tr... |
528 |
#else |
6b2539302 tracing: fix typo... |
529 530 531 |
static inline int ftrace_graph_addr(unsigned long addr) { return 1; |
ea4e2bc4d ftrace: graph of ... |
532 533 |
} #endif /* CONFIG_DYNAMIC_FTRACE */ |
ea4e2bc4d ftrace: graph of ... |
534 |
#else /* CONFIG_FUNCTION_GRAPH_TRACER */ |
15e6cb367 tracing: add a tr... |
535 |
static inline enum print_line_t |
d7a8d9e90 tracing: Have gra... |
536 |
print_graph_function_flags(struct trace_iterator *iter, u32 flags) |
15e6cb367 tracing: add a tr... |
537 538 539 |
{ return TRACE_TYPE_UNHANDLED; } |
ea4e2bc4d ftrace: graph of ... |
540 |
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
15e6cb367 tracing: add a tr... |
541 |
|
756d17ee7 tracing: Support ... |
542 |
extern struct list_head ftrace_pids; |
804a68516 ftrace: trace sin... |
543 |
|
1155de47c ring-buffer: Make... |
544 |
#ifdef CONFIG_FUNCTION_TRACER |
804a68516 ftrace: trace sin... |
545 546 |
static inline int ftrace_trace_task(struct task_struct *task) { |
756d17ee7 tracing: Support ... |
547 |
if (list_empty(&ftrace_pids)) |
804a68516 ftrace: trace sin... |
548 549 550 551 |
return 1; return test_tsk_trace_trace(task); } |
e0a413f61 tracing: Warn on ... |
552 |
extern int ftrace_is_dead(void); |
1155de47c ring-buffer: Make... |
553 554 555 556 557 |
#else static inline int ftrace_trace_task(struct task_struct *task) { return 1; } |
e0a413f61 tracing: Warn on ... |
558 |
static inline int ftrace_is_dead(void) { return 0; } |
1155de47c ring-buffer: Make... |
559 |
#endif |
804a68516 ftrace: trace sin... |
560 |
|
4fcdae83c ftrace: comment code |
561 |
/* |
b63f39ea5 tracing: create g... |
562 563 564 |
* struct trace_parser - servers for reading the user input separated by spaces * @cont: set if the input is not complete - no final space char was found * @buffer: holds the parsed user input |
1537a3638 tree-wide: fix 'l... |
565 |
* @idx: user input length |
b63f39ea5 tracing: create g... |
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
* @size: buffer size */ struct trace_parser { bool cont; char *buffer; unsigned idx; unsigned size; }; static inline bool trace_parser_loaded(struct trace_parser *parser) { return (parser->idx != 0); } static inline bool trace_parser_cont(struct trace_parser *parser) { return parser->cont; } static inline void trace_parser_clear(struct trace_parser *parser) { parser->cont = false; parser->idx = 0; } extern int trace_parser_get_init(struct trace_parser *parser, int size); extern void trace_parser_put(struct trace_parser *parser); extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf, size_t cnt, loff_t *ppos); /* |
4fcdae83c ftrace: comment code |
597 598 599 600 601 602 |
* trace_iterator_flags is an enumeration that defines bit * positions into trace_flags that controls the output. * * NOTE: These bits must match the trace_options array in * trace.c. */ |
4e6555190 ftrace: sched tra... |
603 604 605 606 607 608 609 610 611 612 |
enum trace_iterator_flags { TRACE_ITER_PRINT_PARENT = 0x01, TRACE_ITER_SYM_OFFSET = 0x02, TRACE_ITER_SYM_ADDR = 0x04, TRACE_ITER_VERBOSE = 0x08, TRACE_ITER_RAW = 0x10, TRACE_ITER_HEX = 0x20, TRACE_ITER_BIN = 0x40, TRACE_ITER_BLOCK = 0x80, TRACE_ITER_STACKTRACE = 0x100, |
2cbafd68b tracing: Remove u... |
613 614 615 616 617 618 619 620 621 622 623 |
TRACE_ITER_PRINTK = 0x200, TRACE_ITER_PREEMPTONLY = 0x400, TRACE_ITER_BRANCH = 0x800, TRACE_ITER_ANNOTATE = 0x1000, TRACE_ITER_USERSTACKTRACE = 0x2000, TRACE_ITER_SYM_USEROBJ = 0x4000, TRACE_ITER_PRINTK_MSGONLY = 0x8000, TRACE_ITER_CONTEXT_INFO = 0x10000, /* Print pid/cpu/time */ TRACE_ITER_LATENCY_FMT = 0x20000, TRACE_ITER_SLEEP_TIME = 0x40000, TRACE_ITER_GRAPH_TIME = 0x80000, |
e870e9a12 tracing: Allow to... |
624 |
TRACE_ITER_RECORD_CMD = 0x100000, |
750912fa3 tracing: Add an '... |
625 |
TRACE_ITER_OVERWRITE = 0x200000, |
cf30cf67d tracing: Add disa... |
626 |
TRACE_ITER_STOP_ON_FREE = 0x400000, |
4e6555190 ftrace: sched tra... |
627 |
}; |
15e6cb367 tracing: add a tr... |
628 629 630 631 632 633 |
/* * TRACE_ITER_SYM_MASK masks the options in trace_flags that * control the output of kernel symbols. */ #define TRACE_ITER_SYM_MASK \ (TRACE_ITER_PRINT_PARENT|TRACE_ITER_SYM_OFFSET|TRACE_ITER_SYM_ADDR) |
43a15386c tracing/ftrace: r... |
634 |
extern struct tracer nop_trace; |
2ed84eeb8 trace: rename unl... |
635 |
#ifdef CONFIG_BRANCH_TRACER |
9f029e83e ftrace: rename un... |
636 637 638 |
extern int enable_branch_tracing(struct trace_array *tr); extern void disable_branch_tracing(void); static inline int trace_branch_enable(struct trace_array *tr) |
52f232cb7 tracing: likely/u... |
639 |
{ |
9f029e83e ftrace: rename un... |
640 641 |
if (trace_flags & TRACE_ITER_BRANCH) return enable_branch_tracing(tr); |
52f232cb7 tracing: likely/u... |
642 643 |
return 0; } |
9f029e83e ftrace: rename un... |
644 |
static inline void trace_branch_disable(void) |
52f232cb7 tracing: likely/u... |
645 646 |
{ /* due to races, always disable */ |
9f029e83e ftrace: rename un... |
647 |
disable_branch_tracing(); |
52f232cb7 tracing: likely/u... |
648 649 |
} #else |
9f029e83e ftrace: rename un... |
650 |
static inline int trace_branch_enable(struct trace_array *tr) |
52f232cb7 tracing: likely/u... |
651 652 653 |
{ return 0; } |
9f029e83e ftrace: rename un... |
654 |
static inline void trace_branch_disable(void) |
52f232cb7 tracing: likely/u... |
655 656 |
{ } |
2ed84eeb8 trace: rename unl... |
657 |
#endif /* CONFIG_BRANCH_TRACER */ |
52f232cb7 tracing: likely/u... |
658 |
|
1852fcce1 tracing: expand t... |
659 660 |
/* set ring buffers to default size if not already done so */ int tracing_update_buffers(void); |
fd9949898 tracing: add raw ... |
661 662 663 664 665 |
/* trace event type bit fields, not numeric */ enum { TRACE_EVENT_TYPE_PRINTF = 1, TRACE_EVENT_TYPE_RAW = 2, }; |
cf027f645 tracing: add run-... |
666 667 668 669 |
struct ftrace_event_field { struct list_head link; char *name; char *type; |
aa38e9fc3 tracing/filters: ... |
670 |
int filter_type; |
cf027f645 tracing: add run-... |
671 672 |
int offset; int size; |
a118e4d14 tracing/filters: ... |
673 |
int is_signed; |
cf027f645 tracing: add run-... |
674 |
}; |
30e673b23 tracing/filters: ... |
675 |
struct event_filter { |
c9c53ca03 tracing/filter: D... |
676 677 |
int n_preds; /* Number assigned */ int a_preds; /* allocated */ |
74e9e58c3 tracing/filter: A... |
678 |
struct filter_pred *preds; |
61e9dea20 tracing/filter: U... |
679 |
struct filter_pred *root; |
8b3725621 tracing/filters: ... |
680 |
char *filter_string; |
30e673b23 tracing/filters: ... |
681 |
}; |
cfb180f3e tracing: add per-... |
682 683 684 685 |
struct event_subsystem { struct list_head list; const char *name; struct dentry *entry; |
1f9963cbb tracing/filters: ... |
686 |
struct event_filter *filter; |
dc82ec98a tracing/filter: R... |
687 |
int nr_events; |
e9dbfae53 tracing: Fix bug ... |
688 |
int ref_count; |
cfb180f3e tracing: add per-... |
689 |
}; |
61e9dea20 tracing/filter: U... |
690 691 |
#define FILTER_PRED_INVALID ((unsigned short)-1) #define FILTER_PRED_IS_RIGHT (1 << 15) |
43cd41455 tracing/filter: O... |
692 |
#define FILTER_PRED_FOLD (1 << 15) |
61e9dea20 tracing/filter: U... |
693 |
|
bf93f9ed3 tracing/filter: I... |
694 695 696 697 698 699 700 701 |
/* * The max preds is the size of unsigned short with * two flags at the MSBs. One bit is used for both the IS_RIGHT * and FOLD flags. The other is reserved. * * 2^14 preds is way more than enough. */ #define MAX_FILTER_PRED 16384 |
4a3d27e98 tracing/filter: M... |
702 |
|
7ce7e4249 tracing: add per-... |
703 |
struct filter_pred; |
1889d2092 tracing/filters: ... |
704 |
struct regex; |
7ce7e4249 tracing: add per-... |
705 |
|
58d9a597c tracing/filter: M... |
706 |
typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event); |
7ce7e4249 tracing: add per-... |
707 |
|
1889d2092 tracing/filters: ... |
708 |
typedef int (*regex_match_func)(char *str, struct regex *r, int len); |
3f6fe06db tracing/filters: ... |
709 |
enum regex_type { |
b0f1a59a9 tracing/filters: ... |
710 |
MATCH_FULL = 0, |
3f6fe06db tracing/filters: ... |
711 712 713 714 |
MATCH_FRONT_ONLY, MATCH_MIDDLE_ONLY, MATCH_END_ONLY, }; |
1889d2092 tracing/filters: ... |
715 716 717 718 719 720 |
struct regex { char pattern[MAX_FILTER_STR_VAL]; int len; int field_len; regex_match_func match; }; |
7ce7e4249 tracing: add per-... |
721 |
struct filter_pred { |
1889d2092 tracing/filters: ... |
722 723 724 |
filter_pred_fn_t fn; u64 val; struct regex regex; |
61aaef553 tracing/filter: R... |
725 |
unsigned short *ops; |
1d0e78e38 tracing/filter: A... |
726 727 728 |
#ifdef CONFIG_FTRACE_STARTUP_TEST struct ftrace_event_field *field; #endif |
1889d2092 tracing/filters: ... |
729 730 731 |
int offset; int not; int op; |
61e9dea20 tracing/filter: U... |
732 733 734 735 |
unsigned short index; unsigned short parent; unsigned short left; unsigned short right; |
7ce7e4249 tracing: add per-... |
736 |
}; |
8728fe501 tracing: Don't al... |
737 |
extern struct list_head ftrace_common_fields; |
3f6fe06db tracing/filters: ... |
738 739 |
extern enum regex_type filter_parse_regex(char *buff, int len, char **search, int *not); |
8b3725621 tracing/filters: ... |
740 |
extern void print_event_filter(struct ftrace_event_call *call, |
4bda2d517 tracing/filters: ... |
741 |
struct trace_seq *s); |
8b3725621 tracing/filters: ... |
742 743 744 745 746 |
extern int apply_event_filter(struct ftrace_event_call *call, char *filter_string); extern int apply_subsystem_event_filter(struct event_subsystem *system, char *filter_string); extern void print_subsystem_event_filter(struct event_subsystem *system, |
ac1adc55f tracing/filters: ... |
747 |
struct trace_seq *s); |
aa38e9fc3 tracing/filters: ... |
748 |
extern int filter_assign_type(const char *type); |
7ce7e4249 tracing: add per-... |
749 |
|
2e33af029 tracing: Move fie... |
750 751 |
struct list_head * trace_get_fields(struct ftrace_event_call *event_call); |
eb02ce017 tracing/filters: ... |
752 |
static inline int |
e1112b4d9 tracing/filters: ... |
753 |
filter_check_discard(struct ftrace_event_call *call, void *rec, |
eb02ce017 tracing/filters: ... |
754 |
struct ring_buffer *buffer, |
e1112b4d9 tracing/filters: ... |
755 756 |
struct ring_buffer_event *event) { |
553552ce1 tracing: Combine ... |
757 |
if (unlikely(call->flags & TRACE_EVENT_FL_FILTERED) && |
6fb2915df tracing/profile: ... |
758 |
!filter_match_preds(call->filter, rec)) { |
eb02ce017 tracing/filters: ... |
759 760 761 762 763 |
ring_buffer_discard_commit(buffer, event); return 1; } return 0; |
e1112b4d9 tracing/filters: ... |
764 |
} |
e870e9a12 tracing: Allow to... |
765 |
extern void trace_event_enable_cmd_record(bool enable); |
20c8928ab tracing/events: f... |
766 |
extern struct mutex event_mutex; |
a59fd6027 tracing/events: c... |
767 |
extern struct list_head ftrace_events; |
ac199db01 ftrace: event pro... |
768 |
|
e9fb2b6d5 tracing: have eve... |
769 770 |
extern const char *__start___trace_bprintk_fmt[]; extern const char *__stop___trace_bprintk_fmt[]; |
4e5292ea1 tracing: use the ... |
771 772 |
#undef FTRACE_ENTRY #define FTRACE_ENTRY(call, struct_name, id, tstruct, print) \ |
86c38a31a tracing: Fix ftra... |
773 774 |
extern struct ftrace_event_call \ __attribute__((__aligned__(4))) event_##call; |
4e5292ea1 tracing: use the ... |
775 776 777 778 |
#undef FTRACE_ENTRY_DUP #define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print) \ FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print)) #include "trace_entries.h" |
e1112b4d9 tracing/filters: ... |
779 |
|
bc0c38d13 ftrace: latency t... |
780 |
#endif /* _LINUX_KERNEL_TRACE_H */ |