diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-09-22 19:49:27 -0400 |
---|---|---|
committer | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-09-22 19:49:27 -0400 |
commit | f056878332a91ed984a116bad4e7d49aefff9e6e (patch) | |
tree | 572f4757c8e7811d45e0be0c2ae529c78fb63441 /kernel/trace/trace.h | |
parent | 3961f7c3cf247eee5df7fabadc7a40f2deeb98f3 (diff) | |
parent | 7fa07729e439a6184bd824746d06a49cca553f15 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
drivers/power/wm97xx_battery.c
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r-- | kernel/trace/trace.h | 359 |
1 files changed, 131 insertions, 228 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 3548ae5cc780..405cb850b75d 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -7,10 +7,10 @@ | |||
7 | #include <linux/clocksource.h> | 7 | #include <linux/clocksource.h> |
8 | #include <linux/ring_buffer.h> | 8 | #include <linux/ring_buffer.h> |
9 | #include <linux/mmiotrace.h> | 9 | #include <linux/mmiotrace.h> |
10 | #include <linux/tracepoint.h> | ||
10 | #include <linux/ftrace.h> | 11 | #include <linux/ftrace.h> |
11 | #include <trace/boot.h> | 12 | #include <trace/boot.h> |
12 | #include <linux/kmemtrace.h> | 13 | #include <linux/kmemtrace.h> |
13 | #include <trace/power.h> | ||
14 | 14 | ||
15 | #include <linux/trace_seq.h> | 15 | #include <linux/trace_seq.h> |
16 | #include <linux/ftrace_event.h> | 16 | #include <linux/ftrace_event.h> |
@@ -34,167 +34,61 @@ enum trace_type { | |||
34 | TRACE_GRAPH_ENT, | 34 | TRACE_GRAPH_ENT, |
35 | TRACE_USER_STACK, | 35 | TRACE_USER_STACK, |
36 | TRACE_HW_BRANCHES, | 36 | TRACE_HW_BRANCHES, |
37 | TRACE_SYSCALL_ENTER, | ||
38 | TRACE_SYSCALL_EXIT, | ||
39 | TRACE_KMEM_ALLOC, | 37 | TRACE_KMEM_ALLOC, |
40 | TRACE_KMEM_FREE, | 38 | TRACE_KMEM_FREE, |
41 | TRACE_POWER, | ||
42 | TRACE_BLK, | 39 | TRACE_BLK, |
43 | 40 | ||
44 | __TRACE_LAST_TYPE, | 41 | __TRACE_LAST_TYPE, |
45 | }; | 42 | }; |
46 | 43 | ||
47 | /* | 44 | enum kmemtrace_type_id { |
48 | * Function trace entry - function address and parent function addres: | 45 | KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */ |
49 | */ | 46 | KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */ |
50 | struct ftrace_entry { | 47 | KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */ |
51 | struct trace_entry ent; | ||
52 | unsigned long ip; | ||
53 | unsigned long parent_ip; | ||
54 | }; | ||
55 | |||
56 | /* Function call entry */ | ||
57 | struct ftrace_graph_ent_entry { | ||
58 | struct trace_entry ent; | ||
59 | struct ftrace_graph_ent graph_ent; | ||
60 | }; | 48 | }; |
61 | 49 | ||
62 | /* Function return entry */ | ||
63 | struct ftrace_graph_ret_entry { | ||
64 | struct trace_entry ent; | ||
65 | struct ftrace_graph_ret ret; | ||
66 | }; | ||
67 | extern struct tracer boot_tracer; | 50 | extern struct tracer boot_tracer; |
68 | 51 | ||
69 | /* | 52 | #undef __field |
70 | * Context switch trace entry - which task (and prio) we switched from/to: | 53 | #define __field(type, item) type item; |
71 | */ | ||
72 | struct ctx_switch_entry { | ||
73 | struct trace_entry ent; | ||
74 | unsigned int prev_pid; | ||
75 | unsigned char prev_prio; | ||
76 | unsigned char prev_state; | ||
77 | unsigned int next_pid; | ||
78 | unsigned char next_prio; | ||
79 | unsigned char next_state; | ||
80 | unsigned int next_cpu; | ||
81 | }; | ||
82 | 54 | ||
83 | /* | 55 | #undef __field_struct |
84 | * Special (free-form) trace entry: | 56 | #define __field_struct(type, item) __field(type, item) |
85 | */ | ||
86 | struct special_entry { | ||
87 | struct trace_entry ent; | ||
88 | unsigned long arg1; | ||
89 | unsigned long arg2; | ||
90 | unsigned long arg3; | ||
91 | }; | ||
92 | 57 | ||
93 | /* | 58 | #undef __field_desc |
94 | * Stack-trace entry: | 59 | #define __field_desc(type, container, item) |
95 | */ | ||
96 | 60 | ||
97 | #define FTRACE_STACK_ENTRIES 8 | 61 | #undef __array |
62 | #define __array(type, item, size) type item[size]; | ||
98 | 63 | ||
99 | struct stack_entry { | 64 | #undef __array_desc |
100 | struct trace_entry ent; | 65 | #define __array_desc(type, container, item, size) |
101 | unsigned long caller[FTRACE_STACK_ENTRIES]; | ||
102 | }; | ||
103 | 66 | ||
104 | struct userstack_entry { | 67 | #undef __dynamic_array |
105 | struct trace_entry ent; | 68 | #define __dynamic_array(type, item) type item[]; |
106 | unsigned long caller[FTRACE_STACK_ENTRIES]; | ||
107 | }; | ||
108 | 69 | ||
109 | /* | 70 | #undef F_STRUCT |
110 | * trace_printk entry: | 71 | #define F_STRUCT(args...) args |
111 | */ | ||
112 | struct bprint_entry { | ||
113 | struct trace_entry ent; | ||
114 | unsigned long ip; | ||
115 | const char *fmt; | ||
116 | u32 buf[]; | ||
117 | }; | ||
118 | |||
119 | struct print_entry { | ||
120 | struct trace_entry ent; | ||
121 | unsigned long ip; | ||
122 | char buf[]; | ||
123 | }; | ||
124 | |||
125 | #define TRACE_OLD_SIZE 88 | ||
126 | |||
127 | struct trace_field_cont { | ||
128 | unsigned char type; | ||
129 | /* Temporary till we get rid of this completely */ | ||
130 | char buf[TRACE_OLD_SIZE - 1]; | ||
131 | }; | ||
132 | |||
133 | struct trace_mmiotrace_rw { | ||
134 | struct trace_entry ent; | ||
135 | struct mmiotrace_rw rw; | ||
136 | }; | ||
137 | |||
138 | struct trace_mmiotrace_map { | ||
139 | struct trace_entry ent; | ||
140 | struct mmiotrace_map map; | ||
141 | }; | ||
142 | |||
143 | struct trace_boot_call { | ||
144 | struct trace_entry ent; | ||
145 | struct boot_trace_call boot_call; | ||
146 | }; | ||
147 | |||
148 | struct trace_boot_ret { | ||
149 | struct trace_entry ent; | ||
150 | struct boot_trace_ret boot_ret; | ||
151 | }; | ||
152 | |||
153 | #define TRACE_FUNC_SIZE 30 | ||
154 | #define TRACE_FILE_SIZE 20 | ||
155 | struct trace_branch { | ||
156 | struct trace_entry ent; | ||
157 | unsigned line; | ||
158 | char func[TRACE_FUNC_SIZE+1]; | ||
159 | char file[TRACE_FILE_SIZE+1]; | ||
160 | char correct; | ||
161 | }; | ||
162 | |||
163 | struct hw_branch_entry { | ||
164 | struct trace_entry ent; | ||
165 | u64 from; | ||
166 | u64 to; | ||
167 | }; | ||
168 | 72 | ||
169 | struct trace_power { | 73 | #undef FTRACE_ENTRY |
170 | struct trace_entry ent; | 74 | #define FTRACE_ENTRY(name, struct_name, id, tstruct, print) \ |
171 | struct power_trace state_data; | 75 | struct struct_name { \ |
172 | }; | 76 | struct trace_entry ent; \ |
77 | tstruct \ | ||
78 | } | ||
173 | 79 | ||
174 | enum kmemtrace_type_id { | 80 | #undef TP_ARGS |
175 | KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */ | 81 | #define TP_ARGS(args...) args |
176 | KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */ | ||
177 | KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */ | ||
178 | }; | ||
179 | 82 | ||
180 | struct kmemtrace_alloc_entry { | 83 | #undef FTRACE_ENTRY_DUP |
181 | struct trace_entry ent; | 84 | #define FTRACE_ENTRY_DUP(name, name_struct, id, tstruct, printk) |
182 | enum kmemtrace_type_id type_id; | ||
183 | unsigned long call_site; | ||
184 | const void *ptr; | ||
185 | size_t bytes_req; | ||
186 | size_t bytes_alloc; | ||
187 | gfp_t gfp_flags; | ||
188 | int node; | ||
189 | }; | ||
190 | 85 | ||
191 | struct kmemtrace_free_entry { | 86 | #include "trace_entries.h" |
192 | struct trace_entry ent; | ||
193 | enum kmemtrace_type_id type_id; | ||
194 | unsigned long call_site; | ||
195 | const void *ptr; | ||
196 | }; | ||
197 | 87 | ||
88 | /* | ||
89 | * syscalls are special, and need special handling, this is why | ||
90 | * they are not included in trace_entries.h | ||
91 | */ | ||
198 | struct syscall_trace_enter { | 92 | struct syscall_trace_enter { |
199 | struct trace_entry ent; | 93 | struct trace_entry ent; |
200 | int nr; | 94 | int nr; |
@@ -207,13 +101,12 @@ struct syscall_trace_exit { | |||
207 | unsigned long ret; | 101 | unsigned long ret; |
208 | }; | 102 | }; |
209 | 103 | ||
210 | |||
211 | /* | 104 | /* |
212 | * trace_flag_type is an enumeration that holds different | 105 | * trace_flag_type is an enumeration that holds different |
213 | * states when a trace occurs. These are: | 106 | * states when a trace occurs. These are: |
214 | * IRQS_OFF - interrupts were disabled | 107 | * IRQS_OFF - interrupts were disabled |
215 | * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags | 108 | * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags |
216 | * NEED_RESCED - reschedule is requested | 109 | * NEED_RESCHED - reschedule is requested |
217 | * HARDIRQ - inside an interrupt handler | 110 | * HARDIRQ - inside an interrupt handler |
218 | * SOFTIRQ - inside a softirq handler | 111 | * SOFTIRQ - inside a softirq handler |
219 | */ | 112 | */ |
@@ -236,9 +129,6 @@ struct trace_array_cpu { | |||
236 | atomic_t disabled; | 129 | atomic_t disabled; |
237 | void *buffer_page; /* ring buffer spare */ | 130 | void *buffer_page; /* ring buffer spare */ |
238 | 131 | ||
239 | /* these fields get copied into max-trace: */ | ||
240 | unsigned long trace_idx; | ||
241 | unsigned long overrun; | ||
242 | unsigned long saved_latency; | 132 | unsigned long saved_latency; |
243 | unsigned long critical_start; | 133 | unsigned long critical_start; |
244 | unsigned long critical_end; | 134 | unsigned long critical_end; |
@@ -246,6 +136,7 @@ struct trace_array_cpu { | |||
246 | unsigned long nice; | 136 | unsigned long nice; |
247 | unsigned long policy; | 137 | unsigned long policy; |
248 | unsigned long rt_priority; | 138 | unsigned long rt_priority; |
139 | unsigned long skipped_entries; | ||
249 | cycle_t preempt_timestamp; | 140 | cycle_t preempt_timestamp; |
250 | pid_t pid; | 141 | pid_t pid; |
251 | uid_t uid; | 142 | uid_t uid; |
@@ -314,15 +205,10 @@ extern void __ftrace_bad_type(void); | |||
314 | IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry, \ | 205 | IF_ASSIGN(var, ent, struct ftrace_graph_ret_entry, \ |
315 | TRACE_GRAPH_RET); \ | 206 | TRACE_GRAPH_RET); \ |
316 | IF_ASSIGN(var, ent, struct hw_branch_entry, TRACE_HW_BRANCHES);\ | 207 | IF_ASSIGN(var, ent, struct hw_branch_entry, TRACE_HW_BRANCHES);\ |
317 | IF_ASSIGN(var, ent, struct trace_power, TRACE_POWER); \ | ||
318 | IF_ASSIGN(var, ent, struct kmemtrace_alloc_entry, \ | 208 | IF_ASSIGN(var, ent, struct kmemtrace_alloc_entry, \ |
319 | TRACE_KMEM_ALLOC); \ | 209 | TRACE_KMEM_ALLOC); \ |
320 | IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \ | 210 | IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \ |
321 | TRACE_KMEM_FREE); \ | 211 | TRACE_KMEM_FREE); \ |
322 | IF_ASSIGN(var, ent, struct syscall_trace_enter, \ | ||
323 | TRACE_SYSCALL_ENTER); \ | ||
324 | IF_ASSIGN(var, ent, struct syscall_trace_exit, \ | ||
325 | TRACE_SYSCALL_EXIT); \ | ||
326 | __ftrace_bad_type(); \ | 212 | __ftrace_bad_type(); \ |
327 | } while (0) | 213 | } while (0) |
328 | 214 | ||
@@ -398,7 +284,6 @@ struct tracer { | |||
398 | struct tracer *next; | 284 | struct tracer *next; |
399 | int print_max; | 285 | int print_max; |
400 | struct tracer_flags *flags; | 286 | struct tracer_flags *flags; |
401 | struct tracer_stat *stats; | ||
402 | }; | 287 | }; |
403 | 288 | ||
404 | 289 | ||
@@ -423,12 +308,13 @@ void init_tracer_sysprof_debugfs(struct dentry *d_tracer); | |||
423 | 308 | ||
424 | struct ring_buffer_event; | 309 | struct ring_buffer_event; |
425 | 310 | ||
426 | struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr, | 311 | struct ring_buffer_event * |
427 | int type, | 312 | trace_buffer_lock_reserve(struct ring_buffer *buffer, |
428 | unsigned long len, | 313 | int type, |
429 | unsigned long flags, | 314 | unsigned long len, |
430 | int pc); | 315 | unsigned long flags, |
431 | void trace_buffer_unlock_commit(struct trace_array *tr, | 316 | int pc); |
317 | void trace_buffer_unlock_commit(struct ring_buffer *buffer, | ||
432 | struct ring_buffer_event *event, | 318 | struct ring_buffer_event *event, |
433 | unsigned long flags, int pc); | 319 | unsigned long flags, int pc); |
434 | 320 | ||
@@ -438,10 +324,6 @@ struct trace_entry *tracing_get_trace_entry(struct trace_array *tr, | |||
438 | struct trace_entry *trace_find_next_entry(struct trace_iterator *iter, | 324 | struct trace_entry *trace_find_next_entry(struct trace_iterator *iter, |
439 | int *ent_cpu, u64 *ent_ts); | 325 | int *ent_cpu, u64 *ent_ts); |
440 | 326 | ||
441 | void tracing_generic_entry_update(struct trace_entry *entry, | ||
442 | unsigned long flags, | ||
443 | int pc); | ||
444 | |||
445 | void default_wait_pipe(struct trace_iterator *iter); | 327 | void default_wait_pipe(struct trace_iterator *iter); |
446 | void poll_wait_pipe(struct trace_iterator *iter); | 328 | void poll_wait_pipe(struct trace_iterator *iter); |
447 | 329 | ||
@@ -471,6 +353,7 @@ void trace_function(struct trace_array *tr, | |||
471 | 353 | ||
472 | void trace_graph_return(struct ftrace_graph_ret *trace); | 354 | void trace_graph_return(struct ftrace_graph_ret *trace); |
473 | int trace_graph_entry(struct ftrace_graph_ent *trace); | 355 | int trace_graph_entry(struct ftrace_graph_ent *trace); |
356 | void set_graph_array(struct trace_array *tr); | ||
474 | 357 | ||
475 | void tracing_start_cmdline_record(void); | 358 | void tracing_start_cmdline_record(void); |
476 | void tracing_stop_cmdline_record(void); | 359 | void tracing_stop_cmdline_record(void); |
@@ -479,35 +362,46 @@ void tracing_stop_sched_switch_record(void); | |||
479 | void tracing_start_sched_switch_record(void); | 362 | void tracing_start_sched_switch_record(void); |
480 | int register_tracer(struct tracer *type); | 363 | int register_tracer(struct tracer *type); |
481 | void unregister_tracer(struct tracer *type); | 364 | void unregister_tracer(struct tracer *type); |
365 | int is_tracing_stopped(void); | ||
482 | 366 | ||
483 | extern unsigned long nsecs_to_usecs(unsigned long nsecs); | 367 | extern unsigned long nsecs_to_usecs(unsigned long nsecs); |
484 | 368 | ||
369 | #ifdef CONFIG_TRACER_MAX_TRACE | ||
485 | extern unsigned long tracing_max_latency; | 370 | extern unsigned long tracing_max_latency; |
486 | extern unsigned long tracing_thresh; | 371 | extern unsigned long tracing_thresh; |
487 | 372 | ||
488 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); | 373 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); |
489 | void update_max_tr_single(struct trace_array *tr, | 374 | void update_max_tr_single(struct trace_array *tr, |
490 | struct task_struct *tsk, int cpu); | 375 | struct task_struct *tsk, int cpu); |
376 | #endif /* CONFIG_TRACER_MAX_TRACE */ | ||
491 | 377 | ||
492 | void __trace_stack(struct trace_array *tr, | 378 | #ifdef CONFIG_STACKTRACE |
493 | unsigned long flags, | 379 | void ftrace_trace_stack(struct ring_buffer *buffer, unsigned long flags, |
494 | int skip, int pc); | 380 | int skip, int pc); |
495 | 381 | ||
496 | extern cycle_t ftrace_now(int cpu); | 382 | void ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, |
383 | int pc); | ||
497 | 384 | ||
498 | #ifdef CONFIG_CONTEXT_SWITCH_TRACER | 385 | void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, |
499 | typedef void | 386 | int pc); |
500 | (*tracer_switch_func_t)(void *private, | 387 | #else |
501 | void *__rq, | 388 | static inline void ftrace_trace_stack(struct trace_array *tr, |
502 | struct task_struct *prev, | 389 | unsigned long flags, int skip, int pc) |
503 | struct task_struct *next); | 390 | { |
504 | 391 | } | |
505 | struct tracer_switch_ops { | 392 | |
506 | tracer_switch_func_t func; | 393 | static inline void ftrace_trace_userstack(struct trace_array *tr, |
507 | void *private; | 394 | unsigned long flags, int pc) |
508 | struct tracer_switch_ops *next; | 395 | { |
509 | }; | 396 | } |
510 | #endif /* CONFIG_CONTEXT_SWITCH_TRACER */ | 397 | |
398 | static inline void __trace_stack(struct trace_array *tr, unsigned long flags, | ||
399 | int skip, int pc) | ||
400 | { | ||
401 | } | ||
402 | #endif /* CONFIG_STACKTRACE */ | ||
403 | |||
404 | extern cycle_t ftrace_now(int cpu); | ||
511 | 405 | ||
512 | extern void trace_find_cmdline(int pid, char comm[]); | 406 | extern void trace_find_cmdline(int pid, char comm[]); |
513 | 407 | ||
@@ -517,6 +411,10 @@ extern unsigned long ftrace_update_tot_cnt; | |||
517 | extern int DYN_FTRACE_TEST_NAME(void); | 411 | extern int DYN_FTRACE_TEST_NAME(void); |
518 | #endif | 412 | #endif |
519 | 413 | ||
414 | extern int ring_buffer_expanded; | ||
415 | extern bool tracing_selftest_disabled; | ||
416 | DECLARE_PER_CPU(local_t, ftrace_cpu_disabled); | ||
417 | |||
520 | #ifdef CONFIG_FTRACE_STARTUP_TEST | 418 | #ifdef CONFIG_FTRACE_STARTUP_TEST |
521 | extern int trace_selftest_startup_function(struct tracer *trace, | 419 | extern int trace_selftest_startup_function(struct tracer *trace, |
522 | struct trace_array *tr); | 420 | struct trace_array *tr); |
@@ -548,9 +446,16 @@ extern int | |||
548 | trace_vbprintk(unsigned long ip, const char *fmt, va_list args); | 446 | trace_vbprintk(unsigned long ip, const char *fmt, va_list args); |
549 | extern int | 447 | extern int |
550 | trace_vprintk(unsigned long ip, const char *fmt, va_list args); | 448 | trace_vprintk(unsigned long ip, const char *fmt, va_list args); |
449 | extern int | ||
450 | trace_array_vprintk(struct trace_array *tr, | ||
451 | unsigned long ip, const char *fmt, va_list args); | ||
452 | int trace_array_printk(struct trace_array *tr, | ||
453 | unsigned long ip, const char *fmt, ...); | ||
551 | 454 | ||
552 | extern unsigned long trace_flags; | 455 | extern unsigned long trace_flags; |
553 | 456 | ||
457 | extern int trace_clock_id; | ||
458 | |||
554 | /* Standard output formatting function used for function return traces */ | 459 | /* Standard output formatting function used for function return traces */ |
555 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 460 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
556 | extern enum print_line_t print_graph_function(struct trace_iterator *iter); | 461 | extern enum print_line_t print_graph_function(struct trace_iterator *iter); |
@@ -613,6 +518,41 @@ static inline int ftrace_trace_task(struct task_struct *task) | |||
613 | #endif | 518 | #endif |
614 | 519 | ||
615 | /* | 520 | /* |
521 | * struct trace_parser - servers for reading the user input separated by spaces | ||
522 | * @cont: set if the input is not complete - no final space char was found | ||
523 | * @buffer: holds the parsed user input | ||
524 | * @idx: user input lenght | ||
525 | * @size: buffer size | ||
526 | */ | ||
527 | struct trace_parser { | ||
528 | bool cont; | ||
529 | char *buffer; | ||
530 | unsigned idx; | ||
531 | unsigned size; | ||
532 | }; | ||
533 | |||
534 | static inline bool trace_parser_loaded(struct trace_parser *parser) | ||
535 | { | ||
536 | return (parser->idx != 0); | ||
537 | } | ||
538 | |||
539 | static inline bool trace_parser_cont(struct trace_parser *parser) | ||
540 | { | ||
541 | return parser->cont; | ||
542 | } | ||
543 | |||
544 | static inline void trace_parser_clear(struct trace_parser *parser) | ||
545 | { | ||
546 | parser->cont = false; | ||
547 | parser->idx = 0; | ||
548 | } | ||
549 | |||
550 | extern int trace_parser_get_init(struct trace_parser *parser, int size); | ||
551 | extern void trace_parser_put(struct trace_parser *parser); | ||
552 | extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf, | ||
553 | size_t cnt, loff_t *ppos); | ||
554 | |||
555 | /* | ||
616 | * trace_iterator_flags is an enumeration that defines bit | 556 | * trace_iterator_flags is an enumeration that defines bit |
617 | * positions into trace_flags that controls the output. | 557 | * positions into trace_flags that controls the output. |
618 | * | 558 | * |
@@ -639,9 +579,8 @@ enum trace_iterator_flags { | |||
639 | TRACE_ITER_PRINTK_MSGONLY = 0x10000, | 579 | TRACE_ITER_PRINTK_MSGONLY = 0x10000, |
640 | TRACE_ITER_CONTEXT_INFO = 0x20000, /* Print pid/cpu/time */ | 580 | TRACE_ITER_CONTEXT_INFO = 0x20000, /* Print pid/cpu/time */ |
641 | TRACE_ITER_LATENCY_FMT = 0x40000, | 581 | TRACE_ITER_LATENCY_FMT = 0x40000, |
642 | TRACE_ITER_GLOBAL_CLK = 0x80000, | 582 | TRACE_ITER_SLEEP_TIME = 0x80000, |
643 | TRACE_ITER_SLEEP_TIME = 0x100000, | 583 | TRACE_ITER_GRAPH_TIME = 0x100000, |
644 | TRACE_ITER_GRAPH_TIME = 0x200000, | ||
645 | }; | 584 | }; |
646 | 585 | ||
647 | /* | 586 | /* |
@@ -738,6 +677,7 @@ struct ftrace_event_field { | |||
738 | struct list_head link; | 677 | struct list_head link; |
739 | char *name; | 678 | char *name; |
740 | char *type; | 679 | char *type; |
680 | int filter_type; | ||
741 | int offset; | 681 | int offset; |
742 | int size; | 682 | int size; |
743 | int is_signed; | 683 | int is_signed; |
@@ -747,13 +687,15 @@ struct event_filter { | |||
747 | int n_preds; | 687 | int n_preds; |
748 | struct filter_pred **preds; | 688 | struct filter_pred **preds; |
749 | char *filter_string; | 689 | char *filter_string; |
690 | bool no_reset; | ||
750 | }; | 691 | }; |
751 | 692 | ||
752 | struct event_subsystem { | 693 | struct event_subsystem { |
753 | struct list_head list; | 694 | struct list_head list; |
754 | const char *name; | 695 | const char *name; |
755 | struct dentry *entry; | 696 | struct dentry *entry; |
756 | void *filter; | 697 | struct event_filter *filter; |
698 | int nr_events; | ||
757 | }; | 699 | }; |
758 | 700 | ||
759 | struct filter_pred; | 701 | struct filter_pred; |
@@ -781,6 +723,7 @@ extern int apply_subsystem_event_filter(struct event_subsystem *system, | |||
781 | char *filter_string); | 723 | char *filter_string); |
782 | extern void print_subsystem_event_filter(struct event_subsystem *system, | 724 | extern void print_subsystem_event_filter(struct event_subsystem *system, |
783 | struct trace_seq *s); | 725 | struct trace_seq *s); |
726 | extern int filter_assign_type(const char *type); | ||
784 | 727 | ||
785 | static inline int | 728 | static inline int |
786 | filter_check_discard(struct ftrace_event_call *call, void *rec, | 729 | filter_check_discard(struct ftrace_event_call *call, void *rec, |
@@ -795,58 +738,18 @@ filter_check_discard(struct ftrace_event_call *call, void *rec, | |||
795 | return 0; | 738 | return 0; |
796 | } | 739 | } |
797 | 740 | ||
798 | #define DEFINE_COMPARISON_PRED(type) \ | ||
799 | static int filter_pred_##type(struct filter_pred *pred, void *event, \ | ||
800 | int val1, int val2) \ | ||
801 | { \ | ||
802 | type *addr = (type *)(event + pred->offset); \ | ||
803 | type val = (type)pred->val; \ | ||
804 | int match = 0; \ | ||
805 | \ | ||
806 | switch (pred->op) { \ | ||
807 | case OP_LT: \ | ||
808 | match = (*addr < val); \ | ||
809 | break; \ | ||
810 | case OP_LE: \ | ||
811 | match = (*addr <= val); \ | ||
812 | break; \ | ||
813 | case OP_GT: \ | ||
814 | match = (*addr > val); \ | ||
815 | break; \ | ||
816 | case OP_GE: \ | ||
817 | match = (*addr >= val); \ | ||
818 | break; \ | ||
819 | default: \ | ||
820 | break; \ | ||
821 | } \ | ||
822 | \ | ||
823 | return match; \ | ||
824 | } | ||
825 | |||
826 | #define DEFINE_EQUALITY_PRED(size) \ | ||
827 | static int filter_pred_##size(struct filter_pred *pred, void *event, \ | ||
828 | int val1, int val2) \ | ||
829 | { \ | ||
830 | u##size *addr = (u##size *)(event + pred->offset); \ | ||
831 | u##size val = (u##size)pred->val; \ | ||
832 | int match; \ | ||
833 | \ | ||
834 | match = (val == *addr) ^ pred->not; \ | ||
835 | \ | ||
836 | return match; \ | ||
837 | } | ||
838 | |||
839 | extern struct mutex event_mutex; | 741 | extern struct mutex event_mutex; |
840 | extern struct list_head ftrace_events; | 742 | extern struct list_head ftrace_events; |
841 | 743 | ||
842 | extern const char *__start___trace_bprintk_fmt[]; | 744 | extern const char *__start___trace_bprintk_fmt[]; |
843 | extern const char *__stop___trace_bprintk_fmt[]; | 745 | extern const char *__stop___trace_bprintk_fmt[]; |
844 | 746 | ||
845 | #undef TRACE_EVENT_FORMAT | 747 | #undef FTRACE_ENTRY |
846 | #define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt) \ | 748 | #define FTRACE_ENTRY(call, struct_name, id, tstruct, print) \ |
847 | extern struct ftrace_event_call event_##call; | 749 | extern struct ftrace_event_call event_##call; |
848 | #undef TRACE_EVENT_FORMAT_NOFILTER | 750 | #undef FTRACE_ENTRY_DUP |
849 | #define TRACE_EVENT_FORMAT_NOFILTER(call, proto, args, fmt, tstruct, tpfmt) | 751 | #define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print) \ |
850 | #include "trace_event_types.h" | 752 | FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print)) |
753 | #include "trace_entries.h" | ||
851 | 754 | ||
852 | #endif /* _LINUX_KERNEL_TRACE_H */ | 755 | #endif /* _LINUX_KERNEL_TRACE_H */ |