From 4ea42b181434bfc6a0a18d32214130a242d489bf Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Thu, 8 Oct 2009 17:17:38 -0400 Subject: perf: Add perf probe subcommand, a kprobe-event setup helper Add perf probe subcommand that implements a kprobe-event setup helper to the perf command. This allows user to define kprobe events using C expressions (C line numbers, C function names, and C local variables). Usage ----- perf probe [] -P 'PROBEDEF' [-P 'PROBEDEF' ...] -k, --vmlinux vmlinux/module pathname -P, --probe probe point definition, where p: kprobe probe r: kretprobe probe GRP: Group name (optional) NAME: Event name FUNC: Function name OFFS: Offset from function entry (in byte) SRC: Source code path LINE: Line number ARG: Probe argument (local variable name or kprobe-tracer argument format is supported.) Changes in v4: - Add _GNU_SOURCE macro for strndup(). Changes in v3: - Remove -r option because perf always be used for online kernel. - Check malloc/calloc results. Changes in v2: - Check synthesized string length. - Rename perf kprobe to perf probe. - Use spaces for separator and update usage comment. - Check error paths in parse_probepoint(). - Check optimized-out variables. Signed-off-by: Masami Hiramatsu Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Arnaldo Carvalho de Melo Cc: Steven Rostedt Cc: Mike Galbraith Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Christoph Hellwig Cc: Ananth N Mavinakayanahalli Cc: Jim Keniston Cc: Frank Ch. Eigler LKML-Reference: <20091008211737.29299.14784.stgit@dhcp-100-2-132.bos.redhat.com> Signed-off-by: Frederic Weisbecker --- tools/perf/perf.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/perf/perf.c') diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 19fc7feb9d59..f598120c0097 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -295,6 +295,9 @@ static void handle_internal_command(int argc, const char **argv) { "version", cmd_version, 0 }, { "trace", cmd_trace, 0 }, { "sched", cmd_sched, 0 }, +#ifdef SUPPORT_DWARF + { "probe", cmd_probe, 0 }, +#endif }; unsigned int i; static const char ext[] = STRIP_EXTENSION; -- cgit v1.2.3