summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-probe.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2010-03-16 23:06:12 +0100
committerIngo Molnar <mingo@elte.hu>2010-03-17 11:32:31 +0100
commit4235b0454ebeefc2295ad8417e18a8761425b19e (patch)
treee6b0a3c66618dede18117a71fd16d2e65f93cba1 /tools/perf/builtin-probe.c
parentperf probe: Add --dry-run option (diff)
downloadlinux-4235b0454ebeefc2295ad8417e18a8761425b19e.tar.xz
linux-4235b0454ebeefc2295ad8417e18a8761425b19e.zip
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.c30
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 @@
/* Session management structure */
static struct {
- bool need_dwarf;
bool list_events;
bool force_add;
bool show_lines;
- int nr_probe;
- struct probe_point probes[MAX_PROBES];
+ int nevents;
+ struct perf_probe_event events[MAX_PROBES];
struct strlist *dellist;
struct line_range line_range;
} params;
@@ -62,16 +61,16 @@ static struct {
/* Parse an event definition. Note that any error must die. */
static void parse_probe_event(const char *str)
{
- struct probe_point *pp = &params.probes[params.nr_probe];
+ struct perf_probe_event *pev = &params.events[params.nevents];
- pr_debug("probe-definition(%d): %s\n", params.nr_probe, str);
- if (++params.nr_probe == MAX_PROBES)
+ pr_debug("probe-definition(%d): %s\n", params.nevents, str);
+ if (++params.nevents == MAX_PROBES)
die("Too many probes (> %d) are specified.", MAX_PROBES);
- /* Parse perf-probe event into probe_point */
- parse_perf_probe_event(str, pp, &params.need_dwarf);
+ /* Parse a perf-probe command into event */
+ parse_perf_probe_command(str, pev);
- pr_debug("%d arguments\n", pp->nr_args);
+ pr_debug("%d arguments\n", pev->nargs);
}
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)
parse_probe_event_argv(argc, argv);
}
- if ((!params.nr_probe && !params.dellist && !params.list_events &&
+ if ((!params.nevents && !params.dellist && !params.list_events &&
!params.show_lines))
usage_with_options(probe_usage, options);
@@ -199,7 +198,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
die("Failed to find debugfs path.");
if (params.list_events) {
- if (params.nr_probe != 0 || params.dellist) {
+ if (params.nevents != 0 || params.dellist) {
pr_warning(" Error: Don't use --list with"
" --add/--del.\n");
usage_with_options(probe_usage, options);
@@ -214,7 +213,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
#ifndef NO_DWARF_SUPPORT
if (params.show_lines) {
- if (params.nr_probe != 0 || params.dellist) {
+ if (params.nevents != 0 || params.dellist) {
pr_warning(" Error: Don't use --line with"
" --add/--del.\n");
usage_with_options(probe_usage, options);
@@ -226,14 +225,13 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
#endif
if (params.dellist) {
- del_trace_kprobe_events(params.dellist);
+ del_perf_probe_events(params.dellist);
strlist__delete(params.dellist);
- if (params.nr_probe == 0)
+ if (params.nevents == 0)
return 0;
}
- add_trace_kprobe_events(params.probes, params.nr_probe,
- params.force_add, params.need_dwarf);
+ add_perf_probe_events(params.events, params.nevents, params.force_add);
return 0;
}