From: tip-bot for Anton Blanchard <anton@samba.org>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
anton@samba.org, hpa@zytor.com, mingo@redhat.com,
a.p.zijlstra@chello.nl, fweisbec@gmail.com, ebmunson@us.ibm.com,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/core] perf: Fix performance issue with perf report
Date: Tue, 4 May 2010 17:04:12 GMT [thread overview]
Message-ID: <tip-02bf60aad7d5912dfcdbe0154f1bd67ea7a8301e@git.kernel.org> (raw)
In-Reply-To: <20100504111915.GB14636@kryten>
Commit-ID: 02bf60aad7d5912dfcdbe0154f1bd67ea7a8301e
Gitweb: http://git.kernel.org/tip/02bf60aad7d5912dfcdbe0154f1bd67ea7a8301e
Author: Anton Blanchard <anton@samba.org>
AuthorDate: Tue, 4 May 2010 21:19:15 +1000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 4 May 2010 10:54:09 -0300
perf: Fix performance issue with perf report
On a large machine we spend a lot of time in perf_header__find_attr when
running perf report.
If we are parsing a file without PERF_SAMPLE_ID then for each sample we call
perf_header__find_attr and loop through all counter IDs, never finding a match.
As the machine gets larger there are more per cpu counters and we spend an
awful lot of time in there.
The patch below initialises each sample id to -1ULL and checks for this in
perf_header__find_attr. We may need to do something more intelligent eventually
(eg a hash lookup from counter id to attr) but this at least fixes the most
common usage of perf report.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Eric B Munson <ebmunson@us.ibm.com>
Acked-by: Eric B Munson <ebmunson@us.ibm.com>
LKML-Reference: <20100504111915.GB14636@kryten>
Signed-off-by: Anton Blanchard <anton@samba.org>
--
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/event.c | 1 +
| 8 ++++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 1757b0f..2477270 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -713,6 +713,7 @@ int event__parse_sample(event_t *event, u64 type, struct sample_data *data)
array++;
}
+ data->id = -1ULL;
if (type & PERF_SAMPLE_ID) {
data->id = *array;
array++;
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 2b9f898..8847bec 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -922,6 +922,14 @@ perf_header__find_attr(u64 id, struct perf_header *header)
{
int i;
+ /*
+ * We set id to -1 if the data file doesn't contain sample
+ * ids. Check for this and avoid walking through the entire
+ * list of ids which may be large.
+ */
+ if (id == -1ULL)
+ return NULL;
+
for (i = 0; i < header->attrs; i++) {
struct perf_header_attr *attr = header->attr[i];
int j;
prev parent reply other threads:[~2010-05-04 17:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-04 11:19 [PATCH] perf: Fix performance issue with perf report Anton Blanchard
2010-05-04 11:56 ` Eric B Munson
2010-05-04 17:04 ` tip-bot for Anton Blanchard [this message]
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-02bf60aad7d5912dfcdbe0154f1bd67ea7a8301e@git.kernel.org \
--to=anton@samba.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=ebmunson@us.ibm.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.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