Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / tools / perf / util / probe-event.h
1 #ifndef _PROBE_EVENT_H
2 #define _PROBE_EVENT_H
3
4 #include <stdbool.h>
5 #include "strlist.h"
6
7 extern bool probe_event_dry_run;
8
9 /* kprobe-tracer tracing point */
10 struct probe_trace_point {
11 char *symbol; /* Base symbol */
12 unsigned long offset; /* Offset from symbol */
13 bool retprobe; /* Return probe flag */
14 };
15
16 /* probe-tracer tracing argument referencing offset */
17 struct probe_trace_arg_ref {
18 struct probe_trace_arg_ref *next; /* Next reference */
19 long offset; /* Offset value */
20 };
21
22 /* kprobe-tracer tracing argument */
23 struct probe_trace_arg {
24 char *name; /* Argument name */
25 char *value; /* Base value */
26 char *type; /* Type name */
27 struct probe_trace_arg_ref *ref; /* Referencing offset */
28 };
29
30 /* kprobe-tracer tracing event (point + arg) */
31 struct probe_trace_event {
32 char *event; /* Event name */
33 char *group; /* Group name */
34 struct probe_trace_point point; /* Trace point */
35 int nargs; /* Number of args */
36 struct probe_trace_arg *args; /* Arguments */
37 };
38
39 /* Perf probe probing point */
40 struct perf_probe_point {
41 char *file; /* File path */
42 char *function; /* Function name */
43 int line; /* Line number */
44 bool retprobe; /* Return probe flag */
45 char *lazy_line; /* Lazy matching pattern */
46 unsigned long offset; /* Offset from function entry */
47 };
48
49 /* Perf probe probing argument field chain */
50 struct perf_probe_arg_field {
51 struct perf_probe_arg_field *next; /* Next field */
52 char *name; /* Name of the field */
53 long index; /* Array index number */
54 bool ref; /* Referencing flag */
55 };
56
57 /* Perf probe probing argument */
58 struct perf_probe_arg {
59 char *name; /* Argument name */
60 char *var; /* Variable name */
61 char *type; /* Type name */
62 struct perf_probe_arg_field *field; /* Structure fields */
63 };
64
65 /* Perf probe probing event (point + arg) */
66 struct perf_probe_event {
67 char *event; /* Event name */
68 char *group; /* Group name */
69 struct perf_probe_point point; /* Probe point */
70 int nargs; /* Number of arguments */
71 struct perf_probe_arg *args; /* Arguments */
72 };
73
74
75 /* Line number container */
76 struct line_node {
77 struct list_head list;
78 int line;
79 };
80
81 /* Line range */
82 struct line_range {
83 char *file; /* File name */
84 char *function; /* Function name */
85 int start; /* Start line number */
86 int end; /* End line number */
87 int offset; /* Start line offset */
88 char *path; /* Real path name */
89 char *comp_dir; /* Compile directory */
90 struct list_head line_list; /* Visible lines */
91 };
92
93 /* List of variables */
94 struct variable_list {
95 struct probe_trace_point point; /* Actual probepoint */
96 struct strlist *vars; /* Available variables */
97 };
98
99 /* Command string to events */
100 extern int parse_perf_probe_command(const char *cmd,
101 struct perf_probe_event *pev);
102
103 /* Events to command string */
104 extern char *synthesize_perf_probe_command(struct perf_probe_event *pev);
105 extern char *synthesize_probe_trace_command(struct probe_trace_event *tev);
106 extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf,
107 size_t len);
108
109 /* Check the perf_probe_event needs debuginfo */
110 extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);
111
112 /* Release event contents */
113 extern void clear_perf_probe_event(struct perf_probe_event *pev);
114
115 /* Command string to line-range */
116 extern int parse_line_range_desc(const char *cmd, struct line_range *lr);
117
118 /* Internal use: Return kernel/module path */
119 extern const char *kernel_get_module_path(const char *module);
120
121 extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
122 int max_probe_points, const char *module,
123 bool force_add);
124 extern int del_perf_probe_events(struct strlist *dellist);
125 extern int show_perf_probe_events(void);
126 extern int show_line_range(struct line_range *lr, const char *module);
127 extern int show_available_vars(struct perf_probe_event *pevs, int npevs,
128 int max_probe_points, const char *module,
129 bool externs);
130
131
132 /* Maximum index number of event-name postfix */
133 #define MAX_EVENT_INDEX 1024
134
135 #endif /*_PROBE_EVENT_H */