tracing: show details of structures within the ftrace structures
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / kernel / trace / trace.h
blobb0d287d49a6df1f5ab4cb18b88e228e95c250767
1 #ifndef _LINUX_KERNEL_TRACE_H
2 #define _LINUX_KERNEL_TRACE_H
4 #include <linux/fs.h>
5 #include <asm/atomic.h>
6 #include <linux/sched.h>
7 #include <linux/clocksource.h>
8 #include <linux/ring_buffer.h>
9 #include <linux/mmiotrace.h>
10 #include <linux/ftrace.h>
11 #include <trace/boot.h>
12 #include <linux/kmemtrace.h>
13 #include <trace/power.h>
15 #include <linux/trace_seq.h>
16 #include <linux/ftrace_event.h>
18 enum trace_type {
19 __TRACE_FIRST_TYPE = 0,
21 TRACE_FN,
22 TRACE_CTX,
23 TRACE_WAKE,
24 TRACE_STACK,
25 TRACE_PRINT,
26 TRACE_BPRINT,
27 TRACE_SPECIAL,
28 TRACE_MMIO_RW,
29 TRACE_MMIO_MAP,
30 TRACE_BRANCH,
31 TRACE_BOOT_CALL,
32 TRACE_BOOT_RET,
33 TRACE_GRAPH_RET,
34 TRACE_GRAPH_ENT,
35 TRACE_USER_STACK,
36 TRACE_HW_BRANCHES,
37 TRACE_KMEM_ALLOC,
38 TRACE_KMEM_FREE,
39 TRACE_POWER,
40 TRACE_BLK,
42 __TRACE_LAST_TYPE,
45 enum kmemtrace_type_id {
46 KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */
47 KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */
48 KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */
51 extern struct tracer boot_tracer;
53 #undef __field
54 #define __field(type, item) type item;
56 #undef __field_struct
57 #define __field_struct(type, item) __field(type, item)
59 #undef __field_desc
60 #define __field_desc(type, container, item)
62 #undef __array
63 #define __array(type, item, size) type item[size];
65 #undef __array_desc
66 #define __array_desc(type, container, item, size)
68 #undef __dynamic_array
69 #define __dynamic_array(type, item) type item[];
71 #undef F_STRUCT
72 #define F_STRUCT(args...) args
74 #undef FTRACE_ENTRY
75 #define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \
76 struct struct_name { \
77 struct trace_entry ent; \
78 tstruct \
81 #undef TP_ARGS
82 #define TP_ARGS(args...) args
84 #undef FTRACE_ENTRY_DUP
85 #define FTRACE_ENTRY_DUP(name, name_struct, id, tstruct, printk)
87 #include "trace_entries.h"
90 * syscalls are special, and need special handling, this is why
91 * they are not included in trace_entries.h
93 struct syscall_trace_enter {
94 struct trace_entry ent;
95 int nr;
96 unsigned long args[];
99 struct syscall_trace_exit {
100 struct trace_entry ent;
101 int nr;
102 unsigned long ret;
106 * trace_flag_type is an enumeration that holds different
107 * states when a trace occurs. These are:
108 * IRQS_OFF - interrupts were disabled
109 * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags
110 * NEED_RESCHED - reschedule is requested
111 * HARDIRQ - inside an interrupt handler
112 * SOFTIRQ - inside a softirq handler
114 enum trace_flag_type {
115 TRACE_FLAG_IRQS_OFF = 0x01,
116 TRACE_FLAG_IRQS_NOSUPPORT = 0x02,
117 TRACE_FLAG_NEED_RESCHED = 0x04,
118 TRACE_FLAG_HARDIRQ = 0x08,
119 TRACE_FLAG_SOFTIRQ = 0x10,
122 #define TRACE_BUF_SIZE 1024
125 * The CPU trace array - it consists of thousands of trace entries
126 * plus some other descriptor data: (for example which task started
127 * the trace, etc.)
129 struct trace_array_cpu {
130 atomic_t disabled;
131 void *buffer_page; /* ring buffer spare */
133 unsigned long saved_latency;
134 unsigned long critical_start;
135 unsigned long critical_end;
136 unsigned long critical_sequence;
137 unsigned long nice;
138 unsigned long policy;
139 unsigned long rt_priority;
140 unsigned long skipped_entries;
141 cycle_t preempt_timestamp;
142 pid_t pid;
143 uid_t uid;
144 char comm[TASK_COMM_LEN];
148 * The trace array - an array of per-CPU trace arrays. This is the
149 * highest level data structure that individual tracers deal with.
150 * They have on/off state as well:
152 struct trace_array {
153 struct ring_buffer *buffer;
154 unsigned long entries;
155 int cpu;
156 cycle_t time_start;
157 struct task_struct *waiter;
158 struct trace_array_cpu *data[NR_CPUS];
161 #define FTRACE_CMP_TYPE(var, type) \
162 __builtin_types_compatible_p(typeof(var), type *)
164 #undef IF_ASSIGN
165 #define IF_ASSIGN(var, entry, etype, id) \
166 if (FTRACE_CMP_TYPE(var, etype)) { \
167 var = (typeof(var))(entry); \
168 WARN_ON(id && (entry)->type != id); \
169 break; \
172 /* Will cause compile errors if type is not found. */
173 extern void __ftrace_bad_type(void);
176 * The trace_assign_type is a verifier that the entry type is
177 * the same as the type being assigned. To add new types simply
178 * add a line with the following format:
180 * IF_ASSIGN(var, ent, type, id);
182 * Where "type" is the trace type that includes the trace_entry
183 * as the "ent" item. And "id" is the trace identifier that is
184 * used in the trace_type enum.
186 * If the type can have more than one id, then use zero.
188 #define trace_assign_type(var, ent) \
189 do { \
190 IF_ASSIGN(var, ent, struct ftrace_entry, TRACE_FN); \
191 IF_ASSIGN(var, ent, struct ctx_switch_entry, 0); \
192 IF_ASSIGN(var, ent, struct stack_entry, TRACE_STACK); \
193 IF_ASSIGN(var, ent, struct userstack_entry, TRACE_USER_STACK);\
194 IF_ASSIGN(var, ent, struct print_entry, TRACE_PRINT); \
195 IF_ASSIGN(var, ent, struct bprint_entry, TRACE_BPRINT); \
196 IF_ASSIGN(var, ent, struct special_entry, 0); \
197 IF_ASSIGN(var, ent, struct trace_mmiotrace_rw, \
198 TRACE_MMIO_RW); \
199 IF_ASSIGN(var, ent, struct trace_mmiotrace_map, \
200 TRACE_MMIO_MAP); \
201 IF_ASSIGN(var, ent, struct trace_boot_call, TRACE_BOOT_CALL);\
202 IF_ASSIGN(var, ent, struct trace_boot_ret, TRACE_BOOT_RET);\
203 IF_ASSIGN(var, ent, struct trace_branch, TRACE_BRANCH); \
204 IF_ASSIGN(var, ent, struct ftrace_graph_ent_entry, \
205 TRACE_GRAPH_ENT); \
206 IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry, \
207 TRACE_GRAPH_RET); \
208 IF_ASSIGN(var, ent, struct hw_branch_entry, TRACE_HW_BRANCHES);\
209 IF_ASSIGN(var, ent, struct trace_power, TRACE_POWER); \
210 IF_ASSIGN(var, ent, struct kmemtrace_alloc_entry, \
211 TRACE_KMEM_ALLOC); \
212 IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \
213 TRACE_KMEM_FREE); \
214 __ftrace_bad_type(); \
215 } while (0)
218 * An option specific to a tracer. This is a boolean value.
219 * The bit is the bit index that sets its value on the
220 * flags value in struct tracer_flags.
222 struct tracer_opt {
223 const char *name; /* Will appear on the trace_options file */
224 u32 bit; /* Mask assigned in val field in tracer_flags */
228 * The set of specific options for a tracer. Your tracer
229 * have to set the initial value of the flags val.
231 struct tracer_flags {
232 u32 val;
233 struct tracer_opt *opts;
236 /* Makes more easy to define a tracer opt */
237 #define TRACER_OPT(s, b) .name = #s, .bit = b
241 * struct tracer - a specific tracer and its callbacks to interact with debugfs
242 * @name: the name chosen to select it on the available_tracers file
243 * @init: called when one switches to this tracer (echo name > current_tracer)
244 * @reset: called when one switches to another tracer
245 * @start: called when tracing is unpaused (echo 1 > tracing_enabled)
246 * @stop: called when tracing is paused (echo 0 > tracing_enabled)
247 * @open: called when the trace file is opened
248 * @pipe_open: called when the trace_pipe file is opened
249 * @wait_pipe: override how the user waits for traces on trace_pipe
250 * @close: called when the trace file is released
251 * @read: override the default read callback on trace_pipe
252 * @splice_read: override the default splice_read callback on trace_pipe
253 * @selftest: selftest to run on boot (see trace_selftest.c)
254 * @print_headers: override the first lines that describe your columns
255 * @print_line: callback that prints a trace
256 * @set_flag: signals one of your private flags changed (trace_options file)
257 * @flags: your private flags
259 struct tracer {
260 const char *name;
261 int (*init)(struct trace_array *tr);
262 void (*reset)(struct trace_array *tr);
263 void (*start)(struct trace_array *tr);
264 void (*stop)(struct trace_array *tr);
265 void (*open)(struct trace_iterator *iter);
266 void (*pipe_open)(struct trace_iterator *iter);
267 void (*wait_pipe)(struct trace_iterator *iter);
268 void (*close)(struct trace_iterator *iter);
269 ssize_t (*read)(struct trace_iterator *iter,
270 struct file *filp, char __user *ubuf,
271 size_t cnt, loff_t *ppos);
272 ssize_t (*splice_read)(struct trace_iterator *iter,
273 struct file *filp,
274 loff_t *ppos,
275 struct pipe_inode_info *pipe,
276 size_t len,
277 unsigned int flags);
278 #ifdef CONFIG_FTRACE_STARTUP_TEST
279 int (*selftest)(struct tracer *trace,
280 struct trace_array *tr);
281 #endif
282 void (*print_header)(struct seq_file *m);
283 enum print_line_t (*print_line)(struct trace_iterator *iter);
284 /* If you handled the flag setting, return 0 */
285 int (*set_flag)(u32 old_flags, u32 bit, int set);
286 struct tracer *next;
287 int print_max;
288 struct tracer_flags *flags;
292 #define TRACE_PIPE_ALL_CPU -1
294 int tracer_init(struct tracer *t, struct trace_array *tr);
295 int tracing_is_enabled(void);
296 void trace_wake_up(void);
297 void tracing_reset(struct trace_array *tr, int cpu);
298 void tracing_reset_online_cpus(struct trace_array *tr);
299 void tracing_reset_current(int cpu);
300 void tracing_reset_current_online_cpus(void);
301 int tracing_open_generic(struct inode *inode, struct file *filp);
302 struct dentry *trace_create_file(const char *name,
303 mode_t mode,
304 struct dentry *parent,
305 void *data,
306 const struct file_operations *fops);
308 struct dentry *tracing_init_dentry(void);
309 void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
311 struct ring_buffer_event;
313 struct ring_buffer_event *
314 trace_buffer_lock_reserve(struct ring_buffer *buffer,
315 int type,
316 unsigned long len,
317 unsigned long flags,
318 int pc);
319 void trace_buffer_unlock_commit(struct ring_buffer *buffer,
320 struct ring_buffer_event *event,
321 unsigned long flags, int pc);
323 struct trace_entry *tracing_get_trace_entry(struct trace_array *tr,
324 struct trace_array_cpu *data);
326 struct trace_entry *trace_find_next_entry(struct trace_iterator *iter,
327 int *ent_cpu, u64 *ent_ts);
329 void default_wait_pipe(struct trace_iterator *iter);
330 void poll_wait_pipe(struct trace_iterator *iter);
332 void ftrace(struct trace_array *tr,
333 struct trace_array_cpu *data,
334 unsigned long ip,
335 unsigned long parent_ip,
336 unsigned long flags, int pc);
337 void tracing_sched_switch_trace(struct trace_array *tr,
338 struct task_struct *prev,
339 struct task_struct *next,
340 unsigned long flags, int pc);
342 void tracing_sched_wakeup_trace(struct trace_array *tr,
343 struct task_struct *wakee,
344 struct task_struct *cur,
345 unsigned long flags, int pc);
346 void trace_special(struct trace_array *tr,
347 struct trace_array_cpu *data,
348 unsigned long arg1,
349 unsigned long arg2,
350 unsigned long arg3, int pc);
351 void trace_function(struct trace_array *tr,
352 unsigned long ip,
353 unsigned long parent_ip,
354 unsigned long flags, int pc);
356 void trace_graph_return(struct ftrace_graph_ret *trace);
357 int trace_graph_entry(struct ftrace_graph_ent *trace);
358 void set_graph_array(struct trace_array *tr);
360 void tracing_start_cmdline_record(void);
361 void tracing_stop_cmdline_record(void);
362 void tracing_sched_switch_assign_trace(struct trace_array *tr);
363 void tracing_stop_sched_switch_record(void);
364 void tracing_start_sched_switch_record(void);
365 int register_tracer(struct tracer *type);
366 void unregister_tracer(struct tracer *type);
367 int is_tracing_stopped(void);
369 extern unsigned long nsecs_to_usecs(unsigned long nsecs);
371 #ifdef CONFIG_TRACER_MAX_TRACE
372 extern unsigned long tracing_max_latency;
373 extern unsigned long tracing_thresh;
375 void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu);
376 void update_max_tr_single(struct trace_array *tr,
377 struct task_struct *tsk, int cpu);
378 #endif /* CONFIG_TRACER_MAX_TRACE */
380 #ifdef CONFIG_STACKTRACE
381 void ftrace_trace_stack(struct ring_buffer *buffer, unsigned long flags,
382 int skip, int pc);
384 void ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags,
385 int pc);
387 void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
388 int pc);
389 #else
390 static inline void ftrace_trace_stack(struct trace_array *tr,
391 unsigned long flags, int skip, int pc)
395 static inline void ftrace_trace_userstack(struct trace_array *tr,
396 unsigned long flags, int pc)
400 static inline void __trace_stack(struct trace_array *tr, unsigned long flags,
401 int skip, int pc)
404 #endif /* CONFIG_STACKTRACE */
406 extern cycle_t ftrace_now(int cpu);
408 extern void trace_find_cmdline(int pid, char comm[]);
410 #ifdef CONFIG_DYNAMIC_FTRACE
411 extern unsigned long ftrace_update_tot_cnt;
412 #define DYN_FTRACE_TEST_NAME trace_selftest_dynamic_test_func
413 extern int DYN_FTRACE_TEST_NAME(void);
414 #endif
416 extern int ring_buffer_expanded;
417 extern bool tracing_selftest_disabled;
418 DECLARE_PER_CPU(local_t, ftrace_cpu_disabled);
420 #ifdef CONFIG_FTRACE_STARTUP_TEST
421 extern int trace_selftest_startup_function(struct tracer *trace,
422 struct trace_array *tr);
423 extern int trace_selftest_startup_function_graph(struct tracer *trace,
424 struct trace_array *tr);
425 extern int trace_selftest_startup_irqsoff(struct tracer *trace,
426 struct trace_array *tr);
427 extern int trace_selftest_startup_preemptoff(struct tracer *trace,
428 struct trace_array *tr);
429 extern int trace_selftest_startup_preemptirqsoff(struct tracer *trace,
430 struct trace_array *tr);
431 extern int trace_selftest_startup_wakeup(struct tracer *trace,
432 struct trace_array *tr);
433 extern int trace_selftest_startup_nop(struct tracer *trace,
434 struct trace_array *tr);
435 extern int trace_selftest_startup_sched_switch(struct tracer *trace,
436 struct trace_array *tr);
437 extern int trace_selftest_startup_sysprof(struct tracer *trace,
438 struct trace_array *tr);
439 extern int trace_selftest_startup_branch(struct tracer *trace,
440 struct trace_array *tr);
441 extern int trace_selftest_startup_hw_branches(struct tracer *trace,
442 struct trace_array *tr);
443 #endif /* CONFIG_FTRACE_STARTUP_TEST */
445 extern void *head_page(struct trace_array_cpu *data);
446 extern unsigned long long ns2usecs(cycle_t nsec);
447 extern int
448 trace_vbprintk(unsigned long ip, const char *fmt, va_list args);
449 extern int
450 trace_vprintk(unsigned long ip, const char *fmt, va_list args);
451 extern int
452 trace_array_vprintk(struct trace_array *tr,
453 unsigned long ip, const char *fmt, va_list args);
454 int trace_array_printk(struct trace_array *tr,
455 unsigned long ip, const char *fmt, ...);
457 extern unsigned long trace_flags;
459 extern int trace_clock_id;
461 /* Standard output formatting function used for function return traces */
462 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
463 extern enum print_line_t print_graph_function(struct trace_iterator *iter);
464 extern enum print_line_t
465 trace_print_graph_duration(unsigned long long duration, struct trace_seq *s);
467 #ifdef CONFIG_DYNAMIC_FTRACE
468 /* TODO: make this variable */
469 #define FTRACE_GRAPH_MAX_FUNCS 32
470 extern int ftrace_graph_count;
471 extern unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS];
473 static inline int ftrace_graph_addr(unsigned long addr)
475 int i;
477 if (!ftrace_graph_count || test_tsk_trace_graph(current))
478 return 1;
480 for (i = 0; i < ftrace_graph_count; i++) {
481 if (addr == ftrace_graph_funcs[i])
482 return 1;
485 return 0;
487 #else
488 static inline int ftrace_trace_addr(unsigned long addr)
490 return 1;
492 static inline int ftrace_graph_addr(unsigned long addr)
494 return 1;
496 #endif /* CONFIG_DYNAMIC_FTRACE */
497 #else /* CONFIG_FUNCTION_GRAPH_TRACER */
498 static inline enum print_line_t
499 print_graph_function(struct trace_iterator *iter)
501 return TRACE_TYPE_UNHANDLED;
503 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
505 extern struct pid *ftrace_pid_trace;
507 #ifdef CONFIG_FUNCTION_TRACER
508 static inline int ftrace_trace_task(struct task_struct *task)
510 if (!ftrace_pid_trace)
511 return 1;
513 return test_tsk_trace_trace(task);
515 #else
516 static inline int ftrace_trace_task(struct task_struct *task)
518 return 1;
520 #endif
523 * struct trace_parser - servers for reading the user input separated by spaces
524 * @cont: set if the input is not complete - no final space char was found
525 * @buffer: holds the parsed user input
526 * @idx: user input lenght
527 * @size: buffer size
529 struct trace_parser {
530 bool cont;
531 char *buffer;
532 unsigned idx;
533 unsigned size;
536 static inline bool trace_parser_loaded(struct trace_parser *parser)
538 return (parser->idx != 0);
541 static inline bool trace_parser_cont(struct trace_parser *parser)
543 return parser->cont;
546 static inline void trace_parser_clear(struct trace_parser *parser)
548 parser->cont = false;
549 parser->idx = 0;
552 extern int trace_parser_get_init(struct trace_parser *parser, int size);
553 extern void trace_parser_put(struct trace_parser *parser);
554 extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
555 size_t cnt, loff_t *ppos);
558 * trace_iterator_flags is an enumeration that defines bit
559 * positions into trace_flags that controls the output.
561 * NOTE: These bits must match the trace_options array in
562 * trace.c.
564 enum trace_iterator_flags {
565 TRACE_ITER_PRINT_PARENT = 0x01,
566 TRACE_ITER_SYM_OFFSET = 0x02,
567 TRACE_ITER_SYM_ADDR = 0x04,
568 TRACE_ITER_VERBOSE = 0x08,
569 TRACE_ITER_RAW = 0x10,
570 TRACE_ITER_HEX = 0x20,
571 TRACE_ITER_BIN = 0x40,
572 TRACE_ITER_BLOCK = 0x80,
573 TRACE_ITER_STACKTRACE = 0x100,
574 TRACE_ITER_SCHED_TREE = 0x200,
575 TRACE_ITER_PRINTK = 0x400,
576 TRACE_ITER_PREEMPTONLY = 0x800,
577 TRACE_ITER_BRANCH = 0x1000,
578 TRACE_ITER_ANNOTATE = 0x2000,
579 TRACE_ITER_USERSTACKTRACE = 0x4000,
580 TRACE_ITER_SYM_USEROBJ = 0x8000,
581 TRACE_ITER_PRINTK_MSGONLY = 0x10000,
582 TRACE_ITER_CONTEXT_INFO = 0x20000, /* Print pid/cpu/time */
583 TRACE_ITER_LATENCY_FMT = 0x40000,
584 TRACE_ITER_SLEEP_TIME = 0x80000,
585 TRACE_ITER_GRAPH_TIME = 0x100000,
589 * TRACE_ITER_SYM_MASK masks the options in trace_flags that
590 * control the output of kernel symbols.
592 #define TRACE_ITER_SYM_MASK \
593 (TRACE_ITER_PRINT_PARENT|TRACE_ITER_SYM_OFFSET|TRACE_ITER_SYM_ADDR)
595 extern struct tracer nop_trace;
598 * ftrace_preempt_disable - disable preemption scheduler safe
600 * When tracing can happen inside the scheduler, there exists
601 * cases that the tracing might happen before the need_resched
602 * flag is checked. If this happens and the tracer calls
603 * preempt_enable (after a disable), a schedule might take place
604 * causing an infinite recursion.
606 * To prevent this, we read the need_resched flag before
607 * disabling preemption. When we want to enable preemption we
608 * check the flag, if it is set, then we call preempt_enable_no_resched.
609 * Otherwise, we call preempt_enable.
611 * The rational for doing the above is that if need_resched is set
612 * and we have yet to reschedule, we are either in an atomic location
613 * (where we do not need to check for scheduling) or we are inside
614 * the scheduler and do not want to resched.
616 static inline int ftrace_preempt_disable(void)
618 int resched;
620 resched = need_resched();
621 preempt_disable_notrace();
623 return resched;
627 * ftrace_preempt_enable - enable preemption scheduler safe
628 * @resched: the return value from ftrace_preempt_disable
630 * This is a scheduler safe way to enable preemption and not miss
631 * any preemption checks. The disabled saved the state of preemption.
632 * If resched is set, then we are either inside an atomic or
633 * are inside the scheduler (we would have already scheduled
634 * otherwise). In this case, we do not want to call normal
635 * preempt_enable, but preempt_enable_no_resched instead.
637 static inline void ftrace_preempt_enable(int resched)
639 if (resched)
640 preempt_enable_no_resched_notrace();
641 else
642 preempt_enable_notrace();
645 #ifdef CONFIG_BRANCH_TRACER
646 extern int enable_branch_tracing(struct trace_array *tr);
647 extern void disable_branch_tracing(void);
648 static inline int trace_branch_enable(struct trace_array *tr)
650 if (trace_flags & TRACE_ITER_BRANCH)
651 return enable_branch_tracing(tr);
652 return 0;
654 static inline void trace_branch_disable(void)
656 /* due to races, always disable */
657 disable_branch_tracing();
659 #else
660 static inline int trace_branch_enable(struct trace_array *tr)
662 return 0;
664 static inline void trace_branch_disable(void)
667 #endif /* CONFIG_BRANCH_TRACER */
669 /* set ring buffers to default size if not already done so */
670 int tracing_update_buffers(void);
672 /* trace event type bit fields, not numeric */
673 enum {
674 TRACE_EVENT_TYPE_PRINTF = 1,
675 TRACE_EVENT_TYPE_RAW = 2,
678 struct ftrace_event_field {
679 struct list_head link;
680 char *name;
681 char *type;
682 int filter_type;
683 int offset;
684 int size;
685 int is_signed;
688 struct event_filter {
689 int n_preds;
690 struct filter_pred **preds;
691 char *filter_string;
692 bool no_reset;
695 struct event_subsystem {
696 struct list_head list;
697 const char *name;
698 struct dentry *entry;
699 struct event_filter *filter;
700 int nr_events;
703 struct filter_pred;
705 typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event,
706 int val1, int val2);
708 struct filter_pred {
709 filter_pred_fn_t fn;
710 u64 val;
711 char str_val[MAX_FILTER_STR_VAL];
712 int str_len;
713 char *field_name;
714 int offset;
715 int not;
716 int op;
717 int pop_n;
720 extern void print_event_filter(struct ftrace_event_call *call,
721 struct trace_seq *s);
722 extern int apply_event_filter(struct ftrace_event_call *call,
723 char *filter_string);
724 extern int apply_subsystem_event_filter(struct event_subsystem *system,
725 char *filter_string);
726 extern void print_subsystem_event_filter(struct event_subsystem *system,
727 struct trace_seq *s);
728 extern int filter_assign_type(const char *type);
730 static inline int
731 filter_check_discard(struct ftrace_event_call *call, void *rec,
732 struct ring_buffer *buffer,
733 struct ring_buffer_event *event)
735 if (unlikely(call->filter_active) && !filter_match_preds(call, rec)) {
736 ring_buffer_discard_commit(buffer, event);
737 return 1;
740 return 0;
743 extern struct mutex event_mutex;
744 extern struct list_head ftrace_events;
746 extern const char *__start___trace_bprintk_fmt[];
747 extern const char *__stop___trace_bprintk_fmt[];
749 #undef TRACE_EVENT_FORMAT
750 #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \
751 extern struct ftrace_event_call event_##call;
752 #undef TRACE_EVENT_FORMAT_NOFILTER
753 #define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, tpfmt)
754 #include "trace_event_types.h"
756 #endif /* _LINUX_KERNEL_TRACE_H */