From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, acme@redhat.com,
a.p.zijlstra@chello.nl, namhyung@kernel.org, mingo@kernel.org,
dsahern@gmail.com, adrian.hunter@intel.com, jolsa@redhat.com,
eranian@google.com, tglx@linutronix.de
Subject: [tip:perf/core] perf report: Get rid of report__inc_stat()
Date: Wed, 28 Jan 2015 07:04:40 -0800 [thread overview]
Message-ID: <tip-590cd344e2099c7b040b29d3a711b4c26358def5@git.kernel.org> (raw)
In-Reply-To: <1419223455-4362-2-git-send-email-namhyung@kernel.org>
Commit-ID: 590cd344e2099c7b040b29d3a711b4c26358def5
Gitweb: http://git.kernel.org/tip/590cd344e2099c7b040b29d3a711b4c26358def5
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 22 Dec 2014 13:44:09 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 21 Jan 2015 13:24:32 -0300
perf report: Get rid of report__inc_stat()
The report__inc_stat() function collects the number of hist entries in
the session in order to calculate the max size of the progess bar.
It'd be better if it does it during the addition of hist entries so that
it can be used by other places too.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1419223455-4362-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-report.c | 16 +++-------------
tools/perf/util/hist.c | 2 ++
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 072ae8a..2f91094 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -86,17 +86,6 @@ static int report__config(const char *var, const char *value, void *cb)
return perf_default_config(var, value, cb);
}
-static void report__inc_stats(struct report *rep, struct hist_entry *he)
-{
- /*
- * The @he is either of a newly created one or an existing one
- * merging current sample. We only want to count a new one so
- * checking ->nr_events being 1.
- */
- if (he->stat.nr_events == 1)
- rep->nr_entries++;
-}
-
static int hist_iter__report_callback(struct hist_entry_iter *iter,
struct addr_location *al, bool single,
void *arg)
@@ -108,8 +97,6 @@ static int hist_iter__report_callback(struct hist_entry_iter *iter,
struct mem_info *mi;
struct branch_info *bi;
- report__inc_stats(rep, he);
-
if (!ui__has_annotation())
return 0;
@@ -499,6 +486,9 @@ static int __cmd_report(struct report *rep)
report__warn_kptr_restrict(rep);
+ evlist__for_each(session->evlist, pos)
+ rep->nr_entries += evsel__hists(pos)->nr_entries;
+
if (use_browser == 0) {
if (verbose > 3)
perf_session__fprintf(session, stdout);
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 038483a..e17163f 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -429,6 +429,8 @@ static struct hist_entry *add_hist_entry(struct hists *hists,
if (!he)
return NULL;
+ hists->nr_entries++;
+
rb_link_node(&he->rb_node_in, parent, p);
rb_insert_color(&he->rb_node_in, hists->entries_in);
out:
next prev parent reply other threads:[~2015-01-28 20:50 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-22 4:44 [PATCHSET 0/7] perf tools: A small random cleanup and fixups Namhyung Kim
2014-12-22 4:44 ` [PATCH 1/7] perf report: Get rid of report__inc_stat() Namhyung Kim
2015-01-28 15:04 ` tip-bot for Namhyung Kim [this message]
2014-12-22 4:44 ` [PATCH 2/7] perf report: Show progress bar for output resorting Namhyung Kim
2015-01-01 21:28 ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2014-12-22 4:44 ` [PATCH 3/7] perf ui/tui: Print backtrace symbols when segfault occurred Namhyung Kim
2015-01-01 21:28 ` [tip:perf/urgent] perf ui/tui: Print backtrace symbols when segfault occurs tip-bot for Namhyung Kim
2014-12-22 4:44 ` [PATCH 4/7] perf diff: Fix to sort by baseline field by default Namhyung Kim
2014-12-22 14:45 ` Arnaldo Carvalho de Melo
2014-12-23 4:12 ` Namhyung Kim
2014-12-23 13:30 ` Arnaldo Carvalho de Melo
2014-12-22 4:44 ` [PATCH 5/7] perf diff: Get rid of hists__compute_resort() Namhyung Kim
2014-12-22 4:44 ` [PATCH 6/7] perf tools: Append callchains only when requested Namhyung Kim
2015-01-01 21:29 ` [tip:perf/urgent] perf callchain: " tip-bot for Namhyung Kim
2015-01-03 2:25 ` [PATCH 6/7] perf tools: " Arnaldo Carvalho de Melo
2015-01-03 15:01 ` Namhyung Kim
2015-01-05 12:49 ` Arnaldo Carvalho de Melo
2015-01-07 7:28 ` Namhyung Kim
2014-12-22 4:44 ` [PATCH 7/7] perf tools: Set attr.task bit for a tracking event Namhyung Kim
2014-12-22 14:49 ` Arnaldo Carvalho de Melo
2014-12-23 4:06 ` Namhyung Kim
2014-12-23 13:28 ` Arnaldo Carvalho de Melo
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-590cd344e2099c7b040b29d3a711b4c26358def5@git.kernel.org \
--to=tipbot@zytor.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).