Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1649142 > unrolled thread
| Started by | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| First post | 2017-05-24 08:30 +0200 |
| Last post | 2017-05-24 09:20 +0200 |
| Articles | 7 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 4/7] perf script: Add --inline option Namhyung Kim <namhyung@kernel.org> - 2017-05-24 08:30 +0200
Re: [PATCH 4/7] perf script: Add --inline option Ingo Molnar <mingo@kernel.org> - 2017-05-24 08:40 +0200
Re: [PATCH 4/7] perf script: Add --inline option Namhyung Kim <namhyung@kernel.org> - 2017-05-24 09:20 +0200
Re: [PATCH 4/7] perf script: Add --inline option Ingo Molnar <mingo@kernel.org> - 2017-05-24 09:30 +0200
Re: [PATCH 4/7] perf script: Add --inline option Milian Wolff <milian.wolff@kdab.com> - 2017-05-24 10:00 +0200
Re: [PATCH 4/7] perf script: Add --inline option Ingo Molnar <mingo@kernel.org> - 2017-05-24 10:10 +0200
[tip:perf/urgent] perf script: Add --inline option for debugging tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-05-24 09:20 +0200
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2017-05-24 08:30 +0200 |
| Subject | [PATCH 4/7] perf script: Add --inline option |
| Message-ID | <tKxXX-71C-5@gated-at.bofh.it> |
The --inline option is to show inlined functions in callchains.
For example,
$ perf script
a.out 5644 11611.467597: 309961 cycles:u:
790 main (/home/namhyung/tmp/perf/a.out)
20511 __libc_start_main (/usr/lib/libc-2.25.so)
8ba _start (/home/namhyung/tmp/perf/a.out)
...
$ perf script --inline
a.out 5644 11611.467597: 309961 cycles:u:
790 main (/home/namhyung/tmp/perf/a.out)
std::__detail::_Adaptor<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>, double>::operator()
std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> >
std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> >
main
20511 __libc_start_main (/usr/lib/libc-2.25.so)
8ba _start (/home/namhyung/tmp/perf/a.out)
...
Cc: Jin Yao <yao.jin@linux.intel.com>
Reviewed-and-tested-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Documentation/perf-script.txt | 4 ++++
tools/perf/builtin-script.c | 2 ++
tools/perf/util/evsel_fprintf.c | 33 ++++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+)
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt
index cb0eda3925e6..3517e204a2b3 100644
--- a/tools/perf/Documentation/perf-script.txt
+++ b/tools/perf/Documentation/perf-script.txt
@@ -311,6 +311,10 @@ include::itrace.txt[]
Set the maximum number of program blocks to print with brstackasm for
each sample.
+--inline::
+ If a callgraph address belongs to an inlined function, the inline stack
+ will be printed. Each entry has function name and file/line.
+
SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-script-perl[1],
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index d05aec491cff..4761b0d7fcb5 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2494,6 +2494,8 @@ int cmd_script(int argc, const char **argv)
"Enable kernel symbol demangling"),
OPT_STRING(0, "time", &script.time_str, "str",
"Time span of interest (start,stop)"),
+ OPT_BOOLEAN(0, "inline", &symbol_conf.inline_name,
+ "Show inline function"),
OPT_END()
};
const char * const script_subcommands[] = { "record", "report", NULL };
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c
index e415aee6a245..583f3a602506 100644
--- a/tools/perf/util/evsel_fprintf.c
+++ b/tools/perf/util/evsel_fprintf.c
@@ -7,6 +7,7 @@
#include "map.h"
#include "strlist.h"
#include "symbol.h"
+#include "srcline.h"
static int comma_fprintf(FILE *fp, bool *first, const char *fmt, ...)
{
@@ -168,6 +169,38 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
if (!print_oneline)
printed += fprintf(fp, "\n");
+ if (symbol_conf.inline_name && node->map) {
+ struct inline_node *inode;
+
+ addr = map__rip_2objdump(node->map, node->ip),
+ inode = dso__parse_addr_inlines(node->map->dso, addr);
+
+ if (inode) {
+ struct inline_list *ilist;
+
+ list_for_each_entry(ilist, &inode->val, list) {
+ if (print_arrow)
+ printed += fprintf(fp, " <-");
+
+ /* IP is same, just skip it */
+ if (print_ip)
+ printed += fprintf(fp, "%c%16s",
+ s, "");
+ if (print_sym)
+ printed += fprintf(fp, " %s",
+ ilist->funcname);
+ if (print_srcline)
+ printed += fprintf(fp, "\n %s:%d",
+ ilist->filename,
+ ilist->line_nr);
+ if (!print_oneline)
+ printed += fprintf(fp, "\n");
+ }
+
+ inline_node__delete(inode);
+ }
+ }
+
if (symbol_conf.bt_stop_list &&
node->sym &&
strlist__has_entry(symbol_conf.bt_stop_list,
--
2.13.0
[toc] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2017-05-24 08:40 +0200 |
| Message-ID | <tKy7D-75H-3@gated-at.bofh.it> |
| In reply to | #1649142 |
* Namhyung Kim <namhyung@kernel.org> wrote: > The --inline option is to show inlined functions in callchains. > > For example, > > $ perf script > a.out 5644 11611.467597: 309961 cycles:u: > 790 main (/home/namhyung/tmp/perf/a.out) > 20511 __libc_start_main (/usr/lib/libc-2.25.so) > 8ba _start (/home/namhyung/tmp/perf/a.out) > ... > > $ perf script --inline > a.out 5644 11611.467597: 309961 cycles:u: > 790 main (/home/namhyung/tmp/perf/a.out) > std::__detail::_Adaptor<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>, double>::operator() > std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > > std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > > main > 20511 __libc_start_main (/usr/lib/libc-2.25.so) > 8ba _start (/home/namhyung/tmp/perf/a.out) > ... Shouldn't this be the default behavior, to make call chains more readable? Thanks, Ingo
[toc] | [prev] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2017-05-24 09:20 +0200 |
| Message-ID | <tKyKl-7zX-1@gated-at.bofh.it> |
| In reply to | #1649153 |
On Wed, May 24, 2017 at 08:38:11AM +0200, Ingo Molnar wrote: > > * Namhyung Kim <namhyung@kernel.org> wrote: > > > The --inline option is to show inlined functions in callchains. > > > > For example, > > > > $ perf script > > a.out 5644 11611.467597: 309961 cycles:u: > > 790 main (/home/namhyung/tmp/perf/a.out) > > 20511 __libc_start_main (/usr/lib/libc-2.25.so) > > 8ba _start (/home/namhyung/tmp/perf/a.out) > > ... > > > > $ perf script --inline > > a.out 5644 11611.467597: 309961 cycles:u: > > 790 main (/home/namhyung/tmp/perf/a.out) > > std::__detail::_Adaptor<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>, double>::operator() > > std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > > > std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > > > main > > 20511 __libc_start_main (/usr/lib/libc-2.25.so) > > 8ba _start (/home/namhyung/tmp/perf/a.out) > > ... > > Shouldn't this be the default behavior, to make call chains more readable? AFAIK perf report didn't make it default due to a performance impact, but I didn't know how much it is. Especially if perf was not built with libbfd it'll run external addr2line to get inlined functions for each callchain entry.. Thanks, Namhyung
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2017-05-24 09:30 +0200 |
| Message-ID | <tKyU2-7Df-13@gated-at.bofh.it> |
| In reply to | #1649173 |
* Namhyung Kim <namhyung@kernel.org> wrote: > On Wed, May 24, 2017 at 08:38:11AM +0200, Ingo Molnar wrote: > > > > * Namhyung Kim <namhyung@kernel.org> wrote: > > > > > The --inline option is to show inlined functions in callchains. > > > > > > For example, > > > > > > $ perf script > > > a.out 5644 11611.467597: 309961 cycles:u: > > > 790 main (/home/namhyung/tmp/perf/a.out) > > > 20511 __libc_start_main (/usr/lib/libc-2.25.so) > > > 8ba _start (/home/namhyung/tmp/perf/a.out) > > > ... > > > > > > $ perf script --inline > > > a.out 5644 11611.467597: 309961 cycles:u: > > > 790 main (/home/namhyung/tmp/perf/a.out) > > > std::__detail::_Adaptor<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>, double>::operator() > > > std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > > > > std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> > > > > main > > > 20511 __libc_start_main (/usr/lib/libc-2.25.so) > > > 8ba _start (/home/namhyung/tmp/perf/a.out) > > > ... > > > > Shouldn't this be the default behavior, to make call chains more readable? > > AFAIK perf report didn't make it default due to a performance impact, > but I didn't know how much it is. Especially if perf was not built > with libbfd it'll run external addr2line to get inlined functions for > each callchain entry.. So then at least let's make it the default when all libraries are present. Not enabling something when the build is not 'complete' is fair game - distros will typically have all the libraries available. We need to remember that roughly 99% of all our users will use as few perf command line options as they can get away with - myself included. Adding a non-debugging feature as a non-default command line option is really as if we didn't do anything: very few if any people will use it, and it might bitrot in the future without people noticing. So we need apply some thought into making it available to two orders of magnitude more people! If someone types 'perf report' we should give the best selection of all the features we have available. Thanks, Ingo
[toc] | [prev] | [next] | [standalone]
| From | Milian Wolff <milian.wolff@kdab.com> |
|---|---|
| Date | 2017-05-24 10:00 +0200 |
| Message-ID | <tKzn4-7OH-21@gated-at.bofh.it> |
| In reply to | #1649187 |
[Multipart message — attachments visible in raw view] — view raw
On Wednesday, May 24, 2017 9:21:42 AM CEST Ingo Molnar wrote: > * Namhyung Kim <namhyung@kernel.org> wrote: > > On Wed, May 24, 2017 at 08:38:11AM +0200, Ingo Molnar wrote: > > > * Namhyung Kim <namhyung@kernel.org> wrote: > > > > The --inline option is to show inlined functions in callchains. > > > > > > > > For example, > > > > > > > > $ perf script > > > > > > > > a.out 5644 11611.467597: 309961 cycles:u: > > > > 790 main (/home/namhyung/tmp/perf/a.out) > > > > > > > > 20511 __libc_start_main (/usr/lib/libc-2.25.so) > > > > > > > > 8ba _start (/home/namhyung/tmp/perf/a.out) > > > > > > > > ... > > > > > > > > $ perf script --inline > > > > > > > > a.out 5644 11611.467597: 309961 cycles:u: > > > > 790 main (/home/namhyung/tmp/perf/a.out) > > > > > > > > std::__detail::_Adaptor<std::linear_congruent > > > > ial_engine<unsigned long, 16807ul, 0ul, > > > > 2147483647ul>, double>::operator() > > > > std::uniform_real_distribution<double>::oper > > > > ator()<std::linear_congruential_engine<unsign > > > > ed long, 16807ul, 0ul, 2147483647ul> > > > > > std::uniform_real_distribution<double>::oper > > > > ator()<std::linear_congruential_engine<unsign > > > > ed long, 16807ul, 0ul, 2147483647ul> > main > > > > > > > > 20511 __libc_start_main (/usr/lib/libc-2.25.so) > > > > > > > > 8ba _start (/home/namhyung/tmp/perf/a.out) > > > > > > > > ... > > > > > > Shouldn't this be the default behavior, to make call chains more > > > readable? > > > > AFAIK perf report didn't make it default due to a performance impact, > > but I didn't know how much it is. Especially if perf was not built > > with libbfd it'll run external addr2line to get inlined functions for > > each callchain entry.. > > So then at least let's make it the default when all libraries are present. > Not enabling something when the build is not 'complete' is fair game - > distros will typically have all the libraries available. > > We need to remember that roughly 99% of all our users will use as few perf > command line options as they can get away with - myself included. Adding a > non-debugging feature as a non-default command line option is really as if > we didn't do anything: very few if any people will use it, and it might > bitrot in the future without people noticing. > > So we need apply some thought into making it available to two orders of > magnitude more people! If someone types 'perf report' we should give the > best selection of all the features we have available. Just a suggestion: My larger patch set that is in review now adds some caching features which already speeds up the whole process considerably. As such, my suggestion is to wait for this patch set to be integrated. Then we could enable --inline unconditionally, or at least only when libbfd is available. Cheers -- Milian Wolff | milian.wolff@kdab.com | Software Engineer KDAB (Deutschland) GmbH&Co KG, a KDAB Group company Tel: +49-30-521325470 KDAB - The Qt Experts
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2017-05-24 10:10 +0200 |
| Message-ID | <tKzwK-88W-11@gated-at.bofh.it> |
| In reply to | #1649210 |
* Milian Wolff <milian.wolff@kdab.com> wrote: > On Wednesday, May 24, 2017 9:21:42 AM CEST Ingo Molnar wrote: > > * Namhyung Kim <namhyung@kernel.org> wrote: > > > On Wed, May 24, 2017 at 08:38:11AM +0200, Ingo Molnar wrote: > > > > * Namhyung Kim <namhyung@kernel.org> wrote: > > > > > The --inline option is to show inlined functions in callchains. > > > > > > > > > > For example, > > > > > > > > > > $ perf script > > > > > > > > > > a.out 5644 11611.467597: 309961 cycles:u: > > > > > 790 main (/home/namhyung/tmp/perf/a.out) > > > > > > > > > > 20511 __libc_start_main (/usr/lib/libc-2.25.so) > > > > > > > > > > 8ba _start (/home/namhyung/tmp/perf/a.out) > > > > > > > > > > ... > > > > > > > > > > $ perf script --inline > > > > > > > > > > a.out 5644 11611.467597: 309961 cycles:u: > > > > > 790 main (/home/namhyung/tmp/perf/a.out) > > > > > > > > > > std::__detail::_Adaptor<std::linear_congruent > > > > > ial_engine<unsigned long, 16807ul, 0ul, > > > > > 2147483647ul>, double>::operator() > > > > > std::uniform_real_distribution<double>::oper > > > > > ator()<std::linear_congruential_engine<unsign > > > > > ed long, 16807ul, 0ul, 2147483647ul> > > > > > > std::uniform_real_distribution<double>::oper > > > > > ator()<std::linear_congruential_engine<unsign > > > > > ed long, 16807ul, 0ul, 2147483647ul> > main > > > > > > > > > > 20511 __libc_start_main (/usr/lib/libc-2.25.so) > > > > > > > > > > 8ba _start (/home/namhyung/tmp/perf/a.out) > > > > > > > > > > ... > > > > > > > > Shouldn't this be the default behavior, to make call chains more > > > > readable? > > > > > > AFAIK perf report didn't make it default due to a performance impact, > > > but I didn't know how much it is. Especially if perf was not built > > > with libbfd it'll run external addr2line to get inlined functions for > > > each callchain entry.. > > > > So then at least let's make it the default when all libraries are present. > > Not enabling something when the build is not 'complete' is fair game - > > distros will typically have all the libraries available. > > > > We need to remember that roughly 99% of all our users will use as few perf > > command line options as they can get away with - myself included. Adding a > > non-debugging feature as a non-default command line option is really as if > > we didn't do anything: very few if any people will use it, and it might > > bitrot in the future without people noticing. > > > > So we need apply some thought into making it available to two orders of > > magnitude more people! If someone types 'perf report' we should give the > > best selection of all the features we have available. > > Just a suggestion: My larger patch set that is in review now adds some caching > features which already speeds up the whole process considerably. As such, my > suggestion is to wait for this patch set to be integrated. Then we could > enable --inline unconditionally, or at least only when libbfd is available. I'm fine with that - and please make the default-enabling part of your patch series, so it does not get forgotten. Thanks, Ingo
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Namhyung Kim <tipbot@zytor.com> |
|---|---|
| Date | 2017-05-24 09:20 +0200 |
| Subject | [tip:perf/urgent] perf script: Add --inline option for debugging |
| Message-ID | <tKyKm-7zX-13@gated-at.bofh.it> |
| In reply to | #1649142 |
Commit-ID: 325fbff51f961491adff4037d0e0a94d6132bd9b
Gitweb: http://git.kernel.org/tip/325fbff51f961491adff4037d0e0a94d6132bd9b
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Wed, 24 May 2017 15:21:26 +0900
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 24 May 2017 08:41:48 +0200
perf script: Add --inline option for debugging
The --inline option is to show inlined functions in callchains.
For example:
$ perf script
a.out 5644 11611.467597: 309961 cycles:u:
790 main (/home/namhyung/tmp/perf/a.out)
20511 __libc_start_main (/usr/lib/libc-2.25.so)
8ba _start (/home/namhyung/tmp/perf/a.out)
...
$ perf script --inline
a.out 5644 11611.467597: 309961 cycles:u:
790 main (/home/namhyung/tmp/perf/a.out)
std::__detail::_Adaptor<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>, double>::operator()
std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> >
std::uniform_real_distribution<double>::operator()<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> >
main
20511 __libc_start_main (/usr/lib/libc-2.25.so)
8ba _start (/home/namhyung/tmp/perf/a.out)
...
Reviewed-and-tested-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170524062129.32529-5-namhyung@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
tools/perf/Documentation/perf-script.txt | 4 ++++
tools/perf/builtin-script.c | 2 ++
tools/perf/util/evsel_fprintf.c | 33 ++++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+)
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt
index cb0eda3..3517e20 100644
--- a/tools/perf/Documentation/perf-script.txt
+++ b/tools/perf/Documentation/perf-script.txt
@@ -311,6 +311,10 @@ include::itrace.txt[]
Set the maximum number of program blocks to print with brstackasm for
each sample.
+--inline::
+ If a callgraph address belongs to an inlined function, the inline stack
+ will be printed. Each entry has function name and file/line.
+
SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-script-perl[1],
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index d05aec4..4761b0d 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2494,6 +2494,8 @@ int cmd_script(int argc, const char **argv)
"Enable kernel symbol demangling"),
OPT_STRING(0, "time", &script.time_str, "str",
"Time span of interest (start,stop)"),
+ OPT_BOOLEAN(0, "inline", &symbol_conf.inline_name,
+ "Show inline function"),
OPT_END()
};
const char * const script_subcommands[] = { "record", "report", NULL };
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c
index e415aee..583f3a6 100644
--- a/tools/perf/util/evsel_fprintf.c
+++ b/tools/perf/util/evsel_fprintf.c
@@ -7,6 +7,7 @@
#include "map.h"
#include "strlist.h"
#include "symbol.h"
+#include "srcline.h"
static int comma_fprintf(FILE *fp, bool *first, const char *fmt, ...)
{
@@ -168,6 +169,38 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
if (!print_oneline)
printed += fprintf(fp, "\n");
+ if (symbol_conf.inline_name && node->map) {
+ struct inline_node *inode;
+
+ addr = map__rip_2objdump(node->map, node->ip),
+ inode = dso__parse_addr_inlines(node->map->dso, addr);
+
+ if (inode) {
+ struct inline_list *ilist;
+
+ list_for_each_entry(ilist, &inode->val, list) {
+ if (print_arrow)
+ printed += fprintf(fp, " <-");
+
+ /* IP is same, just skip it */
+ if (print_ip)
+ printed += fprintf(fp, "%c%16s",
+ s, "");
+ if (print_sym)
+ printed += fprintf(fp, " %s",
+ ilist->funcname);
+ if (print_srcline)
+ printed += fprintf(fp, "\n %s:%d",
+ ilist->filename,
+ ilist->line_nr);
+ if (!print_oneline)
+ printed += fprintf(fp, "\n");
+ }
+
+ inline_node__delete(inode);
+ }
+ }
+
if (symbol_conf.bt_stop_list &&
node->sym &&
strlist__has_entry(symbol_conf.bt_stop_list,
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web