Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1335423 > unrolled thread
| Started by | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| First post | 2016-02-16 15:20 +0100 |
| Last post | 2016-02-20 12:50 +0100 |
| Articles | 6 — 3 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 v6 01/25] perf hists browser: Fix percentage update on key press Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
Re: [PATCH v6 01/25] perf hists browser: Fix percentage update on key press Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-16 21:10 +0100
Re: [PATCH v6 01/25] perf hists browser: Fix percentage update on key press Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-16 22:00 +0100
Re: [PATCH v6 01/25] perf hists browser: Fix percentage update on key press Namhyung Kim <namhyung@kernel.org> - 2016-02-17 00:40 +0100
Re: [PATCH v6 01/25] perf hists browser: Fix percentage update on key press Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-17 14:50 +0100
[tip:perf/core] perf hists browser: Fix percentage update on key press tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-02-20 12:50 +0100
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2016-02-16 15:20 +0100 |
| Subject | [PATCH v6 01/25] perf hists browser: Fix percentage update on key press |
| Message-ID | <r2ODU-vy-11@gated-at.bofh.it> |
Currently 'perf top --tui' decrements percentage of all entries on any
key press. This is because it adds total period as new samples are
added to hists. As perf-top does it currently but added samples are not
passed to the display thread, the percentages are decresing
continuously.
So separate total period stat into a different variable so that it
cannot affect the output total period. This new total period stats are
used only for calcualating callchain percent limit.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/hist.c | 26 +++++++++++++++++++-------
tools/perf/util/hist.h | 2 ++
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 561e9473a915..a856617be744 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -405,6 +405,16 @@ static u8 symbol__parent_filter(const struct symbol *parent)
return 0;
}
+static void hist_entry__add_callchain_period(struct hist_entry *he, u64 period)
+{
+ if (!symbol_conf.use_callchain)
+ return;
+
+ he->hists->callchain_period += period;
+ if (!he->filtered)
+ he->hists->callchain_non_filtered_period += period;
+}
+
static struct hist_entry *hists__findnew_entry(struct hists *hists,
struct hist_entry *entry,
struct addr_location *al,
@@ -434,9 +444,7 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists,
if (!cmp) {
if (sample_self) {
he_stat__add_period(&he->stat, period, weight);
- hists->stats.total_period += period;
- if (!he->filtered)
- hists->stats.total_non_filtered_period += period;
+ hist_entry__add_callchain_period(he, period);
}
if (symbol_conf.cumulate_callchain)
he_stat__add_period(he->stat_acc, period, weight);
@@ -471,9 +479,8 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists,
return NULL;
if (sample_self)
- hists__inc_stats(hists, he);
- else
- hists->nr_entries++;
+ hist_entry__add_callchain_period(he, period);
+ hists->nr_entries++;
rb_link_node(&he->rb_node_in, parent, p);
rb_insert_color(&he->rb_node_in, hists->entries_in);
@@ -1227,9 +1234,14 @@ static void output_resort(struct hists *hists, struct ui_progress *prog,
struct rb_root *root;
struct rb_node *next;
struct hist_entry *n;
+ u64 callchain_total;
u64 min_callchain_hits;
- min_callchain_hits = hists__total_period(hists) * (callchain_param.min_percent / 100);
+ callchain_total = hists->callchain_period;
+ if (symbol_conf.filter_relative)
+ callchain_total = hists->callchain_non_filtered_period;
+
+ min_callchain_hits = callchain_total * (callchain_param.min_percent / 100);
if (sort__need_collapse)
root = &hists->entries_collapsed;
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 840b6d6aa44f..045a9e785a34 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -66,6 +66,8 @@ struct hists {
struct rb_root entries_collapsed;
u64 nr_entries;
u64 nr_non_filtered_entries;
+ u64 callchain_period;
+ u64 callchain_non_filtered_period;
struct thread *thread_filter;
const struct dso *dso_filter;
const char *uid_filter_str;
--
2.7.1
[toc] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-16 21:10 +0100 |
| Subject | Re: [PATCH v6 01/25] perf hists browser: Fix percentage update on key press |
| Message-ID | <r2U6E-4e2-43@gated-at.bofh.it> |
| In reply to | #1335423 |
Em Tue, Feb 16, 2016 at 11:08:19PM +0900, Namhyung Kim escreveu:
> Currently 'perf top --tui' decrements percentage of all entries on any
> key press. This is because it adds total period as new samples are
> added to hists. As perf-top does it currently but added samples are not
> passed to the display thread, the percentages are decresing
> continuously.
>
> So separate total period stat into a different variable so that it
> cannot affect the output total period. This new total period stats are
> used only for calcualating callchain percent limit.
I'm trying to figure this out now, but please next time add a line like
Fixes: aabbccddeeff ("perf tools: buggy commit description")
This helps reviewing as well as to figure out if this needs to go to
stable@kernel.org, etc.
- Arnaldo
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/util/hist.c | 26 +++++++++++++++++++-------
> tools/perf/util/hist.h | 2 ++
> 2 files changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> index 561e9473a915..a856617be744 100644
> --- a/tools/perf/util/hist.c
> +++ b/tools/perf/util/hist.c
> @@ -405,6 +405,16 @@ static u8 symbol__parent_filter(const struct symbol *parent)
> return 0;
> }
>
> +static void hist_entry__add_callchain_period(struct hist_entry *he, u64 period)
> +{
> + if (!symbol_conf.use_callchain)
> + return;
> +
> + he->hists->callchain_period += period;
> + if (!he->filtered)
> + he->hists->callchain_non_filtered_period += period;
> +}
> +
> static struct hist_entry *hists__findnew_entry(struct hists *hists,
> struct hist_entry *entry,
> struct addr_location *al,
> @@ -434,9 +444,7 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists,
> if (!cmp) {
> if (sample_self) {
> he_stat__add_period(&he->stat, period, weight);
> - hists->stats.total_period += period;
> - if (!he->filtered)
> - hists->stats.total_non_filtered_period += period;
> + hist_entry__add_callchain_period(he, period);
> }
> if (symbol_conf.cumulate_callchain)
> he_stat__add_period(he->stat_acc, period, weight);
> @@ -471,9 +479,8 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists,
> return NULL;
>
> if (sample_self)
> - hists__inc_stats(hists, he);
> - else
> - hists->nr_entries++;
> + hist_entry__add_callchain_period(he, period);
> + hists->nr_entries++;
>
> rb_link_node(&he->rb_node_in, parent, p);
> rb_insert_color(&he->rb_node_in, hists->entries_in);
> @@ -1227,9 +1234,14 @@ static void output_resort(struct hists *hists, struct ui_progress *prog,
> struct rb_root *root;
> struct rb_node *next;
> struct hist_entry *n;
> + u64 callchain_total;
> u64 min_callchain_hits;
>
> - min_callchain_hits = hists__total_period(hists) * (callchain_param.min_percent / 100);
> + callchain_total = hists->callchain_period;
> + if (symbol_conf.filter_relative)
> + callchain_total = hists->callchain_non_filtered_period;
> +
> + min_callchain_hits = callchain_total * (callchain_param.min_percent / 100);
>
> if (sort__need_collapse)
> root = &hists->entries_collapsed;
> diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
> index 840b6d6aa44f..045a9e785a34 100644
> --- a/tools/perf/util/hist.h
> +++ b/tools/perf/util/hist.h
> @@ -66,6 +66,8 @@ struct hists {
> struct rb_root entries_collapsed;
> u64 nr_entries;
> u64 nr_non_filtered_entries;
> + u64 callchain_period;
> + u64 callchain_non_filtered_period;
> struct thread *thread_filter;
> const struct dso *dso_filter;
> const char *uid_filter_str;
> --
> 2.7.1
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-16 22:00 +0100 |
| Subject | Re: [PATCH v6 01/25] perf hists browser: Fix percentage update on key press |
| Message-ID | <r2UT0-4yA-9@gated-at.bofh.it> |
| In reply to | #1335780 |
Em Tue, Feb 16, 2016 at 05:06:08PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Feb 16, 2016 at 11:08:19PM +0900, Namhyung Kim escreveu:
> > Currently 'perf top --tui' decrements percentage of all entries on any
> > key press. This is because it adds total period as new samples are
> > added to hists. As perf-top does it currently but added samples are not
> > passed to the display thread, the percentages are decresing
> > continuously.
> >
> > So separate total period stat into a different variable so that it
> > cannot affect the output total period. This new total period stats are
> > used only for calcualating callchain percent limit.
>
> I'm trying to figure this out now, but please next time add a line like
>
> Fixes: aabbccddeeff ("perf tools: buggy commit description")
>
> This helps reviewing as well as to figure out if this needs to go to
> stable@kernel.org, etc.
So this is the one:
[acme@ssdandy linux]$ git bisect good
0f58474ec835f6fc80af2cde2c7ed5495cd212ba is the first bad commit
commit 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
Author: Namhyung Kim <namhyung@kernel.org>
Date: Thu Jan 28 00:40:49 2016 +0900
perf hists: Update hists' total period when adding entries
Currently the hist entry addition path doesn't update total_period of
hists and it's calculated during 'resort' path. But the resort path
needs to know the total period before doing its job because it's used
for calculating percent limit of callchains in hist entries.
So this patch update the total period during the addition path. It
makes the percent limit of callchains working (again).
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-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
:040000 040000 ff6b15566490dbc26fdd70af5c7ab09451d9bfcd a27ec8e9f21172b1fa3617498976d04a2fcc2449 M tools
[acme@ssdandy linux]$
So we this in this cset:
Fixes: 0f58474ec835 ("perf hists: Update hists' total period when adding entries")
And it needs to go to stable@kernel.org # v4.4+
[acme@ssdandy linux]$ git describe 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
v4.4-5893-g0f58474ec835
Please double check this, I'll be OOO in a moment.
- Arnaldo
[toc] | [prev] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2016-02-17 00:40 +0100 |
| Subject | Re: [PATCH v6 01/25] perf hists browser: Fix percentage update on key press |
| Message-ID | <r2XnP-6lB-9@gated-at.bofh.it> |
| In reply to | #1335833 |
Hi Arnaldo,
On Tue, Feb 16, 2016 at 05:53:23PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Feb 16, 2016 at 05:06:08PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, Feb 16, 2016 at 11:08:19PM +0900, Namhyung Kim escreveu:
> > > Currently 'perf top --tui' decrements percentage of all entries on any
> > > key press. This is because it adds total period as new samples are
> > > added to hists. As perf-top does it currently but added samples are not
> > > passed to the display thread, the percentages are decresing
> > > continuously.
> > >
> > > So separate total period stat into a different variable so that it
> > > cannot affect the output total period. This new total period stats are
> > > used only for calcualating callchain percent limit.
> >
> > I'm trying to figure this out now, but please next time add a line like
> >
> > Fixes: aabbccddeeff ("perf tools: buggy commit description")
> >
> > This helps reviewing as well as to figure out if this needs to go to
> > stable@kernel.org, etc.
OK.
>
> So this is the one:
>
> [acme@ssdandy linux]$ git bisect good
> 0f58474ec835f6fc80af2cde2c7ed5495cd212ba is the first bad commit
> commit 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
> Author: Namhyung Kim <namhyung@kernel.org>
> Date: Thu Jan 28 00:40:49 2016 +0900
>
> perf hists: Update hists' total period when adding entries
>
> Currently the hist entry addition path doesn't update total_period of
> hists and it's calculated during 'resort' path. But the resort path
> needs to know the total period before doing its job because it's used
> for calculating percent limit of callchains in hist entries.
>
> So this patch update the total period during the addition path. It
> makes the percent limit of callchains working (again).
>
> 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-3-git-send-email-namhyung@kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> :040000 040000 ff6b15566490dbc26fdd70af5c7ab09451d9bfcd a27ec8e9f21172b1fa3617498976d04a2fcc2449 M tools
> [acme@ssdandy linux]$
>
> So we this in this cset:
>
> Fixes: 0f58474ec835 ("perf hists: Update hists' total period when adding entries")
>
> And it needs to go to stable@kernel.org # v4.4+
>
> [acme@ssdandy linux]$ git describe 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
> v4.4-5893-g0f58474ec835
>
> Please double check this, I'll be OOO in a moment.
I think it's not needed to CC the stable this time. AFAIK this patch
didn't go to the mainline yet. It's only in the tip tree.
I think you need to use git name-rev instead of git describe.
$ git name-rev --tags 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
0f58474ec835f6fc80af2cde2c7ed5495cd212ba undefined
$ git branch -r --contains 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
acme/perf/core
$ git tag --contains 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
(nothing)
$ git remote -v
acme git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git (fetch)
acme git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git (push)
origin git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git (fetch)
origin git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git (push)
...
Thanks,
Namhyung
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2016-02-17 14:50 +0100 |
| Subject | Re: [PATCH v6 01/25] perf hists browser: Fix percentage update on key press |
| Message-ID | <r3aEr-770-17@gated-at.bofh.it> |
| In reply to | #1335925 |
Em Wed, Feb 17, 2016 at 08:39:08AM +0900, Namhyung Kim escreveu:
> On Tue, Feb 16, 2016 at 05:53:23PM -0300, Arnaldo Carvalho de Melo wrote:
> > So we this in this cset:
> > Fixes: 0f58474ec835 ("perf hists: Update hists' total period when adding entries")
> > And it needs to go to stable@kernel.org # v4.4+
> > [acme@ssdandy linux]$ git describe 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
> > v4.4-5893-g0f58474ec835
> > Please double check this, I'll be OOO in a moment.
> I think it's not needed to CC the stable this time. AFAIK this patch
> didn't go to the mainline yet. It's only in the tip tree.
> I think you need to use git name-rev instead of git describe.
Thanks for double checking it and pointing me to 'git name-rev' and
'branch/tag --contains', I'll be using those commands from now on,
probably will add it to my 'fixes' script to add the relevant 'Cc:
stable@kernel.org # v4.x+' line :-)
- Arnaldo
> $ git name-rev --tags 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
> 0f58474ec835f6fc80af2cde2c7ed5495cd212ba undefined
>
> $ git branch -r --contains 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
> acme/perf/core
>
> $ git tag --contains 0f58474ec835f6fc80af2cde2c7ed5495cd212ba
> (nothing)
>
> $ git remote -v
> acme git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git (fetch)
> acme git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git (push)
> origin git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git (fetch)
> origin git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git (push)
> ...
>
>
> Thanks,
> Namhyung
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Namhyung Kim <tipbot@zytor.com> |
|---|---|
| Date | 2016-02-20 12:50 +0100 |
| Subject | [tip:perf/core] perf hists browser: Fix percentage update on key press |
| Message-ID | <r4ecW-4Q7-5@gated-at.bofh.it> |
| In reply to | #1335423 |
Commit-ID: 467ef10c68b90b940412390dcd14bbfe8cc40e73
Gitweb: http://git.kernel.org/tip/467ef10c68b90b940412390dcd14bbfe8cc40e73
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Tue, 16 Feb 2016 23:08:19 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 19 Feb 2016 19:12:51 -0300
perf hists browser: Fix percentage update on key press
Currently 'perf top --tui' decrements percentage of all entries on any
key press. This is because it adds total period as new samples are
added to hists. As perf-top does it currently but added samples are not
passed to the display thread, the percentages are decresing
continuously.
So separate total period stat into a different variable so that it
cannot affect the output total period. This new total period stats are
used only for calcualating callchain percent limit.
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: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 0f58474ec835 ("perf hists: Update hists' total period when adding entries")
Link: http://lkml.kernel.org/r/1455631723-17345-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 26 +++++++++++++++++++-------
tools/perf/util/hist.h | 2 ++
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 561e947..a856617 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -405,6 +405,16 @@ static u8 symbol__parent_filter(const struct symbol *parent)
return 0;
}
+static void hist_entry__add_callchain_period(struct hist_entry *he, u64 period)
+{
+ if (!symbol_conf.use_callchain)
+ return;
+
+ he->hists->callchain_period += period;
+ if (!he->filtered)
+ he->hists->callchain_non_filtered_period += period;
+}
+
static struct hist_entry *hists__findnew_entry(struct hists *hists,
struct hist_entry *entry,
struct addr_location *al,
@@ -434,9 +444,7 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists,
if (!cmp) {
if (sample_self) {
he_stat__add_period(&he->stat, period, weight);
- hists->stats.total_period += period;
- if (!he->filtered)
- hists->stats.total_non_filtered_period += period;
+ hist_entry__add_callchain_period(he, period);
}
if (symbol_conf.cumulate_callchain)
he_stat__add_period(he->stat_acc, period, weight);
@@ -471,9 +479,8 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists,
return NULL;
if (sample_self)
- hists__inc_stats(hists, he);
- else
- hists->nr_entries++;
+ hist_entry__add_callchain_period(he, period);
+ hists->nr_entries++;
rb_link_node(&he->rb_node_in, parent, p);
rb_insert_color(&he->rb_node_in, hists->entries_in);
@@ -1227,9 +1234,14 @@ static void output_resort(struct hists *hists, struct ui_progress *prog,
struct rb_root *root;
struct rb_node *next;
struct hist_entry *n;
+ u64 callchain_total;
u64 min_callchain_hits;
- min_callchain_hits = hists__total_period(hists) * (callchain_param.min_percent / 100);
+ callchain_total = hists->callchain_period;
+ if (symbol_conf.filter_relative)
+ callchain_total = hists->callchain_non_filtered_period;
+
+ min_callchain_hits = callchain_total * (callchain_param.min_percent / 100);
if (sort__need_collapse)
root = &hists->entries_collapsed;
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 840b6d6..045a9e7 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -66,6 +66,8 @@ struct hists {
struct rb_root entries_collapsed;
u64 nr_entries;
u64 nr_non_filtered_entries;
+ u64 callchain_period;
+ u64 callchain_non_filtered_period;
struct thread *thread_filter;
const struct dso *dso_filter;
const char *uid_filter_str;
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web