aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/annotate.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-04-18 16:07:38 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-04-18 16:07:38 -0300
commitd86b0597c4bd41ea3edc6446a855306eed34f93b (patch)
treea2363453f0073ccaf7defddde7ac703a2a71bbd9 /tools/perf/util/annotate.c
parentperf annotate: Disassembler instruction parsing (diff)
downloadlinux-dev-d86b0597c4bd41ea3edc6446a855306eed34f93b.tar.xz
linux-dev-d86b0597c4bd41ea3edc6446a855306eed34f93b.zip
perf annotate: Parse call targets earlier
No need to do it everytime the user presses enter/-> on a call instruction. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-ybgss44m5ycry8mk7b1qdbre@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r--tools/perf/util/annotate.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 4ee2c07924bc..a4296fdd9a68 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -18,6 +18,21 @@
const char *disassembler_style;
+static int call_ops__parse_target(const char *operands, u64 *target)
+{
+ *target = strtoull(operands, NULL, 16);
+ return 0;
+}
+
+static struct ins_ops call_ops = {
+ .parse_target = call_ops__parse_target,
+};
+
+bool ins__is_call(const struct ins *ins)
+{
+ return ins->ops == &call_ops;
+}
+
static int jump_ops__parse_target(const char *operands, u64 *target)
{
const char *s = strchr(operands, '+');
@@ -38,11 +53,12 @@ bool ins__is_jump(const struct ins *ins)
return ins->ops == &jump_ops;
}
-
/*
* Must be sorted by name!
*/
static struct ins instructions[] = {
+ { .name = "call", .ops = &call_ops, },
+ { .name = "callq", .ops = &call_ops, },
{ .name = "ja", .ops = &jump_ops, },
{ .name = "je", .ops = &jump_ops, },
{ .name = "jmp", .ops = &jump_ops, },