diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2010-03-16 18:06:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-17 06:32:31 -0400 |
commit | 4235b0454ebeefc2295ad8417e18a8761425b19e (patch) | |
tree | e6b0a3c66618dede18117a71fd16d2e65f93cba1 /tools/perf/builtin-probe.c | |
parent | f4d7da499e4fc1fdff8f26fdeb1a058d475a7a6c (diff) |
perf probe: Introduce kprobe_trace_event and perf_probe_event
Introduce kprobe_trace_event and perf_probe_event and replace
old probe_point structure with it. probe_point structure is
not enough flexible nor extensible. New data structures
will help implementing further features.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20100316220612.32050.33806.stgit@localhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r-- | tools/perf/builtin-probe.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index a1a2891ca66f..e0dafd9dfeb5 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -48,12 +48,11 @@ | |||
48 | 48 | ||
49 | /* Session management structure */ | 49 | /* Session management structure */ |
50 | static struct { | 50 | static struct { |
51 | bool need_dwarf; | ||
52 | bool list_events; | 51 | bool list_events; |
53 | bool force_add; | 52 | bool force_add; |
54 | bool show_lines; | 53 | bool show_lines; |
55 | int nr_probe; | 54 | int nevents; |
56 | struct probe_point probes[MAX_PROBES]; | 55 | struct perf_probe_event events[MAX_PROBES]; |
57 | struct strlist *dellist; | 56 | struct strlist *dellist; |
58 | struct line_range line_range; | 57 | struct line_range line_range; |
59 | } params; | 58 | } params; |
@@ -62,16 +61,16 @@ static struct { | |||
62 | /* Parse an event definition. Note that any error must die. */ | 61 | /* Parse an event definition. Note that any error must die. */ |
63 | static void parse_probe_event(const char *str) | 62 | static void parse_probe_event(const char *str) |
64 | { | 63 | { |
65 | struct probe_point *pp = ¶ms.probes[params.nr_probe]; | 64 | struct perf_probe_event *pev = ¶ms.events[params.nevents]; |
66 | 65 | ||
67 | pr_debug("probe-definition(%d): %s\n", params.nr_probe, str); | 66 | pr_debug("probe-definition(%d): %s\n", params.nevents, str); |
68 | if (++params.nr_probe == MAX_PROBES) | 67 | if (++params.nevents == MAX_PROBES) |
69 | die("Too many probes (> %d) are specified.", MAX_PROBES); | 68 | die("Too many probes (> %d) are specified.", MAX_PROBES); |
70 | 69 | ||
71 | /* Parse perf-probe event into probe_point */ | 70 | /* Parse a perf-probe command into event */ |
72 | parse_perf_probe_event(str, pp, ¶ms.need_dwarf); | 71 | parse_perf_probe_command(str, pev); |
73 | 72 | ||
74 | pr_debug("%d arguments\n", pp->nr_args); | 73 | pr_debug("%d arguments\n", pev->nargs); |
75 | } | 74 | } |
76 | 75 | ||
77 | static void parse_probe_event_argv(int argc, const char **argv) | 76 | static void parse_probe_event_argv(int argc, const char **argv) |
@@ -191,7 +190,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
191 | parse_probe_event_argv(argc, argv); | 190 | parse_probe_event_argv(argc, argv); |
192 | } | 191 | } |
193 | 192 | ||
194 | if ((!params.nr_probe && !params.dellist && !params.list_events && | 193 | if ((!params.nevents && !params.dellist && !params.list_events && |
195 | !params.show_lines)) | 194 | !params.show_lines)) |
196 | usage_with_options(probe_usage, options); | 195 | usage_with_options(probe_usage, options); |
197 | 196 | ||
@@ -199,7 +198,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
199 | die("Failed to find debugfs path."); | 198 | die("Failed to find debugfs path."); |
200 | 199 | ||
201 | if (params.list_events) { | 200 | if (params.list_events) { |
202 | if (params.nr_probe != 0 || params.dellist) { | 201 | if (params.nevents != 0 || params.dellist) { |
203 | pr_warning(" Error: Don't use --list with" | 202 | pr_warning(" Error: Don't use --list with" |
204 | " --add/--del.\n"); | 203 | " --add/--del.\n"); |
205 | usage_with_options(probe_usage, options); | 204 | usage_with_options(probe_usage, options); |
@@ -214,7 +213,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
214 | 213 | ||
215 | #ifndef NO_DWARF_SUPPORT | 214 | #ifndef NO_DWARF_SUPPORT |
216 | if (params.show_lines) { | 215 | if (params.show_lines) { |
217 | if (params.nr_probe != 0 || params.dellist) { | 216 | if (params.nevents != 0 || params.dellist) { |
218 | pr_warning(" Error: Don't use --line with" | 217 | pr_warning(" Error: Don't use --line with" |
219 | " --add/--del.\n"); | 218 | " --add/--del.\n"); |
220 | usage_with_options(probe_usage, options); | 219 | usage_with_options(probe_usage, options); |
@@ -226,14 +225,13 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
226 | #endif | 225 | #endif |
227 | 226 | ||
228 | if (params.dellist) { | 227 | if (params.dellist) { |
229 | del_trace_kprobe_events(params.dellist); | 228 | del_perf_probe_events(params.dellist); |
230 | strlist__delete(params.dellist); | 229 | strlist__delete(params.dellist); |
231 | if (params.nr_probe == 0) | 230 | if (params.nevents == 0) |
232 | return 0; | 231 | return 0; |
233 | } | 232 | } |
234 | 233 | ||
235 | add_trace_kprobe_events(params.probes, params.nr_probe, | 234 | add_perf_probe_events(params.events, params.nevents, params.force_add); |
236 | params.force_add, params.need_dwarf); | ||
237 | return 0; | 235 | return 0; |
238 | } | 236 | } |
239 | 237 | ||