From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: wangnan0@huawei.com, hpa@zytor.com, eranian@google.com,
peterz@infradead.org, dsahern@gmail.com, acme@redhat.com,
namhyung@kernel.org, tglx@linutronix.de,
linux-kernel@vger.kernel.org, mingo@kernel.org,
andi@firstfloor.org, jolsa@kernel.org
Subject: [tip:perf/core] perf hists browser: Fix percentage update on key press
Date: Sat, 20 Feb 2016 03:39:02 -0800 [thread overview]
Message-ID: <tip-467ef10c68b90b940412390dcd14bbfe8cc40e73@git.kernel.org> (raw)
In-Reply-To: <1455631723-17345-2-git-send-email-namhyung@kernel.org>
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;
next prev parent reply other threads:[~2016-02-20 11:40 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 14:08 [PATCHSET 00/25] perf tools: Add support for hierachy view (v6) Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 01/25] perf hists browser: Fix percentage update on key press Namhyung Kim
2016-02-16 20:06 ` Arnaldo Carvalho de Melo
2016-02-16 20:53 ` Arnaldo Carvalho de Melo
2016-02-16 23:39 ` Namhyung Kim
2016-02-17 13:41 ` Arnaldo Carvalho de Melo
2016-02-20 11:39 ` tip-bot for Namhyung Kim [this message]
2016-02-16 14:08 ` [PATCH v6 02/25] perf callchain: Check return value of add_child() Namhyung Kim
2016-02-20 11:39 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 03/25] perf callchain: Check return value of fill_node() Namhyung Kim
2016-02-20 11:39 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 04/25] perf callchain: Add enum match_result for match_chain() Namhyung Kim
2016-02-20 11:40 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 05/25] perf callchain: Check return value of split_add_child() Namhyung Kim
2016-02-20 11:40 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 06/25] perf callchain: Check return value of append_chain_children() Namhyung Kim
2016-02-20 11:40 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 07/25] perf hists: Return error from hists__collapse_resort() Namhyung Kim
2016-02-20 11:41 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 08/25] perf report: Check error during report__collapse_hists() Namhyung Kim
2016-02-20 11:41 ` [tip:perf/core] " tip-bot for Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 09/25] perf hists: Basic support of hierarchical report view Namhyung Kim
2016-02-20 23:18 ` Jiri Olsa
2016-02-21 8:32 ` Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 10/25] perf hists: Resort hist entries with hierarchy Namhyung Kim
2016-02-20 23:19 ` Jiri Olsa
2016-02-21 8:36 ` Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 11/25] perf hists: Add helper functions for hierarchy mode Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 12/25] perf hists: Introduce hist_entry__filter() Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 13/25] perf hists: Support filtering in hierarchy mode Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 14/25] perf hists: Resort after filtering hierarchy Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 15/25] perf hists: Count number of sort keys Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 16/25] perf ui/stdio: Implement hierarchy output mode Namhyung Kim
2016-02-20 23:18 ` Jiri Olsa
2016-02-21 8:43 ` Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 17/25] perf ui/stdio: Align column header for hierarchy output Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 18/25] perf hists browser: Count number of hierarchy entries Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 19/25] perf hists browser: Support collapsing/expanding whole entries in hierarchy Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 20/25] perf hists browser: Implement hierarchy output Namhyung Kim
2016-02-20 23:19 ` Jiri Olsa
2016-02-16 14:08 ` [PATCH v6 21/25] perf hists browser: Align column header in hierarchy mode Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 22/25] perf ui/gtk: Implement hierarchy output mode Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 23/25] perf report: Add --hierarchy option Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 24/25] perf hists: Support decaying in hierarchy mode Namhyung Kim
2016-02-16 14:08 ` [PATCH v6 25/25] perf top: Add --hierarchy option Namhyung Kim
2016-02-20 23:19 ` Jiri Olsa
2016-02-21 9:19 ` Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-467ef10c68b90b940412390dcd14bbfe8cc40e73@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=andi@firstfloor.org \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox