Skip to content

Commit 0e20f43

Browse files
Changbin Duacmel
authored andcommitted
perf script: Print raw ip instead of binary offset for callchain
Before this, the raw ip is printed for non-callchain and dso offset for callchain. This inconsistent output for address may confuse people. And mostly what we expect is the raw ip. 'dso offset' is printed in callchain: $ perf script ... ls 1341034 2739463.008343: 2162417 cycles: ffffffff99d657a7 [unknown] ([unknown]) ffffffff99e00b67 [unknown] ([unknown]) 235d3 memset+0x53 (/usr/lib/x86_64-linux-gnu/ld-2.31.so) # dso offset a61b _dl_map_object+0x1bb (/usr/lib/x86_64-linux-gnu/ld-2.31.so) raw ip is printed for non-callchain: $ perf script -G ... ls 1341034 2739463.008876: 2053304 cycles: ffffffffc1596923 [unknown] ([unknown]) ls 1341034 2739463.009381: 1917049 cycles: 14def8e149e6 __strcoll_l+0xd96 (/usr/lib/x86_64-linux-gnu/libc-2.31.so) # raw ip Let's have consistent output for it. Later I'll add a new field 'dsoff' to print dso offset. Signed-off-by: Changbin Du <changbin.du@huawei.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Hui Wang <hw.huiwang@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20230418031825.1262579-2-changbin.du@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 1511e46 commit 0e20f43

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

tools/perf/util/evsel_fprintf.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,8 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
153153
if (map)
154154
addr = map__map_ip(map, node->ip);
155155

156-
if (print_ip) {
157-
/* Show binary offset for userspace addr */
158-
if (map && !map__dso(map)->kernel)
159-
printed += fprintf(fp, "%c%16" PRIx64, s, addr);
160-
else
161-
printed += fprintf(fp, "%c%16" PRIx64, s, node->ip);
162-
}
156+
if (print_ip)
157+
printed += fprintf(fp, "%c%16" PRIx64, s, node->ip);
163158

164159
if (print_sym) {
165160
printed += fprintf(fp, " ");

0 commit comments

Comments
 (0)