Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf annotate: Pass "-l" option to objdump conditionally

The "-l" option is to print line numbers in the objdump output. perf
annotate TUI only can show the line numbers later but it causes big slow
downs for the kernel binary.

Similarly, showing source code also takes a long time and it already has
an option to control it.

$ time objdump ... -d -S -C vmlinux > /dev/null
real 0m3.474s
user 0m3.047s
sys 0m0.428s

$ time objdump ... -d -l -C vmlinux > /dev/null
real 0m1.796s
user 0m1.459s
sys 0m0.338s

$ time objdump ... -d -C vmlinux > /dev/null
real 0m0.051s
user 0m0.036s
sys 0m0.016s

As it's not needed for data type profiling, let's make it conditional so
that it can skip the unnecessary work.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: linux-toolchains@vger.kernel.org
Cc: linux-trace-devel@vger.kernel.org
Link: https://lore.kernel.org/r/20231110000012.3538610-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
ded8c484 dd678532

+2 -1
+2 -1
tools/perf/util/annotate.c
··· 2144 2144 err = asprintf(&command, 2145 2145 "%s %s%s --start-address=0x%016" PRIx64 2146 2146 " --stop-address=0x%016" PRIx64 2147 - " -l -d %s %s %s %c%s%c %s%s -C \"$1\"", 2147 + " %s -d %s %s %s %c%s%c %s%s -C \"$1\"", 2148 2148 opts->objdump_path ?: "objdump", 2149 2149 opts->disassembler_style ? "-M " : "", 2150 2150 opts->disassembler_style ?: "", 2151 2151 map__rip_2objdump(map, sym->start), 2152 2152 map__rip_2objdump(map, sym->end), 2153 + opts->show_linenr ? "-l" : "", 2153 2154 opts->show_asm_raw ? "" : "--no-show-raw-insn", 2154 2155 opts->annotate_src ? "-S" : "", 2155 2156 opts->prefix ? "--prefix " : "",