Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1323549 > unrolled thread
| Started by | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| First post | 2016-02-01 23:00 +0100 |
| Last post | 2016-02-03 11:10 +0100 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[GIT PULL 00/10] perf/core callchains improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-01 23:00 +0100
[PATCH 06/10] perf report: Fix percent display in callchains on --stdio Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-01 23:00 +0100
[PATCH 01/10] perf hists: Fix min callchain hits calculation Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-01 23:00 +0100
[PATCH 05/10] perf callchain: Pass parent_samples to __callchain__fprintf_graph() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-01 23:00 +0100
Re: [GIT PULL 00/10] perf/core callchains improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-02-03 11:10 +0100
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-01 23:00 +0100 |
| Subject | [GIT PULL 00/10] perf/core callchains improvements and fixes |
| Message-ID | <qXuw9-yR-7@gated-at.bofh.it> |
See http://www.infradead.org/rpr.html
Hi Ingo,
Please consider pulling, this is on top of two previous pull requests I
made,
Thanks,
- Arnaldo
The following changes since commit 814568db641f6587c1e98a3a85f214cb6a30fe10:
perf build: Align the names of the build tests: (2016-01-29 17:51:04 -0300)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-3
for you to fetch changes up to 3848c23b19e07188bfa15e3d9a2ac27692f2ff3c:
perf report: Don't show blank lines if entry has no callchain (2016-02-01 17:51:09 -0300)
----------------------------------------------------------------
perf/core callchain fixes and improvements
User visible:
- Make --percent-limit apply to callchains also and fix some bugs
related to --percent-limit (Namhyung Kim)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Namhyung Kim (10):
perf hists: Fix min callchain hits calculation
perf hists: Update hists' total period when adding entries
perf report: Apply --percent-limit to callchains also
perf report: Get rid of hist_entry__callchain_fprintf()
perf callchain: Pass parent_samples to __callchain__fprintf_graph()
perf report: Fix percent display in callchains on --stdio
perf hists browser: Fix dump to show correct callchain style
perf hists browser: Pass parent_total to callchain print functions
perf hists browser: Fix percent display in callchains
perf report: Don't show blank lines if entry has no callchain
tools/perf/builtin-report.c | 9 +++-
tools/perf/ui/browsers/hists.c | 113 +++++++++++++++++++++++++----------------
tools/perf/ui/stdio/hist.c | 77 ++++++++++++++--------------
tools/perf/util/hist.c | 24 +++++++--
4 files changed, 136 insertions(+), 87 deletions(-)
[toc] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-01 23:00 +0100 |
| Subject | [PATCH 06/10] perf report: Fix percent display in callchains on --stdio |
| Message-ID | <qXuFS-Cy-29@gated-at.bofh.it> |
| In reply to | #1323549 |
See http://www.infradead.org/rpr.html
From: Namhyung Kim <namhyung@kernel.org>
When there's only a single callchain, perf doesn't print its percentage
in front of the symbols. This is because it assumes that the percentage
is same as parents. But if a percent limit is applied, it's possible
that there are actually a couple of child nodes but only one of them is
shown. In this case it should display the percent to prevent
misunderstanding of its percentage is same as the parent's.
For example, let's see the following callchain.
$ perf report -s comm --percent-limit 0.01 --stdio
...
9.95% swapper
|
|--7.57%--intel_idle
| cpuidle_enter_state
| cpuidle_enter
| call_cpuidle
| cpu_startup_entry
| |
| |--4.89%--start_secondary
| |
| --2.68%--rest_init
| start_kernel
| x86_64_start_reservations
| x86_64_start_kernel
|
|--0.15%--__schedule
| |
| |--0.13%--schedule
| | schedule_preempt_disable
| | cpu_startup_entry
| | |
| | |--0.09%--start_secondary
| | |
| | --0.04%--rest_init
| | start_kernel
| | x86_64_start_reservations
| | x86_64_start_kernel
| |
| --0.01%--schedule_preempt_disabled
| cpu_startup_entry
...
Current code omits the percent if 'intel_idle' becomes the only node
when percent limit is set to 0.5%, its percent is not 9.95% but users
will assume it incorrectly.
Before:
$ perf report --percent-limit 0.5 --stdio
...
9.95% swapper
|
---intel_idle
cpuidle_enter_state
cpuidle_enter
call_cpuidle
cpu_startup_entry
|
|--4.89%--start_secondary
|
--2.68%--rest_init
start_kernel
x86_64_start_reservations
x86_64_start_kernel
After:
$ perf report --percent-limit 0.5 --stdio
...
9.95% swapper
|
--7.57%--intel_idle
cpuidle_enter_state
cpuidle_enter
call_cpuidle
cpu_startup_entry
|
|--4.89%--start_secondary
|
--2.68%--rest_init
start_kernel
x86_64_start_reservations
x86_64_start_kernel
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1453909257-26015-7-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/stdio/hist.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 96188ea12771..76ff46becac8 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -165,6 +165,25 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
return ret;
}
+/*
+ * If have one single callchain root, don't bother printing
+ * its percentage (100 % in fractal mode and the same percentage
+ * than the hist in graph mode). This also avoid one level of column.
+ *
+ * However when percent-limit applied, it's possible that single callchain
+ * node have different (non-100% in fractal mode) percentage.
+ */
+static bool need_percent_display(struct rb_node *node, u64 parent_samples)
+{
+ struct callchain_node *cnode;
+
+ if (rb_next(node))
+ return true;
+
+ cnode = rb_entry(node, struct callchain_node, rb_node);
+ return callchain_cumul_hits(cnode) != parent_samples;
+}
+
static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
u64 total_samples, u64 parent_samples,
int left_margin)
@@ -178,13 +197,8 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
int ret = 0;
char bf[1024];
- /*
- * If have one single callchain root, don't bother printing
- * its percentage (100 % in fractal mode and the same percentage
- * than the hist in graph mode). This also avoid one level of column.
- */
node = rb_first(root);
- if (node && !rb_next(node)) {
+ if (node && !need_percent_display(node, parent_samples)) {
cnode = rb_entry(node, struct callchain_node, rb_node);
list_for_each_entry(chain, &cnode->val, list) {
/*
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-01 23:00 +0100 |
| Subject | [PATCH 01/10] perf hists: Fix min callchain hits calculation |
| Message-ID | <qXuFS-Cy-27@gated-at.bofh.it> |
| In reply to | #1323549 |
See http://www.infradead.org/rpr.html
From: Namhyung Kim <namhyung@kernel.org>
The total period should be get using hists__total_period() since it
takes filtered entries into account. In addition, if callchain mode is
'fractal', the total period should be the entry's period.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1453909257-26015-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 81ce0aff69d1..b96194676c91 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1163,9 +1163,18 @@ static void __hists__insert_output_entry(struct rb_root *entries,
struct rb_node *parent = NULL;
struct hist_entry *iter;
- if (use_callchain)
+ if (use_callchain) {
+ if (callchain_param.mode == CHAIN_GRAPH_REL) {
+ u64 total = he->stat.period;
+
+ if (symbol_conf.cumulate_callchain)
+ total = he->stat_acc->period;
+
+ min_callchain_hits = total * (callchain_param.min_percent / 100);
+ }
callchain_param.sort(&he->sorted_chain, he->callchain,
min_callchain_hits, &callchain_param);
+ }
while (*p != NULL) {
parent = *p;
@@ -1195,7 +1204,7 @@ void hists__output_resort(struct hists *hists, struct ui_progress *prog)
else
use_callchain = symbol_conf.use_callchain;
- min_callchain_hits = hists->stats.total_period * (callchain_param.min_percent / 100);
+ min_callchain_hits = hists__total_period(hists) * (callchain_param.min_percent / 100);
if (sort__need_collapse)
root = &hists->entries_collapsed;
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-01 23:00 +0100 |
| Subject | [PATCH 05/10] perf callchain: Pass parent_samples to __callchain__fprintf_graph() |
| Message-ID | <qXuFS-Cy-33@gated-at.bofh.it> |
| In reply to | #1323549 |
From: Namhyung Kim <namhyung@kernel.org>
Pass hist entry's period to graph callchain print function. This info
is needed by later patch to determine whether it can omit percentage of
top-level node or not.
No functional change intended.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1453909257-26015-6-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/stdio/hist.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 8e25f7dd6e84..96188ea12771 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -166,7 +166,8 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
}
static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
- u64 total_samples, int left_margin)
+ u64 total_samples, u64 parent_samples,
+ int left_margin)
{
struct callchain_node *cnode;
struct callchain_list *chain;
@@ -213,6 +214,9 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
root = &cnode->rb_root;
}
+ if (callchain_param.mode == CHAIN_GRAPH_REL)
+ total_samples = parent_samples;
+
ret += __callchain__fprintf_graph(fp, root, total_samples,
1, 1, left_margin);
ret += fprintf(fp, "\n");
@@ -323,16 +327,19 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he,
u64 total_samples, int left_margin,
FILE *fp)
{
+ u64 parent_samples = he->stat.period;
+
+ if (symbol_conf.cumulate_callchain)
+ parent_samples = he->stat_acc->period;
+
switch (callchain_param.mode) {
case CHAIN_GRAPH_REL:
- return callchain__fprintf_graph(fp, &he->sorted_chain,
- symbol_conf.cumulate_callchain ?
- he->stat_acc->period : he->stat.period,
- left_margin);
+ return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples,
+ parent_samples, left_margin);
break;
case CHAIN_GRAPH_ABS:
return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples,
- left_margin);
+ parent_samples, left_margin);
break;
case CHAIN_FLAT:
return callchain__fprintf_flat(fp, &he->sorted_chain, total_samples);
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2016-02-03 11:10 +0100 |
| Message-ID | <qY2xQ-A6-9@gated-at.bofh.it> |
| In reply to | #1323549 |
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > Hi Ingo, > > Please consider pulling, this is on top of two previous pull requests I > made, > > Thanks, > > - Arnaldo > > > The following changes since commit 814568db641f6587c1e98a3a85f214cb6a30fe10: > > perf build: Align the names of the build tests: (2016-01-29 17:51:04 -0300) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-3 > > for you to fetch changes up to 3848c23b19e07188bfa15e3d9a2ac27692f2ff3c: > > perf report: Don't show blank lines if entry has no callchain (2016-02-01 17:51:09 -0300) > > ---------------------------------------------------------------- > perf/core callchain fixes and improvements > > User visible: > > - Make --percent-limit apply to callchains also and fix some bugs > related to --percent-limit (Namhyung Kim) > > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> > > ---------------------------------------------------------------- > Namhyung Kim (10): > perf hists: Fix min callchain hits calculation > perf hists: Update hists' total period when adding entries > perf report: Apply --percent-limit to callchains also > perf report: Get rid of hist_entry__callchain_fprintf() > perf callchain: Pass parent_samples to __callchain__fprintf_graph() > perf report: Fix percent display in callchains on --stdio > perf hists browser: Fix dump to show correct callchain style > perf hists browser: Pass parent_total to callchain print functions > perf hists browser: Fix percent display in callchains > perf report: Don't show blank lines if entry has no callchain > > tools/perf/builtin-report.c | 9 +++- > tools/perf/ui/browsers/hists.c | 113 +++++++++++++++++++++++++---------------- > tools/perf/ui/stdio/hist.c | 77 ++++++++++++++-------------- > tools/perf/util/hist.c | 24 +++++++-- > 4 files changed, 136 insertions(+), 87 deletions(-) Pulled into tip:perf/core, thanks! Ingo
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web