aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-probe.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2009-12-08 17:03:23 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-09 01:26:53 -0500
commitfa28244d12337eebcc620b23852ec3cf29582ff9 (patch)
treeac193550d55be55dba279a57e4ee3a3e41674db0 /tools/perf/builtin-probe.c
parenta7c312bed772c11138409c3a98531e85d690302e (diff)
perf probe: Support --del option
Support perf probe --del <event> option. Currently, perf probe can have only one event for each --del option. If you'd like to delete several probe events, you need to specify --del for each events. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Jim Keniston <jkenisto@us.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Frank Ch. Eigler <fche@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jason Baron <jbaron@redhat.com> Cc: K.Prasad <prasad@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: systemtap <systemtap@sources.redhat.com> Cc: DLE <dle-develop@lists.sourceforge.net> LKML-Reference: <20091208220323.10142.62079.stgit@dhcp-100-2-132.bos.redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r--tools/perf/builtin-probe.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 1c97e133a3f4..5a47c1e11f77 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -35,6 +35,7 @@
35#include "perf.h" 35#include "perf.h"
36#include "builtin.h" 36#include "builtin.h"
37#include "util/util.h" 37#include "util/util.h"
38#include "util/strlist.h"
38#include "util/event.h" 39#include "util/event.h"
39#include "util/debug.h" 40#include "util/debug.h"
40#include "util/parse-options.h" 41#include "util/parse-options.h"
@@ -61,6 +62,7 @@ static struct {
61 int need_dwarf; 62 int need_dwarf;
62 int nr_probe; 63 int nr_probe;
63 struct probe_point probes[MAX_PROBES]; 64 struct probe_point probes[MAX_PROBES];
65 struct strlist *dellist;
64} session; 66} session;
65 67
66static bool listing; 68static bool listing;
@@ -107,6 +109,17 @@ static int opt_add_probe_event(const struct option *opt __used,
107 return 0; 109 return 0;
108} 110}
109 111
112static int opt_del_probe_event(const struct option *opt __used,
113 const char *str, int unset __used)
114{
115 if (str) {
116 if (!session.dellist)
117 session.dellist = strlist__new(true, NULL);
118 strlist__add(session.dellist, str);
119 }
120 return 0;
121}
122
110#ifndef NO_LIBDWARF 123#ifndef NO_LIBDWARF
111static int open_default_vmlinux(void) 124static int open_default_vmlinux(void)
112{ 125{
@@ -141,6 +154,7 @@ static int open_default_vmlinux(void)
141static const char * const probe_usage[] = { 154static const char * const probe_usage[] = {
142 "perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]", 155 "perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]",
143 "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", 156 "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
157 "perf probe [<options>] --del '[GROUP:]EVENT' ...",
144 "perf probe --list", 158 "perf probe --list",
145 NULL 159 NULL
146}; 160};
@@ -152,7 +166,9 @@ static const struct option options[] = {
152 OPT_STRING('k', "vmlinux", &session.vmlinux, "file", 166 OPT_STRING('k', "vmlinux", &session.vmlinux, "file",
153 "vmlinux/module pathname"), 167 "vmlinux/module pathname"),
154#endif 168#endif
155 OPT_BOOLEAN('l', "list", &listing, "list up current probes"), 169 OPT_BOOLEAN('l', "list", &listing, "list up current probe events"),
170 OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.",
171 opt_del_probe_event),
156 OPT_CALLBACK('a', "add", NULL, 172 OPT_CALLBACK('a', "add", NULL,
157#ifdef NO_LIBDWARF 173#ifdef NO_LIBDWARF
158 "FUNC[+OFFS|%return] [ARG ...]", 174 "FUNC[+OFFS|%return] [ARG ...]",
@@ -191,15 +207,26 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
191 if (argc > 0) 207 if (argc > 0)
192 parse_probe_event_argv(argc, argv); 208 parse_probe_event_argv(argc, argv);
193 209
194 if ((session.nr_probe == 0 && !listing) || 210 if ((session.nr_probe == 0 && !session.dellist && !listing))
195 (session.nr_probe != 0 && listing))
196 usage_with_options(probe_usage, options); 211 usage_with_options(probe_usage, options);
197 212
198 if (listing) { 213 if (listing) {
214 if (session.nr_probe != 0 || session.dellist) {
215 pr_warning(" Error: Don't use --list with"
216 " --add/--del.\n");
217 usage_with_options(probe_usage, options);
218 }
199 show_perf_probe_events(); 219 show_perf_probe_events();
200 return 0; 220 return 0;
201 } 221 }
202 222
223 if (session.dellist) {
224 del_trace_kprobe_events(session.dellist);
225 strlist__delete(session.dellist);
226 if (session.nr_probe == 0)
227 return 0;
228 }
229
203 if (session.need_dwarf) 230 if (session.need_dwarf)
204#ifdef NO_LIBDWARF 231#ifdef NO_LIBDWARF
205 die("Debuginfo-analysis is not supported"); 232 die("Debuginfo-analysis is not supported");