aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2011-05-17 11:32:07 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-08-18 06:38:21 -0400
commit3e6a2a7f3b9d0e521bb3284573b696d0cbe1952c (patch)
tree0d77abbf2aff698b287c5cfc2657f700f0c37500 /tools
parent18e5a45db30e0e338cdd663eda05a8288cc14fa5 (diff)
perf annotate: Make output more readable
This patch adds two new options to perf annotate: - --no-asm-raw : Do not display raw instruction encodings - --no-source : Do not interleave source code with assembly code We believe those options make the output of annotate more readable. Systematically displaying source can make it hard to follow code and especially optimized code. Raw encodings are not useful in most cases. Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20110517153207.GA9834@quad Signed-off-by: Stephane Eranian <eranian@google.com> [committer note: Use the 'no-' option inverting logic] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/perf-annotate.txt8
-rw-r--r--tools/perf/builtin-annotate.c4
-rw-r--r--tools/perf/util/annotate.c5
-rw-r--r--tools/perf/util/symbol.c2
-rw-r--r--tools/perf/util/symbol.h4
5 files changed, 21 insertions, 2 deletions
diff --git a/tools/perf/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt
index 85c5f026930..5bc06001557 100644
--- a/tools/perf/Documentation/perf-annotate.txt
+++ b/tools/perf/Documentation/perf-annotate.txt
@@ -72,6 +72,14 @@ OPTIONS
72 CPUs are specified with -: 0-2. Default is to report samples on all 72 CPUs are specified with -: 0-2. Default is to report samples on all
73 CPUs. 73 CPUs.
74 74
75--asm-raw::
76 Show raw instruction encoding of assembly instructions. They
77 are displayed by default, disable with --no-asm-raw.
78
79--source::
80 Interleave source code with assembly code. Enabled by default,
81 disable with --no-source.
82
75SEE ALSO 83SEE ALSO
76-------- 84--------
77linkperf:perf-record[1], linkperf:perf-report[1] 85linkperf:perf-record[1], linkperf:perf-report[1]
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 555aefd7fe0..5015e04b821 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -267,6 +267,10 @@ static const struct option options[] = {
267 OPT_BOOLEAN('P', "full-paths", &full_paths, 267 OPT_BOOLEAN('P', "full-paths", &full_paths,
268 "Don't shorten the displayed pathnames"), 268 "Don't shorten the displayed pathnames"),
269 OPT_STRING('c', "cpu", &cpu_list, "cpu", "list of cpus to profile"), 269 OPT_STRING('c', "cpu", &cpu_list, "cpu", "list of cpus to profile"),
270 OPT_BOOLEAN('0', "source", &symbol_conf.annotate_src,
271 "Interleave source code with assembly code (default)"),
272 OPT_BOOLEAN('0', "asm-raw", &symbol_conf.annotate_asm_raw,
273 "Display raw encoding of assembly instructions (default)"),
270 OPT_END() 274 OPT_END()
271}; 275};
272 276
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index e01af2b1a46..01d36ba5405 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -324,9 +324,12 @@ fallback:
324 324
325 snprintf(command, sizeof(command), 325 snprintf(command, sizeof(command),
326 "objdump --start-address=0x%016" PRIx64 326 "objdump --start-address=0x%016" PRIx64
327 " --stop-address=0x%016" PRIx64 " -dS -C %s|grep -v %s|expand", 327 " --stop-address=0x%016" PRIx64
328 " -d %s %s -C %s|grep -v %s|expand",
328 map__rip_2objdump(map, sym->start), 329 map__rip_2objdump(map, sym->start),
329 map__rip_2objdump(map, sym->end), 330 map__rip_2objdump(map, sym->end),
331 symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",
332 symbol_conf.annotate_src ? "-S" : "",
330 symfs_filename, filename); 333 symfs_filename, filename);
331 334
332 pr_debug("Executing: %s\n", command); 335 pr_debug("Executing: %s\n", command);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 469c0264ed2..245e60d6b4e 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -46,6 +46,8 @@ struct symbol_conf symbol_conf = {
46 .exclude_other = true, 46 .exclude_other = true,
47 .use_modules = true, 47 .use_modules = true,
48 .try_vmlinux_path = true, 48 .try_vmlinux_path = true,
49 .annotate_asm_raw = true,
50 .annotate_src = true,
49 .symfs = "", 51 .symfs = "",
50}; 52};
51 53
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 4f377d92e75..7733f0b3cd4 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -76,7 +76,9 @@ struct symbol_conf {
76 exclude_other, 76 exclude_other,
77 show_cpu_utilization, 77 show_cpu_utilization,
78 initialized, 78 initialized,
79 kptr_restrict; 79 kptr_restrict,
80 annotate_asm_raw,
81 annotate_src;
80 const char *vmlinux_name, 82 const char *vmlinux_name,
81 *kallsyms_name, 83 *kallsyms_name,
82 *source_prefix, 84 *source_prefix,