aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-07 07:34:26 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-07 07:34:42 -0400
commit2e8844e13ab73f1107aea4317a53ff5879f2e1d7 (patch)
tree36165371cf6fd26d674610f1c6bb5fac50e6e13f /kernel/trace/trace.h
parentc78a3956b982418186e40978a51636a2b43221bc (diff)
parentd508afb437daee7cf07da085b635c44a4ebf9b38 (diff)
Merge branch 'linus' into tracing/hw-branch-tracing
Merge reason: update to latest tracing and ptrace APIs Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r--kernel/trace/trace.h120
1 files changed, 106 insertions, 14 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index e7fbc826f1e9..9e15802cca9f 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -123,7 +123,6 @@ struct userstack_entry {
123struct bprint_entry { 123struct bprint_entry {
124 struct trace_entry ent; 124 struct trace_entry ent;
125 unsigned long ip; 125 unsigned long ip;
126 int depth;
127 const char *fmt; 126 const char *fmt;
128 u32 buf[]; 127 u32 buf[];
129}; 128};
@@ -131,7 +130,6 @@ struct bprint_entry {
131struct print_entry { 130struct print_entry {
132 struct trace_entry ent; 131 struct trace_entry ent;
133 unsigned long ip; 132 unsigned long ip;
134 int depth;
135 char buf[]; 133 char buf[];
136}; 134};
137 135
@@ -184,6 +182,12 @@ struct trace_power {
184 struct power_trace state_data; 182 struct power_trace state_data;
185}; 183};
186 184
185enum kmemtrace_type_id {
186 KMEMTRACE_TYPE_KMALLOC = 0, /* kmalloc() or kfree(). */
187 KMEMTRACE_TYPE_CACHE, /* kmem_cache_*(). */
188 KMEMTRACE_TYPE_PAGES, /* __get_free_pages() and friends. */
189};
190
187struct kmemtrace_alloc_entry { 191struct kmemtrace_alloc_entry {
188 struct trace_entry ent; 192 struct trace_entry ent;
189 enum kmemtrace_type_id type_id; 193 enum kmemtrace_type_id type_id;
@@ -202,6 +206,19 @@ struct kmemtrace_free_entry {
202 const void *ptr; 206 const void *ptr;
203}; 207};
204 208
209struct syscall_trace_enter {
210 struct trace_entry ent;
211 int nr;
212 unsigned long args[];
213};
214
215struct syscall_trace_exit {
216 struct trace_entry ent;
217 int nr;
218 unsigned long ret;
219};
220
221
205/* 222/*
206 * trace_flag_type is an enumeration that holds different 223 * trace_flag_type is an enumeration that holds different
207 * states when a trace occurs. These are: 224 * states when a trace occurs. These are:
@@ -315,6 +332,10 @@ extern void __ftrace_bad_type(void);
315 TRACE_KMEM_ALLOC); \ 332 TRACE_KMEM_ALLOC); \
316 IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \ 333 IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \
317 TRACE_KMEM_FREE); \ 334 TRACE_KMEM_FREE); \
335 IF_ASSIGN(var, ent, struct syscall_trace_enter, \
336 TRACE_SYSCALL_ENTER); \
337 IF_ASSIGN(var, ent, struct syscall_trace_exit, \
338 TRACE_SYSCALL_EXIT); \
318 __ftrace_bad_type(); \ 339 __ftrace_bad_type(); \
319 } while (0) 340 } while (0)
320 341
@@ -468,6 +489,8 @@ trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
468 unsigned long flags, int pc); 489 unsigned long flags, int pc);
469void trace_current_buffer_unlock_commit(struct ring_buffer_event *event, 490void trace_current_buffer_unlock_commit(struct ring_buffer_event *event,
470 unsigned long flags, int pc); 491 unsigned long flags, int pc);
492void trace_nowake_buffer_unlock_commit(struct ring_buffer_event *event,
493 unsigned long flags, int pc);
471 494
472struct trace_entry *tracing_get_trace_entry(struct trace_array *tr, 495struct trace_entry *tracing_get_trace_entry(struct trace_array *tr,
473 struct trace_array_cpu *data); 496 struct trace_array_cpu *data);
@@ -547,7 +570,7 @@ struct tracer_switch_ops {
547}; 570};
548#endif /* CONFIG_CONTEXT_SWITCH_TRACER */ 571#endif /* CONFIG_CONTEXT_SWITCH_TRACER */
549 572
550extern char *trace_find_cmdline(int pid); 573extern void trace_find_cmdline(int pid, char comm[]);
551 574
552#ifdef CONFIG_DYNAMIC_FTRACE 575#ifdef CONFIG_DYNAMIC_FTRACE
553extern unsigned long ftrace_update_tot_cnt; 576extern unsigned long ftrace_update_tot_cnt;
@@ -583,9 +606,9 @@ extern int trace_selftest_startup_hw_branches(struct tracer *trace,
583extern void *head_page(struct trace_array_cpu *data); 606extern void *head_page(struct trace_array_cpu *data);
584extern long ns2usecs(cycle_t nsec); 607extern long ns2usecs(cycle_t nsec);
585extern int 608extern int
586trace_vbprintk(unsigned long ip, int depth, const char *fmt, va_list args); 609trace_vbprintk(unsigned long ip, const char *fmt, va_list args);
587extern int 610extern int
588trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args); 611trace_vprintk(unsigned long ip, const char *fmt, va_list args);
589 612
590extern unsigned long trace_flags; 613extern unsigned long trace_flags;
591 614
@@ -669,6 +692,8 @@ enum trace_iterator_flags {
669 TRACE_ITER_PRINTK_MSGONLY = 0x10000, 692 TRACE_ITER_PRINTK_MSGONLY = 0x10000,
670 TRACE_ITER_CONTEXT_INFO = 0x20000, /* Print pid/cpu/time */ 693 TRACE_ITER_CONTEXT_INFO = 0x20000, /* Print pid/cpu/time */
671 TRACE_ITER_LATENCY_FMT = 0x40000, 694 TRACE_ITER_LATENCY_FMT = 0x40000,
695 TRACE_ITER_GLOBAL_CLK = 0x80000,
696 TRACE_ITER_SLEEP_TIME = 0x100000,
672}; 697};
673 698
674/* 699/*
@@ -761,22 +786,89 @@ enum {
761 TRACE_EVENT_TYPE_RAW = 2, 786 TRACE_EVENT_TYPE_RAW = 2,
762}; 787};
763 788
789struct ftrace_event_field {
790 struct list_head link;
791 char *name;
792 char *type;
793 int offset;
794 int size;
795};
796
764struct ftrace_event_call { 797struct ftrace_event_call {
765 char *name; 798 char *name;
766 char *system; 799 char *system;
767 struct dentry *dir; 800 struct dentry *dir;
768 int enabled; 801 int enabled;
769 int (*regfunc)(void); 802 int (*regfunc)(void);
770 void (*unregfunc)(void); 803 void (*unregfunc)(void);
771 int id; 804 int id;
772 int (*raw_init)(void); 805 int (*raw_init)(void);
773 int (*show_format)(struct trace_seq *s); 806 int (*show_format)(struct trace_seq *s);
807 int (*define_fields)(void);
808 struct list_head fields;
809 struct filter_pred **preds;
810
811#ifdef CONFIG_EVENT_PROFILE
812 atomic_t profile_count;
813 int (*profile_enable)(struct ftrace_event_call *);
814 void (*profile_disable)(struct ftrace_event_call *);
815#endif
774}; 816};
775 817
818struct event_subsystem {
819 struct list_head list;
820 const char *name;
821 struct dentry *entry;
822 struct filter_pred **preds;
823};
824
825#define events_for_each(event) \
826 for (event = __start_ftrace_events; \
827 (unsigned long)event < (unsigned long)__stop_ftrace_events; \
828 event++)
829
830#define MAX_FILTER_PRED 8
831
832struct filter_pred;
833
834typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event);
835
836struct filter_pred {
837 filter_pred_fn_t fn;
838 u64 val;
839 char *str_val;
840 int str_len;
841 char *field_name;
842 int offset;
843 int not;
844 int or;
845 int compound;
846 int clear;
847};
848
849int trace_define_field(struct ftrace_event_call *call, char *type,
850 char *name, int offset, int size);
851extern void filter_free_pred(struct filter_pred *pred);
852extern void filter_print_preds(struct filter_pred **preds,
853 struct trace_seq *s);
854extern int filter_parse(char **pbuf, struct filter_pred *pred);
855extern int filter_add_pred(struct ftrace_event_call *call,
856 struct filter_pred *pred);
857extern void filter_free_preds(struct ftrace_event_call *call);
858extern int filter_match_preds(struct ftrace_event_call *call, void *rec);
859extern void filter_free_subsystem_preds(struct event_subsystem *system);
860extern int filter_add_subsystem_pred(struct event_subsystem *system,
861 struct filter_pred *pred);
862
776void event_trace_printk(unsigned long ip, const char *fmt, ...); 863void event_trace_printk(unsigned long ip, const char *fmt, ...);
777extern struct ftrace_event_call __start_ftrace_events[]; 864extern struct ftrace_event_call __start_ftrace_events[];
778extern struct ftrace_event_call __stop_ftrace_events[]; 865extern struct ftrace_event_call __stop_ftrace_events[];
779 866
867#define for_each_event(event) \
868 for (event = __start_ftrace_events; \
869 (unsigned long)event < (unsigned long)__stop_ftrace_events; \
870 event++)
871
780extern const char *__start___trace_bprintk_fmt[]; 872extern const char *__start___trace_bprintk_fmt[];
781extern const char *__stop___trace_bprintk_fmt[]; 873extern const char *__stop___trace_bprintk_fmt[];
782 874