diff options
Diffstat (limited to 'tools/perf/util/probe-event.h')
-rw-r--r-- | tools/perf/util/probe-event.h | 130 |
1 files changed, 117 insertions, 13 deletions
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h index 711287d4bae..e9db1a214ca 100644 --- a/tools/perf/util/probe-event.h +++ b/tools/perf/util/probe-event.h | |||
@@ -2,21 +2,125 @@ | |||
2 | #define _PROBE_EVENT_H | 2 | #define _PROBE_EVENT_H |
3 | 3 | ||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include "probe-finder.h" | ||
6 | #include "strlist.h" | 5 | #include "strlist.h" |
7 | 6 | ||
8 | extern void parse_line_range_desc(const char *arg, struct line_range *lr); | 7 | extern bool probe_event_dry_run; |
9 | extern void parse_perf_probe_event(const char *str, struct probe_point *pp, | 8 | |
10 | bool *need_dwarf); | 9 | /* kprobe-tracer tracing point */ |
11 | extern int synthesize_perf_probe_point(struct probe_point *pp); | 10 | struct kprobe_trace_point { |
12 | extern int synthesize_perf_probe_event(struct probe_point *pp); | 11 | char *symbol; /* Base symbol */ |
13 | extern void parse_trace_kprobe_event(const char *str, struct probe_point *pp); | 12 | unsigned long offset; /* Offset from symbol */ |
14 | extern int synthesize_trace_kprobe_event(struct probe_point *pp); | 13 | bool retprobe; /* Return probe flag */ |
15 | extern void add_trace_kprobe_events(struct probe_point *probes, int nr_probes, | 14 | }; |
16 | bool force_add); | 15 | |
17 | extern void del_trace_kprobe_events(struct strlist *dellist); | 16 | /* kprobe-tracer tracing argument referencing offset */ |
18 | extern void show_perf_probe_events(void); | 17 | struct kprobe_trace_arg_ref { |
19 | extern void show_line_range(struct line_range *lr); | 18 | struct kprobe_trace_arg_ref *next; /* Next reference */ |
19 | long offset; /* Offset value */ | ||
20 | }; | ||
21 | |||
22 | /* kprobe-tracer tracing argument */ | ||
23 | struct kprobe_trace_arg { | ||
24 | char *name; /* Argument name */ | ||
25 | char *value; /* Base value */ | ||
26 | char *type; /* Type name */ | ||
27 | struct kprobe_trace_arg_ref *ref; /* Referencing offset */ | ||
28 | }; | ||
29 | |||
30 | /* kprobe-tracer tracing event (point + arg) */ | ||
31 | struct kprobe_trace_event { | ||
32 | char *event; /* Event name */ | ||
33 | char *group; /* Group name */ | ||
34 | struct kprobe_trace_point point; /* Trace point */ | ||
35 | int nargs; /* Number of args */ | ||
36 | struct kprobe_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 | bool ref; /* Referencing flag */ | ||
54 | }; | ||
55 | |||
56 | /* Perf probe probing argument */ | ||
57 | struct perf_probe_arg { | ||
58 | char *name; /* Argument name */ | ||
59 | char *var; /* Variable name */ | ||
60 | char *type; /* Type name */ | ||
61 | struct perf_probe_arg_field *field; /* Structure fields */ | ||
62 | }; | ||
63 | |||
64 | /* Perf probe probing event (point + arg) */ | ||
65 | struct perf_probe_event { | ||
66 | char *event; /* Event name */ | ||
67 | char *group; /* Group name */ | ||
68 | struct perf_probe_point point; /* Probe point */ | ||
69 | int nargs; /* Number of arguments */ | ||
70 | struct perf_probe_arg *args; /* Arguments */ | ||
71 | }; | ||
72 | |||
73 | |||
74 | /* Line number container */ | ||
75 | struct line_node { | ||
76 | struct list_head list; | ||
77 | int line; | ||
78 | }; | ||
79 | |||
80 | /* Line range */ | ||
81 | struct line_range { | ||
82 | char *file; /* File name */ | ||
83 | char *function; /* Function name */ | ||
84 | int start; /* Start line number */ | ||
85 | int end; /* End line number */ | ||
86 | int offset; /* Start line offset */ | ||
87 | char *path; /* Real path name */ | ||
88 | struct list_head line_list; /* Visible lines */ | ||
89 | }; | ||
90 | |||
91 | /* Command string to events */ | ||
92 | extern int parse_perf_probe_command(const char *cmd, | ||
93 | struct perf_probe_event *pev); | ||
94 | extern int parse_kprobe_trace_command(const char *cmd, | ||
95 | struct kprobe_trace_event *tev); | ||
96 | |||
97 | /* Events to command string */ | ||
98 | extern char *synthesize_perf_probe_command(struct perf_probe_event *pev); | ||
99 | extern char *synthesize_kprobe_trace_command(struct kprobe_trace_event *tev); | ||
100 | extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf, | ||
101 | size_t len); | ||
102 | |||
103 | /* Check the perf_probe_event needs debuginfo */ | ||
104 | extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev); | ||
105 | |||
106 | /* Convert from kprobe_trace_event to perf_probe_event */ | ||
107 | extern int convert_to_perf_probe_event(struct kprobe_trace_event *tev, | ||
108 | struct perf_probe_event *pev); | ||
109 | |||
110 | /* Release event contents */ | ||
111 | extern void clear_perf_probe_event(struct perf_probe_event *pev); | ||
112 | extern void clear_kprobe_trace_event(struct kprobe_trace_event *tev); | ||
113 | |||
114 | /* Command string to line-range */ | ||
115 | extern int parse_line_range_desc(const char *cmd, struct line_range *lr); | ||
116 | |||
117 | |||
118 | extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs, | ||
119 | bool force_add, int max_probe_points); | ||
120 | extern int del_perf_probe_events(struct strlist *dellist); | ||
121 | extern int show_perf_probe_events(void); | ||
122 | extern int show_line_range(struct line_range *lr); | ||
123 | |||
20 | 124 | ||
21 | /* Maximum index number of event-name postfix */ | 125 | /* Maximum index number of event-name postfix */ |
22 | #define MAX_EVENT_INDEX 1024 | 126 | #define MAX_EVENT_INDEX 1024 |